An open API service indexing awesome lists of open source software.

https://github.com/diamondlightsource/python-copier-template

Diamond's opinionated copier template for pure Python projects managed by pip
https://github.com/diamondlightsource/python-copier-template

Last synced: 3 months ago
JSON representation

Diamond's opinionated copier template for pure Python projects managed by pip

Awesome Lists containing this project

README

        

[![CI](https://github.com/DiamondLightSource/python-copier-template/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/python-copier-template/actions/workflows/ci.yml)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)

# python-copier-template

Diamond's opinionated [copier](https://copier.readthedocs.io) 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

Source |
:---: | :---:
Documentation |
Releases |

It integrates the following tools:

- [setuptools](https://setuptools.pypa.io) and [setuptools-scm](https://setuptools-scm.readthedocs.io) for packaging
- [pip](https://pip.pypa.io) to manage installation
- [pytest](https://docs.pytest.org) for code testing and coverage
- [pre-commit](https://pre-commit.com) to run linting and formatting such as [ruff](https://docs.astral.sh/ruff)
- [pyright](https://microsoft.github.io/pyright) or [mypy](https://www.mypy-lang.org) for static type checking
- [sphinx](https://www.sphinx-doc.org) for tutorials, how-to guides, explanations and reference documentation
- [tox](https://tox.wiki) to run the above tasks locally and in CI
- [GitHub Actions](https://docs.github.com/en/actions) to provide CI and deployment to PyPI and GitHub Pages
- [VSCode](https://code.visualstudio.com/docs) settings for running the above tools on save

## Example

You can see the template in action in the [example project](https://github.com/DiamondLightSource/python-copier-template-example). This is an up to date expansion of the template to illustrate how it looks with all the options enabled.

## Create a new project via Developer Portal

> [!NOTE]
> Template creation from the developer portal is currently under construction, so these instructions do not work yet

Visit 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.

## Create a new project from the commandline

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.