Template for modern Python package GitHub repositories.
- Clone the repository locally
- Run the interactive configuration script:
$ cd pyproject-template $ ./template-config.sh
- Rename the repository folder to your new repository name
- Fill in the missing information in
setup.cfg
- Remove any template instruction from this
README.md
(but keep the footer at the end!) - Choose a license and save its statement in
LICENSE
- Remove the
template-config.sh
file - Create a new (empty) GitHub repository matching your
user/repo
- Create a new commit with the unstaged changes and git-push to the remote
- Activate (you can log in with your GitHub credentials):
- https://pre-commit.ci
- https://codecov.io
- https://readthedocs.io (recommended setting: "Advanced settings" > "Build pull requests for this project")
- GitHub actions (in the repository settings)
- [Optional] Get a PyPI token and add it as a repository secret on GitHub
(name it
PYPI_PASSWORD
) to enable publishing the package.
- Install:
$ pip install . $ pip install .[test] # get ready to run tests $ pip install .[docs] # get ready to build documentation $ pip install .[all] # get all from above
- Build documentation:
$ cd docs $ make # build docs for the current version
- Run tests with
pytest
- Run pre-commit hooks with
pre-commit run --all-files
- Release a new version:
$ git tag v0.1.0 $ git checkout -b releases/v0.1 # to apply patches, if needed, later $ git push v0.1.0
- Customize the python versions / operative systems to test the package against in
.github/workflows/main.yml
- Edit the pre-commit hook configuration in
.pre-commit-config.yaml
. A long list of hooks can be found here - Adapt the Sphinx configuration in
docs/source/conf.py
- Building wheels with GitHub actions currently assumes pure Python wheels. Have a look at this Scikit-HEP documentation to learn how to configure building of binary wheels.
This Python package layout is based on pyproject-template.