Diamond's opinionated copier template for pure Python projects managed by pip. It can be optionally used to:
- Create new projects from
- Update existing projects in line with it
- Keep projects in sync with changes to it
- Provide a source of inspiration to cherry-pick from
It integrates the following tools:
- setuptools and setuptools-scm for packaging
- pip to manage installation
- pytest for code testing and coverage
- pre-commit to run linting and formatting such as ruff
- pyright or mypy for static type checking
- sphinx for tutorials, how-to guides, explanations and reference documentation
- tox to run the above tasks locally and in CI
- GitHub Actions to provide CI and deployment to PyPI and GitHub Pages
- VSCode settings for running the above tools on save
You can see the template in action in the example project. This is an up to date expansion of the template to illustrate how it looks with all the options enabled.
Note
Template creation from the developer portal is currently under construction, so these instructions do not work yet
Visit https://dev-portal.diamond.ac.uk/create and you will see a list of templates that you can create. Pick the one marked Python Template
and fill in the details of the project.
You will need to pip install copier
inside an activated venv
from python3.10 or later, then you can create a new module via:
mkdir /path/to/my-project
# The --trust argument is required to run setup tasks such as initializing a git repository
copier copy --trust gh:DiamondLightSource/python-copier-template /path/to/my-project
You can also use it via pipx run copier
if you have that installed.
See https://DiamondLightSource.github.io/python-copier-template for more detailed documentation.