Skip to content

Commit b07c4f3

Browse files
committed
📝 docs: rewrite the template README and changed the contributor docs to include more info
1 parent 990450c commit b07c4f3

8 files changed

Lines changed: 370 additions & 35 deletions

File tree

template/README.md.jinja

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,35 @@
2222
{%- if with_conventional_commits %}
2323
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
2424
{%- endif %}
25-
{%- if repository_provider == 'github' %}
25+
{%- if documentation %}
2626
[![documentation](https://img.shields.io/badge/docs-mkdocs%20material-blue.svg?style=flat)]({{ documentation }})
2727
{%- endif %}
2828

2929
</div>
3030

31+
## Features
32+
33+
- **Packaging:** `uv` for fast dependency management
34+
- **Task Runner:** `mise` for consistent cross-platform tasks
35+
- **Quality:** Ruff (lint + format), Mypy (type-checking), pre-commit hooks
36+
- **Testing:** pytest{%- if tox %}, Tox (multi-version){%- endif %}{%- if pytest_xdist %}, parallel test execution{%- endif %}
37+
- **Documentation:** MkDocs with Material theme, auto-generated API docs
38+
{%- if with_typer_cli %}
39+
- **CLI:** Typer-based command-line interface (`{{ cli_name }}`)
40+
{%- endif %}
41+
{%- if dockerfile %}
42+
- **Docker:** Production and development containers
43+
{%- endif %}
44+
{%- if with_conventional_commits %}
45+
- **Versioning:** Conventional Commits with automated changelog
46+
{%- endif %}
47+
{%- if publish_to_pypi %}
48+
- **Publishing:** Automated PyPI publishing via CI/CD
49+
{%- endif %}
50+
3151
## Installation
3252

33-
{% if publish_to_pypi -%}
34-
You can install this package in several ways:
53+
{%- if publish_to_pypi %}
3554

3655
### From PyPI
3756

@@ -46,14 +65,20 @@ You can install this package in several ways:
4665
```bash
4766
uv add {{ project_name }}
4867
```
49-
{%- endif %}
5068

51-
{% if repository_provider == 'github' -%}
52-
{% if publish_to_pypi -%}
5369
### From Source
54-
{% else -%}
55-
You can install this package in several ways:
56-
{% endif %}
70+
71+
{%- elif repository_provider == 'github' %}
72+
73+
### From Source
74+
75+
{%- else %}
76+
77+
To install the package, simply run:
78+
79+
{%- endif %}
80+
81+
{%- if repository_provider == 'github' %}
5782

5883
- Directly from GitHub:
5984

@@ -65,55 +90,68 @@ You can install this package in several ways:
6590

6691
```bash
6792
git clone {{ repository }}
68-
cd my-package
93+
cd {{ project_name }}
6994
```
7095

7196
Then, install the dependencies using Make:
7297

73-
{% elif publish_to_pypi -%}
74-
### From Source
75-
{% else -%}
76-
To install the package, simply run:
77-
{% endif %}
98+
{%- endif %}
7899

79-
- For production dependencies:
100+
- For development setup (includes dev dependencies and Git hooks):
80101

81102
```bash
82-
make setup
103+
make setup-dev
83104
```
84105

85-
- For development setup (includes dev dependencies and Git hooks):
106+
- For production dependencies only:
86107

87108
```bash
88-
make setup-dev
109+
make setup-prod
89110
```
90111

91112
> [!note]
92113
> This project requires both [`mise`](https://mise.jdx.dev/) and [`uv`](https://docs.astral.sh/uv/) to be installed.
93114
> `make` tasks proxy through `mise run`, which in turn invokes `uv` and other tools.
94115

95-
{% if with_typer_cli -%}
116+
{%- if with_typer_cli %}
117+
96118
> [!tip]
97119
> To make the CLI available globally (without needing to activate the virtual environment every time), you can run:
98120
> ```bash
99121
> make setup-cli
100122
> ```
101123
{%- endif %}
102124

103-
> [!tip]
104-
> This quick guide should get you started, but for a complete overview of the project's features and usage, check out the original [python-template-uv](https://github.com/bassemkaroui/python-template-uv) template used to generate this repository.
105-
106-
{% if not documentation -%}
107125
## Documentation
108126

109-
You can generate the project documentation locally by running:
127+
{%- if documentation %}
128+
129+
Full documentation is available at [{{ documentation }}]({{ documentation }}).
130+
{%- else %}
131+
132+
Generate the docs locally:
110133

111134
```bash
112135
make docs-serve
113136
```
114137

115-
This will build the documentation using MkDocs.
116-
Once generated, simply open the provided URL in your browser to explore it.
138+
This will build the documentation using MkDocs. Open the provided URL in your browser.
139+
{%- endif %}
140+
141+
## Contributing
142+
143+
{%- if documentation %}
144+
145+
Contributions are welcome! Please read the [development setup]({{ documentation }}/development/setup/) and [contributing guidelines]({{ documentation }}/development/contributing/) before submitting a PR.
146+
{%- else %}
147+
148+
Contributions are welcome! Please read the [development setup](docs/development/setup.md) and [contributing guidelines](CONTRIBUTING.md) before submitting a PR.
149+
{%- endif %}
150+
151+
{%- if repository_provider == 'github' %}
152+
153+
> [!note]
154+
> This project was scaffolded with [python-template-uv](https://github.com/bassemkaroui/python-template-uv).
117155
{%- endif %}
118156

119157
{% if copyright_license != "No License" -%}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{%- if repository_provider == 'github' %}
2+
# CI/CD Pipeline
3+
4+
## Overview
5+
6+
CI/CD runs on [GitHub Actions](https://docs.github.com/en/actions) with the workflow defined at `.github/workflows/main.yaml`. A custom composite action at `.github/actions/setup-env/` handles uv, mise, and Python setup across all jobs.
7+
8+
Concurrency is managed per workflow + ref — pushing a new commit cancels any in-progress run for the same branch.
9+
10+
## Triggers
11+
12+
| Event | Jobs |
13+
|-------|------|
14+
| Push to `main` | checks, tests |
15+
| Push tag | checks, tests, release, deploy-docs{% if publish_to_pypi %}, publish-package{% endif %} |
16+
| Pull request | checks, tests |
17+
| `workflow_dispatch` | checks, tests, deploy-docs{% if publish_to_pypi %}, publish-package{% endif %} |
18+
19+
## Jobs
20+
21+
### checks
22+
23+
Runs on `ubuntu-latest` with a 15-minute timeout.
24+
25+
1. Lint with Ruff (`make check-quality`)
26+
2. Type-check with Mypy (`make check-types`)
27+
3. Build docs in strict mode (`make docs-check`)
28+
29+
### tests
30+
31+
Runs a matrix across Python {{ min_python_version }}–3.13 on `ubuntu-latest` (15-minute timeout, `fail-fast: false`).
32+
33+
- Executes `make test` for each Python version
34+
- Uploads coverage reports (HTML + XML) for the primary version ({{ python_version }})
35+
36+
### release
37+
38+
**Tag pushes only.** Depends on `checks` + `tests`.
39+
40+
1. Generates changelog with [commitizen](https://commitizen-tools.github.io/commitizen/)
41+
2. Detects prereleases (tags containing `a`, `b`, or `rc`)
42+
3. Creates a GitHub Release with the generated notes
43+
44+
### deploy-docs
45+
46+
**Tag pushes + `workflow_dispatch`.** Depends on `checks` + `tests`.
47+
48+
Builds MkDocs and deploys to GitHub Pages via [`peaceiris/actions-gh-pages`](https://github.com/peaceiris/actions-gh-pages).
49+
{%- if publish_to_pypi %}
50+
51+
### publish-package
52+
53+
**Tag pushes + `workflow_dispatch`.** Depends on `checks` + `tests`.
54+
55+
Builds with `uv build` and publishes with `uv publish`. Skips gracefully if the `PYPI_TOKEN` secret is not set.
56+
{%- endif %}
57+
58+
## Required Secrets
59+
60+
| Secret | Used by | Notes |
61+
|--------|---------|-------|
62+
| `GITHUB_TOKEN` | deploy-docs | Auto-provided by GitHub |
63+
{%- if publish_to_pypi %}
64+
| `PYPI_TOKEN` | publish-package | Optional — job skips if unset |
65+
{%- endif %}
66+
{%- if dependency_updater == 'renovate' and renovate_auth_method == 'github_app' %}
67+
| `RENOVATE_APP_ID` | renovate | GitHub App ID for Renovate |
68+
| `RENOVATE_APP_PRIVATE_KEY` | renovate | GitHub App private key |
69+
{%- elif dependency_updater == 'renovate' %}
70+
| `RENOVATE_TOKEN` | renovate | Personal access token for Renovate |
71+
{%- endif %}
72+
73+
## The Setup Action
74+
75+
`.github/actions/setup-env/action.yaml` is a composite action used by every job. It:
76+
77+
1. Installs [uv](https://docs.astral.sh/uv/) with caching enabled
78+
2. Installs [mise](https://mise.jdx.dev/)
79+
3. Sets up the requested Python version (accepts `python-version` or `python-version-file`)
80+
{% if dependency_updater == 'renovate' %}
81+
82+
## Dependency Updates (Renovate)
83+
84+
[Renovate](https://docs.renovatebot.com/) is configured via `renovate.json5` and runs as a GitHub Actions workflow (`.github/workflows/renovate.yaml`). It runs on weekdays at 20:00 UTC and weekends at 09:00 UTC.
85+
86+
A Dependency Dashboard issue is created in the repository for visibility and manual control.
87+
{%- elif dependency_updater == 'dependabot' %}
88+
89+
## Dependency Updates (Dependabot)
90+
91+
[Dependabot](https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically) is configured via `.github/dependabot.yml`. It checks for GitHub Actions updates on a weekly schedule.
92+
{%- endif %}
93+
94+
## Other Workflows
95+
96+
- **`pr-thank-you.yaml`** — Posts a Giphy reaction comment on newly opened pull requests.
97+
{%- if with_conventional_commits %}
98+
99+
## Release Flow
100+
101+
1. Make commits following the [Conventional Commits](https://www.conventionalcommits.org/) format
102+
2. Run `make release` locally — this bumps the version via commitizen, pushes commits and tags
103+
3. The tag push triggers CI: **checks** → **tests** → **release** + **deploy-docs**{% if publish_to_pypi %} + **publish-package**{% endif %}
104+
4. Preview first with `make release -- --dry-run`
105+
{%- endif %}
106+
{%- endif %}

template/docs/development/contributing.md.jinja

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Run all checks:
2121

2222
/// tab | make
2323
```bash
24-
make check
24+
make check-all
2525
```
2626
///
2727

2828
/// tab | mise
2929
```bash
30-
mise run check
30+
mise run check:all
3131
```
3232
///
3333

@@ -98,11 +98,14 @@ make docs-serve
9898

9999
/// tab | mise
100100
```bash
101-
mise run docs-serve
101+
mise run docs:serve
102102
```
103103
///
104104

105105
API documentation is auto-generated from docstrings using [mkdocstrings](https://mkdocstrings.github.io/).
106+
{%- if repository_provider == 'github' %}
107+
For deployment details, see the [CI/CD Pipeline](ci-cd.md) page.
108+
{%- endif %}
106109
{% if copyright_license != "No License" %}
107110
## License
108111

template/docs/development/setup.md.jinja

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ make setup-dev
3030

3131
/// tab | mise
3232
```bash
33-
mise run setup-dev
33+
mise run setup:dev
3434
```
3535
///
3636

@@ -39,10 +39,12 @@ mise run setup-dev
3939
| Task | make | mise |
4040
|------|------|------|
4141
| Run tests | `make test` | `mise run test` |
42-
| Run linting & type checks | `make check` | `mise run check` |
42+
| Run linting & type checks | `make check-all` | `mise run check:all` |
4343
| Format code | `make format` | `mise run format` |
44-
| Serve docs locally | `make docs-serve` | `mise run docs-serve` |
44+
| Serve docs locally | `make docs-serve` | `mise run docs:serve` |
4545
| Build the package | `make build` | `mise run build` |
46+
47+
> For the full list of available tasks, see the [Task Runner](task-runner.md) guide.
4648
{% if dockerfile %}
4749
## Docker
4850

0 commit comments

Comments
 (0)