Skip to content

Commit 6ff37bc

Browse files
authored
Merge pull request #41 from 56kyle/feature/updating-cookiecutter-documentation
Feature/updating cookiecutter documentation
2 parents 9028607 + 198e455 commit 6ff37bc

File tree

6 files changed

+98
-68
lines changed

6 files changed

+98
-68
lines changed

README.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# cookiecutter-robust-python
1+
# Cookiecutter Robust Python
22

33
A Python project template robust enough to follow up [cookiecutter-hypermodern-python]
44

@@ -8,47 +8,54 @@ A Python project template robust enough to follow up [cookiecutter-hypermodern-p
88

99
---
1010

11-
## Usage/Installation
11+
## Quick Start
1212

13-
The only prerequisite for using the template is to [install uv].
13+
### Prerequisites
14+
The only requirement is [uv].
1415

15-
From there just cd into the directory you want to create the project in and run:
16-
```terminaloutput
16+
### Create Your Project
17+
Navigate to where you want to create your project and run:
18+
19+
```bash
1720
uvx cruft create https://github.com/56kyle/cookiecutter-robust-python.git
1821
```
19-
Which will prompt you for a few inputs before generating the project.
20-
```terminaloutput
21-
> [1/15] project_name (robust-python): my-repo-name
22-
> ...
22+
23+
This will prompt you for a few inputs to customize your project:
24+
```
25+
[1/15] project_name (robust-python): my-awesome-project
26+
[2/15] package_name (my_awesome_project):
27+
[3/15] friendly_name (My Awesome Project):
28+
...
2329
```
2430

25-
#### Local Setup
31+
### Project Setup
32+
33+
After generating your project, set it up for development:
2634

27-
Once you have generated your project, and preferably before opening the IDE, the normal workflow to setup everything would go as follows:
28-
```terminaloutput
29-
cd my-repo-name
35+
```bash
36+
cd my-awesome-project
3037

31-
# Pins the uv python version, generates/syncs a venv, etc.
38+
# Set up virtual environment and install dependencies
3239
uvx nox -s setup-venv
3340

34-
# Sets up a git repo w/ a main/develop branch along with an initial commit of everything just generated.
41+
# Initialize git repository with main/develop branches
3542
uvx nox -s setup-git
3643

37-
# Sets up the remote reference and ensures main/develop are pushed/synced. Requires that the remote exists (should be empty).
38-
uvx nos -s setup-remote
44+
# Set up remote repository (requires empty remote repo to exist)
45+
uvx nox -s setup-remote
3946
```
4047

41-
You can also run `uvx nox -t env` for the same effect.
48+
**Quick setup:** Run `uvx nox -t env` to execute all environment setup tasks at once.
4249

4350

4451
## Most Notable Features
4552
- Modern tooling with [uv], [ruff], [cruft], etc.
4653
- Built for supporting most OS's (windows, linux, macos) and all currently supported [python] versions
4754
- Platform agnostic CI/CD ([github], [gitlab], [bitbucket])
4855
- CI/CD that parities local [nox] sessions for all [python]
49-
- [maturin] support that can be at any time during the project's lifecycle
56+
- [maturin] support that can be added at any time during the project's lifecycle
5057
- Designed to be a maintainable template over time through the use of automated demos and integration tests
51-
- ... and much more!
58+
- Rich documentation explaining tooling decisions and rationale
5259

5360
For a general overview of where we are at with this template, please see the [roadmap](#roadmap) section.
5461

@@ -127,7 +134,7 @@ to Python's ecosystem overall.
127134
That being said, it's generally good practice to avoid the complexity of this dual language system unless you actually need the performance bump for your use case. However knowing ahead of time if performance
128135
will be an issue is rather tricky, and a much easier route is to just prepare as though you _might_ swap to it some day.
129136

130-
The [Robust Python Cookiecutter] includes a `include_rust_extensions` flag that not only toggles [maturin] vs a traditional Python package,
137+
The [Robust Python Cookiecutter] includes an `add_rust_extension` flag that not only toggles [maturin] vs a traditional Python package,
131138
but that can be used in combination with [cruft] to swap to [maturin] at any time with just about no risk to CI/CD / etc.
132139

133140
Additionally, the [Robust Python Cookiecutter] is designed with both normal and [monorepos] in mind. So whether you need to just add
@@ -171,18 +178,25 @@ However, Open Source work is draining, and is especially so for a project templa
171178
I can guarantee that if the [Robust Python Cookiecutter] ever sees any number of users, I will immediately transfer it to an organization to enable at least a handful
172179
of trusted individuals to ensure the project is taken care of.
173180

181+
[bitbucket]: https://bitbucket.org
174182
[bitbucket-pipelines]: https://support.atlassian.com/bitbucket-cloud/docs/write-a-pipe-for-bitbucket-pipelines/
175183
[cookiecutter]: https://cookiecutter.readthedocs.io/en/stable/
176184
[cookiecutter-hypermodern-python]: https://github.com/cjolowicz/cookiecutter-hypermodern-python
177185
[cookiecutter-robust-python]: https://github.com/56kyle/cookiecutter-robust-python
178186
[cruft]: https://cruft.github.io/cruft/
187+
[github]: https://github.com
179188
[github-actions]: https://docs.github.com/en/actions
189+
[gitlab]: https://gitlab.com
180190
[hypermodern python cookiecutter]: https://github.com/cjolowicz/cookiecutter-hypermodern-python
181191
[just]: https://github.com/casey/just?tab=readme-ov-fil
182192
[maturin]: https://github.com/PyO3/maturin
193+
[monorepos]: https://en.wikipedia.org/wiki/Monorepo
194+
[my personal fork]: https://github.com/56kyle/cookiecutter-hypermodern-python
195+
[nox]: https://nox.thea.codes/
183196
[noxfile]: https://github.com/56kyle/cookiecutter-robust-python/blob/main/%7B%7Bcookiecutter.project_name%7D%7D/noxfile.py
184197
[poetry]: https://python-poetry.org/docs/
185198
[polars]: https://github.com/pola-rs/polars
199+
[python]: https://www.python.org/
186200
[robust python cookiecutter]: https://github.com/56kyle/cookiecutter-robust-python
187201
[ruff]: https://docs.astral.sh/ruff/
188202
[rust]: https://www.rust-lang.org/learn

docs/getting-started-template-contributing.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,29 @@ To contribute to the template, you will need:
1010
2. **Python 3.9+**: We recommend using a supported Python version.
1111
3. **uv**: Our chosen dependency manager (see [Dependency Management (02)](topics/02_dependency-management.md)). Install `uv` globally or in a base environment following the official {uv-install}`uv installation guide<>`.
1212
4. **Docker or Podman**: Required for testing the containerization aspects of the generated template (see [Container Build (11)](topics/11_container-build.md), [Dev Containers (17)](topics/17_dev-containers.md)).
13-
5. **Task Automation Tools**: The template itself uses a `noxfile.py` to manage its own development and documentation build workflows. Install `nox`:
14-
```bash
15-
uv add nox # Ensure you have uv first
16-
```
13+
5. **Task Automation Tools**: The template uses `noxfile.py` for development workflows. We use `uvx` to run `nox` so that it automatically installs if needed.
1714

1815
## Setting up Your Development Environment
1916

2017
1. **Clone the Template Repository:**
2118

2219
```bash
23-
git clone https://github.com/56kyle/cookiecutter-robust-python.git # **UPDATE WITH TEMPLATE REPO URL**
20+
git clone https://github.com/56kyle/cookiecutter-robust-python.git
2421
cd cookiecutter-robust-python
2522
```
2623

2724
2. **Install Template Development Dependencies:**
28-
The template needs dependencies to run its tests, build its documentation, and check its own code.
25+
Install all dependency groups needed for template development:
2926

3027
```bash
31-
uv sync # This installs deps from the template's pyproject.toml into a .venv
28+
uv sync --all-groups
3229
```
3330

3431
3. **Install Pre-commit Hooks for the Template:**
35-
To ensure your contributions meet the template's own code quality standards, install the pre-commit hooks for _this template repository_:
32+
Set up pre-commit hooks to maintain code quality:
3633

3734
```bash
38-
uvx nox -s pre-commit -- install # Installs hooks based on the template's .pre-commit-config.yaml
35+
uvx nox -s pre-commit -- install
3936
```
4037

4138
4. **Set up Dev Container (Optional):**
@@ -52,10 +49,10 @@ The template's own `noxfile.py` defines tasks for maintaining the template itsel
5249
```
5350
5451
2. **Run Core Template Checks:**
55-
This includes linting the template's own Python files (like `noxfile.py`), checking formatting, etc.
52+
Lint and format the template's own Python files:
5653

5754
```bash
58-
uvx nox -s check # Runs the template's internal checks
55+
uvx nox -s lint
5956
```
6057

6158
3. **Build Template Documentation:**
@@ -66,26 +63,27 @@ The template's own `noxfile.py` defines tasks for maintaining the template itsel
6663
```
6764

6865
4. **Run Template Tests:**
69-
(Assuming the template itself has tests, e.g., testing cookiecutter rendering or noxfile sessions).
66+
Test the template's generation functionality:
7067
7168
```bash
72-
uvx nox -s test # Runs tests for the template itself
69+
uvx nox -s test
7370
```
7471
75-
5. **Run All Checks and Tests:**
72+
5. **Generate Demo Project:**
73+
Create a demo project to test template functionality:
74+
7675
```bash
77-
uvx nox # Runs the default sessions defined in noxfile.py (often check and test)
76+
uvx nox -s generate-demo
7877
```
7978
8079
## Updating Template Version and Releasing
8180
8281
This template uses Calendar Versioning (YYYY.MM.DD) for its own releases.
8382
8483
1. **Ensure Your Branch is Up-to-date:** Pull the latest changes from the main branch.
85-
2. **Run Commitizen Bump for the Template:** (Assuming Commitizen is used for template versioning). Use `uvx` to run Commitizen against the template:
84+
2. **Release the Template:**
8685
```bash
87-
uvx cz bump --changelog # Follow prompts, generates tag/changelog entry
88-
# Alternatively, specify increment e.g., uvx cz bump --changelog --increment major_version_zero
86+
uvx nox -s release-template # Uses Commitizen to bump version and create tags
8987
```
9088
This will update the version string(s) (e.g., in `__version__.py` or `conf.py`), create a Git tag, and potentially update the changelog.
9189
3. **Push Changes and Tags:** Push the commits and the newly created tag to the template repository:

docs/our-chosen-toolchain.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ The true power of this template lies in how these chosen tools work together coh
117117
1. **Configuration:** Defined primarily in `pyproject.toml` and separate tool config files ([01](topics/01_project-structure.md)).
118118
2. **Dependency/Environment Management:** Handled efficiently by {uv}`uv<>`, creating standard virtual environments and managing packages based on `pyproject.toml` and `uv.lock` ([02](topics/02_dependency-management.md)).
119119
3. **Task Automation:** Orchestrated by {nox}`Nox<>`, calling commands from other tools via `uv run` (or `uvx`), providing the single interface for developers and CI/CD to run workflows ([12](topics/12_task-automation.md)).
120-
4. **Code Quality & Testing:** Ensured by {ruff}`Ruff<>` (formatting/linting), {pyright}`Pyright<>` (typing), {pip-audit}`pip-audit<>` (dep security), and {bandit-bandit}`Bandit<>` (code security), along with {pytest-pytest-cov}`pytest<>`/{coveragepy-coverage}`coverage.py<>` for testing. These tools are installed via {uv}`uv<>` and executed via Task Automation ([03](topics/03_code-formatting.md)-[08](topics/08_security-checks.md), orchestrated by [12](topics/12_task-automation.md)).
120+
4. **Code Quality & Testing:** Ensured by {ruff}`Ruff<>` (formatting/linting), {pyright}`Pyright<>` (typing), {pip-audit}`pip-audit<>` (dep security), and {bandit-bandit}`Bandit<>` (code security), along with {pytest-pytest-cov}`pytest<>`/{coveragepy}`coverage.py<>` for testing. These tools are installed via {uv}`uv<>` and executed via Task Automation ([03](topics/03_code-formatting.md)-[08](topics/08_security-checks.md), orchestrated by [12](topics/12_task-automation.md)).
121121
5. **Packaging & Distribution:** Artifacts created via {uv}`uv<>` build using selected backends, and published via {uv}`uv<>` publish, orchestrated by Task Automation ([09](topics/09_packaging-build.md)-[10](topics/10_packaging-publish.md)).
122122
6. **Containerization:** Defined by `Dockerfile`, built by {docker}`Docker<>`/{podman}`Podman<>` (often via `uv` installing deps inside), orchestrated by Task Automation. Local multi-container setups managed by {docker}`Docker Compose<>` ([11](topics/11_container-build.md), [15](topics/15_compose-local.md)).
123123
7. **Automated Workflows:** Triggered by CI/CD platforms (configured to call Task Automation commands), handling matrices, secrets, and reporting ([13](topics/13_ci-orchestration.md)-[14](topics/14_cd-orchestration.md)).

docs/philosophy.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ These principles form the basis for the evaluation criteria and justifications d
4040

4141
## Solved Issues
4242

43-
The [Robust Python Cookiecutter] also exists to solve a few key issues that were omnipresent in [cookiecutter-hypermodern-python].
43+
The Robust Python Cookiecutter addresses several key challenges that existed in the original cookiecutter-hypermodern-python:
4444

45-
###
45+
### Template Update Propagation
46+
One major issue with traditional cookiecutter workflows is the difficulty of propagating template updates to existing projects. The Robust Python Cookiecutter includes built-in support for Cruft, enabling projects to receive template updates through manageable pull requests rather than manual recreation.
47+
48+
### Project Domain Expansion
49+
While pure Python projects are common, many modern Python packages benefit from optional Rust extensions for performance-critical components. The template includes configurable Rust support via Maturin, allowing projects to start as pure Python and add Rust components when needed without architectural disruption.
50+
51+
### Documentation of Decisions
52+
Rather than just providing tooling, this template documents the reasoning behind each tool choice. This enables maintainers to evaluate whether decisions remain valid as the ecosystem evolves, supporting long-term template maintenance.
53+
54+
### CI/CD Vendor Independence
55+
The template is designed to work across GitHub Actions, GitLab CI, and Bitbucket Pipelines by centralizing logic in Nox sessions rather than platform-specific workflow syntax. This ensures consistency and portability.
56+
57+
### Long-term Maintenance Strategy
58+
The template includes comprehensive testing infrastructure with automated demo projects and integration tests, helping ensure changes don't break the generation process and providing confidence in template evolution.

docs/quickstart.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Quickstart
22

3-
This guide provides the absolute minimum steps to get up and running with a project generated by `cookiecutter-robust-python`. It's for developers who want to start coding and use the core workflows right away.
3+
This guide covers the essential steps to get up and running with a project generated by `cookiecutter-robust-python`. Perfect for developers who want to start coding with the core workflows immediately.
44

5-
For detailed explanations of the tools and the philosophy, see the full documentation.
5+
For detailed tool explanations and project philosophy, see the full documentation.
66

77
---
88

@@ -23,10 +23,10 @@ Navigate to the directory you want to create your new project in.
2323
cd ~/path/to/my/repos
2424
```
2525

26-
Generate your project from the template using the given command:
26+
Generate your project from the template:
2727

2828
```bash
29-
uvx cookiecutter gh:56kyle/cookiecutter-robust-python
29+
uvx cruft create https://github.com/56kyle/cookiecutter-robust-python.git
3030
```
3131

3232
Follow the prompts to customize your project.
@@ -39,13 +39,13 @@ Navigate to your new project directory:
3939
cd your-project-slug
4040
```
4141

42-
Install dependencies and create the virtual environment using `uv sync`:
42+
Set up the virtual environment and install dependencies:
4343

4444
```bash
45-
uv sync
45+
uvx nox -s setup-venv
4646
```
4747

48-
This command reads `pyproject.toml`, resolves dependencies from `uv.lock`, installs them into a standard virtual environment (`.venv` by default), and prepares the project.
48+
This sets up a virtual environment with uv and installs all development dependencies.
4949

5050
## 4. Install Pre-commit Hooks
5151

@@ -59,25 +59,27 @@ Now, `git commit` will automatically run code formatting and basic linting check
5959

6060
## 5. Run Checks and Tests
6161

62-
Execute the template's core quality checks and tests using `nox` from the project root:
62+
Run quality checks and tests using the nox sessions:
6363

6464
```bash
65-
uvx nox -s check # Runs linters, type checker, security checks
66-
uvx nox -s test # Runs tests and coverage
67-
uvx nox # Runs default tasks (often check and test)
65+
uvx nox -s lint-python # Run Ruff linting
66+
uvx nox -s typecheck # Run Pyright type checking
67+
uvx nox -s security-python # Run Bandit and pip-audit
68+
uvx nox -s tests-python # Run pytest with coverage
6869
```
6970

70-
These commands use the Task Automation layer defined in `noxfile.py` and ensure checks run correctly in isolated environments using your specified Python version.
71+
These commands run in isolated environments with the proper Python versions as defined in `noxfile.py`.
7172

7273
## 6. Build Documentation
7374

74-
If you need to view the project's generated documentation locally:
75+
Build and serve the project documentation locally:
7576

7677
```bash
77-
uvx nox -s docs
78+
uvx nox -s docs # Build and serve with live reload
79+
uvx nox -s build-docs # Build only (static files)
7880
```
7981

80-
This builds the project documentation website into the `docs/_build/html` directory.
82+
The `docs` session builds and serves documentation with automatic reload on changes.
8183

8284
## Next Steps
8385

0 commit comments

Comments
 (0)