This repository is a reusable Copier project archetype for bootstrapping EOAP-style Python packages.
It is intended to be deployed as a dedicated GitHub repository, for example:
EOAP/python-project-template
Generated projects include:
- a Hatch-based
pyproject.toml; - an Apache-2.0
LICENSEandNOTICE; - Apache-2.0 source headers using each file type's native comment syntax;
- a top-level
CHANGELOG.mdfollowing Keep a Changelog conventions; - Diátaxis documentation under
docs/; - a top-level
mkdocs.yamlwired directly to the generated documentation; - a
Taskfile.yamlconfigured forEOAP/taskfile-utilsremote Taskfiles; - a
.env.exampleenabling remote Taskfiles withTASK_X_REMOTE_TASKFILES=1; - GitHub Actions for quality checks, tests, package build, and documentation build;
- a
src/package layout and initial tests.
.
├── README.md
├── copier.yaml
├── LICENSE
├── NOTICE
├── CHANGELOG.md
└── template/
├── README.md.jinja
├── pyproject.toml.jinja
├── mkdocs.yaml.jinja
├── Taskfile.yaml.jinja
├── CHANGELOG.md.jinja
├── LICENSE.jinja
├── NOTICE.jinja
├── docs/
├── src/
├── tests/
└── .github/
The root of this repository documents and configures the archetype. The template/ directory contains the files rendered into each generated Python project.
Install the tools used by the generated projects:
python -m pip install --user pipx
pipx ensurepath
pipx install copier
pipx install hatchInstall Task if you want to use the generated Taskfile.yaml locally. Follow your platform's preferred installation method for Task.
Create an empty GitHub repository, for example:
https://github.com/EOAP/python-project-template
Then push this archetype into it:
git init
git add .
git commit -m "Initial Python project template"
git branch -M main
git remote add origin git@github.com:EOAP/python-project-template.git
git push -u origin mainUse tags so projects can be generated from a stable, repeatable archetype version:
git tag v0.1.0
git push origin v0.1.0Prefer generating projects from a tag rather than directly from main.
From another directory, run:
copier copy --vcs-ref v0.1.0 https://github.com/eoap/python-project-template.git stripodi-testCopier will ask for project metadata such as project name, package name, author, repository URL, and documentation URL.
You can also generate from a local checkout while developing the archetype:
copier copy /path/to/python-project-template my-new-projectMove into the generated repository:
cd my-new-projectCopy the environment example file:
cp .env.example .envThe .env file is required because the generated Taskfile.yaml uses remote Taskfiles from EOAP/taskfile-utils, and remote Taskfiles require:
TASK_X_REMOTE_TASKFILES=1Create the Hatch environment:
hatch env createRun the quality workflow:
task qualityRun the test suite directly with Hatch:
hatch run testBuild the package:
hatch buildBuild the documentation:
hatch run docs:buildServe the documentation locally:
hatch run docs:serveAfter generation, update at least these files:
README.md
CHANGELOG.md
docs/tutorials/first-steps.md
docs/how-to/install.md
docs/how-to/use-cli.md
docs/reference/api.md
docs/explanation/architecture.md
src/<python_package>/cli.py
tests/test_version.py
Keep the documentation organized according to Diátaxis:
- tutorials teach by walking users through a learning path;
- how-to guides solve specific tasks;
- reference pages describe APIs and technical facts;
- explanation pages clarify concepts, design choices, and background.
Copier can update a generated project from a newer template version when the generated project keeps its .copier-answers.yml file:
copier updateFor controlled updates, first tag a new archetype release:
git tag v0.2.0
git push origin v0.2.0Then update the generated project using Copier's update workflow.
The main variables are defined in copier.yaml:
| Variable | Purpose |
|---|---|
project_name |
Human-readable project name. |
project_slug |
Repository/distribution name, usually kebab-case. |
python_package |
Importable Python package name, usually snake_case. |
project_description |
One-line package description. |
author_name |
Author or organization name. |
author_email |
Author contact email. |
repository_url |
Source repository URL. |
documentation_url |
Published documentation URL. |
copyright_year |
Year used in generated source headers. |
python_version |
Minimum supported Python version. |
license_id |
SPDX license identifier; default is Apache-2.0. |
When editing the archetype:
- Modify files under
template/. - Generate a disposable project locally with
copier copy . /tmp/example-project. - Run
hatch env create,task quality,hatch build, andhatch run docs:buildinside the generated project. - Commit the archetype changes.
- Tag a new release when the archetype is ready for consumers.
This archetype is licensed under the Apache License, Version 2.0. Generated projects also use Apache-2.0 by default.