git clone https://github.com/luno/luno-python.gitcd luno-python
python -m venv env
source env/bin/activatepython -m pip install --upgrade pip setuptools wheel
pip install -e '.[dev]'This installs the package in editable mode with all development dependencies including testing tools and pre-commit hooks.
This project uses pre-commit to maintain code quality and consistency. The hooks run automatically before commits and pushes.
pre-commit installThis will run code formatting, linting, security checks, and tests on every commit.
To run all hooks on all files manually:
pre-commit run --all-files- Code formatting: Automatically formats code with
blackand sorts imports withisort - Linting: Checks code quality with
flake8 - Security: Scans for common security issues with
bandit - File checks: Fixes trailing whitespace, ensures files end with newlines, validates YAML/JSON
- Tests: Runs the full test suite (via
pytest)
If you need to skip hooks for a specific commit:
git commit --no-verifypytestThis project is published to PyPI. Releases are made by maintainers with repository write access and PyPI publish access.
-
Decide the version number following Semantic Versioning:
- Patch (
x.y.Z): backwards-compatible bug fixes - Minor (
x.Y.0): new backwards-compatible functionality - Major (
X.0.0): breaking changes
- Patch (
-
Bump the version in
luno_python/__init__.py:VERSION = "x.y.z"
-
Commit and push the version bump on a branch, then open and merge a PR:
git checkout -b release-x.y.z git add luno_python/__init__.py git commit -m "release: bump version to x.y.z" git push origin release-x.y.z gh pr create --title "release: bump version to x.y.z" --body "Bump version for release." # After review, merge the PR
-
Create a GitHub Release from the merged commit on
main:git checkout main && git pull origin main gh release create vx.y.z --title "vx.y.z" --generate-notes
This triggers the publishing workflow, which automatically builds and uploads the package to PyPI.
The publishing workflow uses PyPI Trusted Publishing (OpenID Connect), which means no API tokens need to be stored as secrets. This must be configured once in PyPI's project settings under Publishing → Add a new publisher, pointing at this repository's publish.yml workflow.