Skip to content

Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.

You can contribute in many ways:

Types of Contributions

Report Bugs

Report bugs at https://github.com/xinp-hub/pydiggs/issues.

If you are reporting a bug, please include:

  • Your operating system name and version.
  • Any details about your local setup that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.

Fix Bugs

Look through the GitHub issues for bugs. Anything tagged with "bug" and "help wanted" is open to whoever wants to implement it.

Implement Features

Look through the GitHub issues for features. Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it.

Write Documentation

pydiggs could always use more documentation, whether as part of the official pydiggs docs, in docstrings, or even on the web in blog posts, articles, and such.

Submit Feedback

The best way to send feedback is to file an issue at https://github.com/xinp-hub/pydiggs/issues.

If you are proposing a feature:

  • Explain in detail how it would work.
  • Keep the scope as narrow as possible, to make it easier to implement.
  • Remember that this is a volunteer-driven project, and that contributions are welcome :)

Development Setup

Open in GitHub Codespaces

The repository ships a dev container (.devcontainer/) with uv, Python 3.11–3.14 and the GitHub CLI, all pinned. Open it in GitHub Codespaces from the badge, or locally with Dev Containers: Reopen in Container. Nothing is installed on your machine, so any computer with a browser gives you the same environment, and uv sync has already run when it opens.

Commit signing in Codespaces: open github.com/settings/codespaces, turn on GPG verification and add this repository. GitHub then signs commits made in your codespaces and shows them as Verified; no signing key is copied into the container. To run the same checks as CI inside it: uv run ruff check ., uv run mypy, uv run pytest.

On your own machine

Ready to contribute? Here's how to set up pydiggs for local development.

  1. Fork the pydiggs repo on GitHub.

  2. Clone your fork locally:

    git clone git@github.com:your_name_here/pydiggs.git
    cd pydiggs
    

  3. Install uv if you haven't already:

    curl -LsSf https://astral.sh/uv/install.sh | sh
    

  4. Sync the environment (reads uv.lock):

    uv sync --all-groups
    

  5. Create a branch for local development:

    git checkout -b name-of-your-bugfix-or-feature
    

  6. Make your changes locally. The project uses:

  7. pytest for testing

  8. ruff for lint and format
  9. mypy for type checking
  10. pre-commit for automated checks (optional locally)

Install pre-commit hooks:

uv run pre-commit install

  1. When you're done making changes:
  2. Run tests:
    uv run pytest
    
  3. Lint and format:
    uv run ruff check .
    uv run ruff format .
    
  4. Type check:

    uv run mypy src
    

  5. Commit your changes and push your branch to GitHub:

    git add .
    git commit -s -m "Your detailed description of your changes."
    git push origin name-of-your-bugfix-or-feature
    

  6. Submit a pull request through the GitHub website.

Pull Request Guidelines

Before you submit a pull request, check that it meets these guidelines:

  1. The pull request should include tests.
  2. If the pull request adds functionality:
  3. Add docstrings to new functions/classes
  4. Update the documentation under docs/
  5. Add the feature to the list in README.md
  6. The pull request should work for Python 3.11 and above.
  7. Check that all tests pass in the GitHub Actions CI pipeline.
  8. Sign off every commit with git commit -s. The Signed-off-by line certifies the Developer Certificate of Origin 1.1, and your contribution is licensed under Apache-2.0 like the rest of the project. The DCO sign-off check fails a pull request with a commit that lacks it; see CONTRIBUTING.md for the terms and for how to fix existing commits.
  9. Sign your commits cryptographically as well. master only accepts commits that GitHub shows as Verified, so an unsigned pull request cannot be merged even when it is approved and green. SSH signing is the simplest setup: register an SSH key on GitHub as a signing key, then run git config --global gpg.format ssh, point user.signingkey at the public key, and set commit.gpgsign to true.

How Pull Requests Are Merged

Every pull request gets a merge policy check that puts it in one of three risk tiers. The tier is worked out from the change itself — who made it, which files it touches and what the diff contains — never from an automated reviewer's opinion.

  • Tier 0 — Dependabot updates that change only dependency versions: patch and minor updates, plus 0.x minor updates of development-only dependencies. These merge on their own once CI passes.
  • Tier 1 — small changes by the maintainers to source code, tests or documentation. An automated reviewer reads the change, and if it approves and CI passes, the pull request merges on its own.
  • Tier 2 — everything else: changes to CI workflows, packaging or dependencies by hand, GitHub Actions updates, larger changes, and every pull request from a fork. A maintainer reviews and merges these.

Merging never releases the package: release tags and PyPI uploads always need a maintainer. A merge to master does rebuild and redeploy this documentation site.

Documentation

To build and view the documentation locally:

uv sync --group docs
uv run mkdocs serve

Then visit http://127.0.0.1:8000 in your web browser.

Four checks keep the documentation true to the code:

  • Generated pages. docs/facts.md (extras, Python range and the --help of every pydiggs command), the operations table in docs/capabilities.md and docs/convert-mapping.md are written from the code. After changing an extra, a command-line option or an operation, run uv run python scripts/docs_gen.py and commit the result; uv run python scripts/docs_gen.py --check (and tests/test_docs.py) fails on a stale page. The --help text is captured on Python 3.11, the oldest supported version.
  • Examples run. tests/test_docs.py runs every python block in README.md and docs/, top to bottom, one namespace per file, in a scratch directory where the file names the guides use (site.xml, site.ags, BH-01.xml) are real files; add a name to DOC_FILES there when a new example needs another. A block that cannot run in a test gets <!-- skip: next "reason" --> on the line above it.
  • Docs follow the API. The docs follow the API check fails a pull request that adds, removes or changes public API, console scripts or extras without a change to docs/, README.md or CHANGELOG.md (docs/facts.md does not count). The no-docs-needed label is the maintainer's override: a maintainer adds it, and an agent never does.
  • Published versions. The site has two trees: latest/ is built from the newest vX.Y.Z tag and dev/ from master, with a notice on every dev/ page. The history page is CHANGELOG.md itself, embedded; there is no second copy to keep in step.

Testing

To run a subset of tests:

uv run pytest tests/test_pydiggs.py

To run tests with coverage:

uv run pytest --cov=pydiggs --cov-report=term-missing

Type Checking

The project uses type hints and mypy (strict) for type checking:

uv run mypy src

Code Style

The project follows ruff's formatter and linter. Style is enforced with: * ruff (lint + format) * GitHub Actions CI

Deploying

A reminder for the maintainers on how to deploy:

  1. Update CHANGELOG.md and bump version in pyproject.toml.
  2. Tag a release (vX.Y.Z) and push the tag (HG3 / HG4 in the FORGE process).
  3. GitHub Actions publish.yml builds with a fixed SOURCE_DATE_EPOCH and publishes to PyPI via Trusted Publishing (OIDC; no API token). The pypi environment requires a human reviewer.