Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools virtualenv
make env
make init
# - name: Lint with flake8
# run: |
# pip install flake8
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ coverage.xml
/.tox/
/build/
/dist/
/env/
/.eggs/
.vscode
/.venv/
36 changes: 22 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
.PHONY: test tests build docs lint upload
.PHONY: init test tests build docs lint upload bump

BIN = env/bin
BIN = .venv/bin
PYTHON = $(BIN)/python
PIP = $(BIN)/pip
UV = $(BIN)/uv

SPHINXBUILD = $(shell pwd)/env/bin/sphinx-build
SPHINXBUILD = $(shell pwd)/.venv/bin/sphinx-build

env: requirements.txt setup.py
test -f $(PYTHON) || python3 -m venv env
$(PIP) install -U -r requirements.txt
$(PYTHON) setup.py develop

tests: env
.venv: pyproject.toml uv.lock
which uv >/dev/null || python3 -m pip install -U uv
uv sync --extra dev

init: .venv
.PHONY: init


tests: init
$(BIN)/tox
.PHONY: tests

Expand All @@ -25,15 +29,15 @@ coverage:
.PHONY: coverage

build:
$(PYTHON) setup.py sdist
$(UV) build
.PHONY: build

clean-docs:
cd docs; make clean
.PHONY: clean-docs

clean: clean-docs
rm -rf *.egg-info .mypy_cache coverage.xml env
rm -rf *.egg-info .mypy_cache coverage.xml .venv
find . -name "*.pyc" -type f -delete
find . -type d -empty -delete
.PHONY: clean-python
Expand All @@ -57,8 +61,12 @@ format:
$(BIN)/black $(BLACK_ARGS) hl7 tests
.PHONY: isort

upload:
upload:
rm -rf dist
$(PYTHON) setup.py sdist bdist_wheel
$(BIN)/twine upload dist/*
$(UV) build
$(UV) publish
.PHONY: upload

bump: init
$(BIN)/cz bump
.PHONY: bump
7 changes: 7 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ Changelog
------------------

* Dropped support for Python 3.7 and 3.8. Python 3.9 - 3.13 are now supported.
* Switched development dependencies to be installed using ``uv`` instead of ``pip``.
* Converted packaging to ``pyproject.toml`` using ``hatchling`` and removed
``requirements.txt``.
* Added ``commitizen`` to manage version bumps and changelog entries.
* Added ``make bump`` target and replaced ``make env`` with ``make init`` for
setting up the development environment.
* Removed deprecated ``hl7.version`` module; use ``hl7.__version__`` instead.


0.4.5 - March 2022
Expand Down
25 changes: 21 additions & 4 deletions docs/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ The test suite is located in :file:`tests/` and can be run several ways.

It is recommended to run the full `tox <http://tox.testrun.org/>`_ suite so
that all supported Python versions are tested and the documentation is built
and tested. We provide a :file:`Makefile` to create a virtualenv, install tox,
and run tox::
and tested. We provide a :file:`Makefile` that uses ``uv`` to create a
virtual environment. Initialize the environment and run tox::

$ make init
$ make tests
py27: commands succeeded
py26: commands succeeded
docs: commands succeeded
congratulations :)

To run the test suite with a specific python interpreter::
To run the test suite with a specific Python interpreter::

python setup.py test
python -m unittest discover -t . -s tests

To documentation is built by tox, but you can manually build via::

Expand All @@ -52,3 +53,19 @@ It is also recommended to run the flake8 checks for PEP8 and PyFlake
violations. Commits should be free of warnings::

$ make lint

Releases
--------

`Commitizen <https://commitizen-tools.github.io/commitizen/>`_ is used to
manage project versions and the changelog. After changes are merged to the
main branch, bump the version and update ``docs/changelog.rst`` with::

$ make bump

This uses ``cz bump`` to update ``pyproject.toml`` and ``hl7/__init__.py`` with the new version.

Build the release artifacts and publish to PyPI using::

$ make build
$ make upload
3 changes: 1 addition & 2 deletions hl7/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
)
from .parser import parse, parse_batch, parse_file, parse_hl7
from .util import generate_message_control_id, isbatch, isfile, ishl7, split_file
from .version import get_version

__version__ = get_version()
__version__ = "0.4.6.dev0"
__author__ = "John Paulett"
__email__ = "john -at- paulett.org"
__license__ = "BSD"
Expand Down
31 changes: 0 additions & 31 deletions hl7/version.py

This file was deleted.

85 changes: 85 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "hl7"
description = "Python library parsing HL7 v2.x messages"
readme = "README.rst"
requires-python = ">=3.9"
license = { file = "LICENSE" }
version = "0.4.6.dev0"
authors = [
{ name = "John Paulett", email = "john@paulett.org" }
]
keywords = [
"HL7",
"Health Level 7",
"healthcare",
"health care",
"medical record",
"mllp"
]
classifiers = [
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Healthcare Industry",
"Topic :: Communications",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
"Topic :: Software Development :: Libraries :: Python Modules"
]

[project.urls]
Source = "https://github.com/johnpaulett/python-hl7"

[project.scripts]
mllp_send = "hl7.client:mllp_send"

[project.optional-dependencies]
# Development requirements previously listed in requirements.txt
dev = [
"tox==4.26.0",
"flake8==7.2.0",
"Sphinx==7.2.6",
"coverage==6.3.2",
"isort==5.10.1",
"black==22.3.0",
"wheel==0.37.1",
"setuptools==80.9.0",
"hatchling",
"commitizen==3.13.0"
]

[tool.hatch.build.targets.sdist]
include = [
"hl7",
"tests",
"docs",
"README.rst",
"LICENSE",
"AUTHORS",
"MANIFEST.in"
]

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 88
known_first_party = "hl7"

[tool.commitizen]
name = "cz_conventional_commits"
version = "0.4.6.dev0"
tag_format = "$version"
version_files = [
"pyproject.toml:version",
"hl7/__init__.py:__version__",
]
changelog_file = "docs/changelog.rst"
update_changelog_on_bump = true
10 changes: 0 additions & 10 deletions requirements.txt

This file was deleted.

18 changes: 0 additions & 18 deletions setup.cfg

This file was deleted.

59 changes: 0 additions & 59 deletions setup.py

This file was deleted.

Loading