Contributions are welcome! This document covers development setup, code quality standards, and the release process.
We recommend using uv for fast dependency management.
-
Clone the repository:
git clone https://github.com/elijahr/python-autopxd2.git cd python-autopxd2 -
Create a virtual environment and install dependencies:
# Using uv (recommended) uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv pip install -e '.[test,lint,docs]' # Or using pip python -m venv .venv source .venv/bin/activate pip install -e '.[test,lint,docs]'
-
Install pre-commit hooks:
pre-commit install
We use pre-commit with ruff for linting and formatting. The following checks run automatically on commit:
- ruff - Linting (replaces flake8, pylint, isort, etc.)
- ruff-format - Code formatting (replaces black)
To run all checks manually:
pre-commit run --all-filesOr run ruff directly:
ruff check autopxd # Lint
ruff check --fix autopxd # Lint and auto-fix
ruff format autopxd # FormatWe use mypy with strict mode:
mypy autopxd/ --strictpytestOr with verbose output:
pytest -vSome tests (test_real_headers.py) require actual C/C++ libraries to be installed. These tests are marked with @pytest.mark.real_headers.
Install test libraries:
# macOS
./scripts/install-test-libs-macos.sh
# Linux (Debian/Ubuntu)
sudo ./scripts/install-test-libs-linux.shSkip real header tests (if libraries aren't installed):
pytest -m "not real_headers"Build a Docker image with test libraries for running the full test suite:
docker build --build-arg TEST_MODE=1 -t autopxd2-test .
docker run --rm -v $(pwd):/app -w /app autopxd2-test pytest# Serve docs locally with live reload
uv run mkdocs serve
# Or without uv
mkdocs serve
# Build static site
mkdocs build- Create a branch for your changes
- Ensure all tests pass and pre-commit checks are clean
- Submit a pull request with a clear description of the changes
This section is for project maintainers who can publish releases.
-
Update version in
pyproject.toml:version = "X.Y.Z"
-
Update
CHANGELOG.mdwith the release notes -
Commit and push to master:
git add pyproject.toml CHANGELOG.md git commit -m "Bump to vX.Y.Z" git push origin master
Important: The git ref you release from (the tag, or the SHA passed to the manual
workflow_dispatch) MUST contain thepyproject.tomlversion bump.workflow_dispatchaccepts an arbitrary ref and will happily build and publish from a ref that lacks the bump.
The publish workflow builds the sdist and wheel, then runs check-manifest
and twine check --strict before uploading the distribution artifacts. If
the sdist is missing any version-controlled file that belongs in it (for
example, a new test helper or fixture), check-manifest fails, the build
job fails, and because publish-pypi depends on build, nothing is published.
check-manifest also runs locally via pre-commit, so drift is usually caught
before you push. If it flags a new file, update MANIFEST.in (to ship it) or
the [tool.check-manifest] ignore list in pyproject.toml (to keep it out
of the sdist) — never weaken the gate to make it pass.
- Go to Releases
- Click Draft a new release
- Create a new tag:
vX.Y.Z - Set the release title:
vX.Y.Z - Add release notes (can copy from CHANGELOG.md)
- Click Publish release
This triggers the publish workflow automatically.
The workflow uses a protected pypi environment that requires approval:
- Go to Actions
- Find the running "Publish to PyPI" workflow
- Click Review deployments
- Select the
pypienvironment and click Approve and deploy
The package will be published to PyPI via OIDC trusted publishing.
You can also trigger a publish manually:
- Go to Actions → Publish to PyPI
- Click Run workflow
- Enter the git ref (tag or commit SHA)
- Click Run workflow
- Approve the deployment as above
This project uses PyPI Trusted Publishing (OIDC) instead of API tokens. This is configured on PyPI with:
- Owner:
elijahr - Repository:
python-autopxd2 - Workflow:
publish.yml - Environment:
pypi
To add a new maintainer who can approve deployments:
- Go to Settings → Environments → pypi
- Under Required reviewers, add the maintainer's GitHub username
- They must have write access to the repository
After publishing, verify:
- Package appears on PyPI
- Version is correct:
pip index versions autopxd2 - Installation works:
pip install autopxd2==X.Y.Z