Skip to content

Notes for contributors

Uche Ogbuji edited this page Nov 12, 2023 · 15 revisions

Set up

For running the tests, working on contributions, etc, you need a virtualenv setup with the dev environment dependencies (pytest, pytest-cov, pytest-mock, etc.)):

pip install ruff pytest pytest-mock pytest-asyncio pytest-cov respx pgvector asyncpg pytest-asyncio

Code formatting etc.

Note: in order to pass CI, you'll also need to be lint clean. From the project dir you can just do:

ruff check .

Our project code convention settings are in pyproject.toml

Automated testing & coverage

To run the coverage tests:

pytest --cov=ogbujipt test

You can also get other report formats by using e.g. --cov-report=html

Note: for reasons I'm still investigating (some of the more recent developments and issues in Python packaging are quite esoteric), some of the hatch tools such as hatch run are problematic. I suspect they might not like the way I rename directories during build, but I won't be compromising on that.

Releasing new versions

For now it's pretty simple. If it's a change you want to signal to users in any way, bump the release via hatch. From the checked out repo, do e.g.

hatch version micro

This would, for example, update the project version from 0.0.1 to 0.0.2, or from 0.0.9 to 0.0.10. It will update your local copy of __about__.py, so you'll want to commit & push that, alongside the other changes.

You can also use hatch version to make more significant releases, but you'll want to be clear what you're doing.

Release on Github

Pre-checklist:

  • Update CHANGELOG.md check README.md
  • Make sure tip of main is passing CI

https://github.com/uogbuji/OgbujiPT/releases and add a new release.

Set the version number (e.g. 0.3.0) as the release name, and select to create a new tag and use the same version number. You should be able to paste in the description from CHANGELOG.md. Then click Publish.

Release on PyPI

https://pypi.org/project/OgbujiPT/0.3.0/

First, Build a .whl

python3 -m build -w

You have to have twine installed

pip install twine

You also need a ~/.pypirc file with your PyPI account details.

Then the actual upload:

twine upload dist/*