Skip to content

build: make the package publishable to PyPI (0.3.2) - #7

Merged
abyot merged 2 commits into
mainfrom
chore/publishable-packaging
Oct 5, 2026
Merged

abyot merged 2 commits into
mainfrom
chore/publishable-packaging

Conversation

@abyot

@abyot abyot commented Oct 5, 2026

Copy link
Copy Markdown
Member

Packaging and hygiene only; no client behaviour changes. Needed so Open Climate Service can depend on dhis2-client as a normal extra instead of a git pin (CLIM-1142).

What was missing

  • No LICENSE file, although the metadata declared BSD-3-Clause.
  • No classifiers, project URLs or keywords; no py.typed.
  • The dev extra lacked respx and python-dotenv, so pip install -e .[dev] followed by pytest failed at the conftest import.
  • No CI at all: nothing ran tests, nothing published.
  • 62 ruff errors under the repository's own configuration.
  • Changelog out of order with no 0.2.0 entry.

Changes

  • LICENSE, py.typed, SPDX licence expression, classifiers, URLs, keywords; version 0.3.2.
  • dev extra completed; examples extra for matplotlib; requirements-dev.txt installs both.
  • .github/workflows/test.yml: ruff and pytest on Python 3.10 to 3.13 for pushes and PRs.
  • .github/workflows/publish.yml: on a v* tag, verify the tag matches the version, build, twine check, upload with PyPI trusted publishing (no stored token).
  • Lint fixes in a separate commit for review.
  • Changelog ordered, 0.2.0 and 0.3.2 entries added; README install section points at PyPI.

Verified

ruff check . clean. 54 unit tests pass. uv build and twine check pass; the wheel contains licenses/LICENSE, py.typed, 12 classifiers and the project URLs.

Before tagging

  1. On PyPI, add a pending trusted publisher for dhis2/dhis2-python-client, workflow publish.yml, environment pypi.
  2. Create the pypi environment in this repository's settings.
  3. Tag v0.3.2 on the merge commit. The stray V0.3.0 tag (capital V, on a different commit from the 0.3.0 release) should be deleted so it never matches the v* trigger by accident on a case-insensitive client.

abyot added 2 commits October 5, 2026 13:10
Sort imports, drop unused ones, remove trailing whitespace, split semicolon-joined and
colon-joined statements, and wrap the lines over 120 characters. No behaviour change.
Add the BSD-3-Clause LICENSE file the metadata already declared, a py.typed marker, and
the PyPI metadata that was missing: SPDX licence expression, classifiers, keywords and
project URLs. The dev extra now installs everything the test suite needs; matplotlib
moves to an examples extra and requirements-dev.txt installs both.

Add GitHub Actions: lint and tests on every push and pull request across Python 3.10
to 3.13, and a publish workflow that builds, checks and uploads to PyPI on a v* tag
through trusted publishing after verifying the tag matches the package version.

Put the changelog in order, add the missing 0.2.0 entry, and point the README at
pip install dhis2-client.
@abyot
abyot merged commit 4c669d3 into main Oct 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant