Copier is a library and CLI app for rendering project templates.
Important
If you haven't already, install pipx
first: pip install --user pipx
.
pipx install copier
pipx inject copier copier-templates-extensions
Hatch is a modern, PEP 621 compliant, extensible Python project manager.
pipx install hatch
Store virtual environments in a directory named .hatch
in each project directory.
hatch config set dirs.env.virtual .hatch
Note
This adds the following to the configuration:
[dirs.env]
virtual = ".hatch"
The Configuration for Hatch is stored in a config.toml
file at i.e. ~/Library/Application Support/hatch
on macOS.
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
cd PATH/TO/DESTINATION && hatch env create
Note
You can locate environments by running hatch env find
.
git init && hatch run dev: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
See the documentation for more details.