Template for Python packages using GDAL (from conda-forge).
This project template includes the following features to ensure best practices:
- Overall project configuration: pyproject.toml for PEP-626-compliant project configuration.
- Tests:
- tox for testing against multiple Python versions, with support for conda dependencies using tox-conda and GitHub Actions using tox-gh-actions.
- coverage reporting with codecov integration.
- Documentation: generated with sphinx, using MyST for Markdown support, auto API generation from docstrings and hosting on readthedocs.
- Code quality: set up with pre-commit to run checks and tests before each commit, including, among others:
- Continuous integration and delivery with GitHub Actions, with jobs to run tests, publishing to test PyPI and releasing to PyPI and GitHub on new tags.
- Conventional commits and semantic versioning with commitizen to enforce conventional commits (with
commit-msg
pre-commit hooks), version bumping using semantic versioning and automated change log generation.
Generate a new project using cookiecutter:
cookiecutter gh:martibosch/cookiecutter-geopy-package
and fill in the prompts. Then, navigate to the generated directory and follow the instructions below:
- Initialize a git repository (e.g.,
git init
) and install the pre-commit hooks by runningpre-commit install
andpre-commit install --hook-type commit-msg
. - Register the project in codecov and readthedocs.
- If the repository is public, enable pre-commit.ci to automatically run pre-commit checks on GitHub and autoupdate the pre-commit hook versions.
- Create accounts (or use existing accounts) and API tokens for PyPI and test PyPI, and add them to the project's secrets in GitHub.
You can then start developing your package.
If you want your package to be available from conda-forge, you can generate a recipe for it using grayskull and then submit it by following the instructions in the conda-forge documentation.
- This template borrows several ideas from zillionare/python-project-wizard.