Skip to content
Project Logo

Copier Python Hatch Template

A Copier template for Python projects managed by Hatch.

License CI Status CodeQL Status GH-Pages Deploy Status

Python Version Copier Hatch Material for MkDocs Pytest Markdownlint Commitlint Ruff Bandit Mypy

Quickstart#

Generate a Project#

copier copy --trust https://github.com/sidisinsane/copier-python-hatch-template.git PATH/TO/DESTINATION

or

copier copy --trust gh:sidisinsane/copier-python-hatch-template PATH/TO/DESTINATION

This will generate a new project with the following structure:

YOUR-PROJECT-NAME
├── .github
│   └── workflows
│       ├── ci.yml
│       ├── codeql.yml
│       ├── gh-pages-deploy.yml
│       └── test.yml
├── .vscode
│   ├── extensions.json
│   └── settings.json
├── mkdocs
│   ├── images
│   │   ├── favicon.svg
│   │   └── logo.svg
│   ├── javascripts
│   │   └── mathjax.js
│   ├── index.md
│   └── license.md
├── src
│   └── YOUR_PROJECT_NAME
│       ├── __about__.py
│       ├── __init__.py
│       └── calc.py
├── tests
│   ├── __init__.py
│   └── test_calc.py
├── .coveragerc
├── .gitignore
├── .markdownlint.yml
├── .pre-commit-config.yaml
├── .pylintrc
├── bandit.yml
├── commitlint.config.js
├── LICENSE
├── mkdocs.yml
├── mypy.ini
├── pyproject.toml
├── pytest.ini
└── README.md
Note

You can also clone the project template using git clone https://github.com/sidisinsane/copier-python-hatch-template.git, modify it and generate a project the locally cloned repo.

copier copy --trust PATH/TO/CLONED/PROJECT/TEMPLATE PATH/TO/DESTINATION

Aftermath#

Create Virtual Environment#

cd PATH/TO/DESTINATION && hatch env create
Note

You can locate environments by running hatch env find.

Install Pre-Commit Hooks#

git init && hatch run pre-commit install
Note

After you have created a new empty GitHub project, you are ready to make your initial commit.

git add .
git commit -m "initial commit"
git branch -M main
git remote add origin https://github.com/REPO_NAMESPACE/REPO_NAME.git
git push -u origin main