Contribution guide#

Setting up the environment#

  1. make install

Code contributions#

Workflow#

  1. Fork the Pytest Databases repository

  2. Clone your fork locally with git

  3. Set up the environment

  4. Make your changes

  5. (Optional) Run make lint to run linters, type checks, and security checks.

  6. Commit your changes to git

  7. Push the changes to your fork

  8. Open a pull request. Give the pull request a descriptive title indicating what it changes. If it has a corresponding open issue, the issue number should be included in the title as well. For example a pull request that fixes issue bug: Increased stack size making it impossible to find needle #100 could be titled fix(#100): Make needles easier to find by applying fire to haystack

Tip

Pull requests and commits all need to follow the Conventional Commit format

Selective continuous integration#

Pull requests use the changed files to choose the smallest safe test scope:

  • A provider implementation or provider test change runs that provider on Python 3.12. Clientless import compatibility checks still run across Python 3.11 through 3.15 (with Python 3.15 marked non-blocking).

  • Adding or changing one provider entry in the CI manifest selects only that provider. Shared manifest settings and provider removal still fail closed by selecting every provider.

  • Shared runtime, dependency, lock, or workflow changes run every provider once on Python 3.12.

  • Documentation-only changes build the documentation and do not start containers or pull container images.

  • An unrecognized path fails closed by running every provider on Python 3.12.

The Select provider tests job summary records the changed paths, selection reason, tests, images, and estimated job and image-pull counts. This is the first place to look when a provider job did or did not run.

Add the ci:full label to a pull request to run every provider on Python 3.11 through 3.15. The same full matrix runs nightly and can be started manually from GitHub Actions. Adding or removing ci:full starts a new selection run.

CI required is the stable required-check name. It verifies the selector and every job the selector requested while allowing jobs that were intentionally out of scope to remain skipped.

Guidelines for writing code#

  • All code should be fully typed. This is enforced via mypy and pyright.

  • Shipped package behavior should be tested. Package tests are enforced via pytest.

  • All code should be properly formatted and linted via Ruff.

Writing and running tests#

Coming soon.

Project documentation#

The documentation is located in the /docs directory and is ReST and Sphinx. If you’re unfamiliar with any of those, ReStructuredText primer and Sphinx quickstart are recommended reads.

Running the docs locally#

You can serve the documentation with make docs-serve, or build them with make docs.

Creating a new release#

  1. Increment the version in pyproject.toml.

    Note

    The version should follow semantic versioning and PEP 440.

  2. Draft a new release on GitHub

    • Use vMAJOR.MINOR.PATCH (e.g. v1.2.3) as both the tag and release title

    • Fill in the release description. You can use the “Generate release notes” function to get a draft for this

  3. Commit your changes and push to main

  4. Publish the release

  5. Go to Actions and approve the release workflow

  6. Check that the workflow runs successfully