Template Python¶
Template Python is a repository generator for Python projects. To create a new Python project with the template install Cookiecutter, execute the following command, and follow its interactive prompts.
cookiecutter --directory python https://github.com/scruffaluff/templates
Setup¶
To develop with the generated project, install Just and
step into the project folder. Then execute JUST_INIT=true just setup format
and you are ready to code.
Tooling¶
Every generated Python project configures the following tools for development usage:
- Coverage: Test coverage measurer.
- MkDocs: Documentation static site generator.
- Mypy: Static type checker.
- Ruff: Code linter.
- Pytest: Testing framework.
- Tox: Test automator.
- Uv: Dependency manager and packager.
The following tools are configured if you select optional features:
prettier_support
:- Prettier: Opinionated code formatter for JSON, Markdown, and YAML files. Requires NodeJS to be externally installed on your system.
Layout¶
The following diagram shows all possible files generated by Cookiecutter. If a
file is followed by {option: selection}
, then the path and its possible
contents are only generated for that chosen context.
{{project_name}}
├── .github {githost: github}
│ └── workflows
│ └── main.yaml
├── .dockerignore
├── .gitignore
├── .gitlab-ci.yaml {githost: gitlab}
├── .prettierignore {prettier_support: yes}
├── .prettierrc.yaml {prettier_support: yes}
├── CONTRIBUTING.md
├── doc
│ ├── api
│ | └── index.md
│ └── usage
│ └── index.md
├── LICENSE.md
├── mkdocs.yml
├── pyproject.toml
├── README.md
├── src
│ └── {{project_slug}}
│ ├── __init__.py
│ ├── __main__.py {cli_support: yes}
│ └── py.typed
├── test
│ ├── conftest.py
│ └── __init__.py
└── tox.ini
Continuous Integration¶
Projects generated with this template repository are automatically configured to use GitHub CI workflows and GitLab CI pipelines.