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 gh: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:
project_prettier
:- Prettier: Opinionated code formatter for JSON, Markdown, and YAML files.
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 {project_repository: contains 'github.com'}
│ └── workflows
│ └── main.yaml
├── .dockerignore
├── .gitignore
├── .gitlab-ci.yaml {project_repository: contains 'gitlab.com'}
├── .prettierignore {project_prettier: true}
├── .prettierrc.yaml {project_prettier: true}
├── CONTRIBUTING.md
├── doc
│ └── index.md
├── mkdocs.yml
├── pyproject.toml
├── README.md
├── src
│ └── {{project_package}}
│ ├── __init__.py
│ ├── __main__.py {project_cli: true}
│ └── 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.