Skip to content

Commit e310d8f

Browse files
committed
fix: adjust cookiecutter variable names throughout so that the template can generate correctly
1 parent c0532ae commit e310d8f

File tree

9 files changed

+25
-36
lines changed

9 files changed

+25
-36
lines changed

cookiecutter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"friendly_name": "{{ cookiecutter.project_name.replace('-', ' ').title() }}",
55
"min_python_version": "3.9",
66
"max_python_version": "3.13",
7+
"add_rust_extension": false,
78
"author": "Kyle Oliver",
89
"email": "56kyleoliver+cookiecutter-robust-python@gmail.com",
910
"github_user": "56kyle",

noxfile.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
nox.options.default_venv_backend = "uv"
1515

16-
DEFAULT_TEMPLATE_PYTHON_VERSION = "3.12"
16+
DEFAULT_TEMPLATE_PYTHON_VERSION = "3.13"
1717

1818
REPO_ROOT: Path = Path(__file__).parent.resolve()
1919
TEMPLATE_FOLDER: Path = REPO_ROOT / "{{cookiecutter.project_name}}"
@@ -125,19 +125,7 @@ def test(session: Session) -> None:
125125
# Run cookiecutter to generate a project
126126
# Need to find cookiecutter executable - it's in the template dev env installed by uv sync.
127127
cookiecutter_command: list[str] = ["uv", "run", "cookiecutter", "--no-input", "--output-dir", str(temp_dir), "."]
128-
# Add cookiecutter variables to customize the generated project for testing, using --extra-context
129-
cookiecutter_command.extend([
130-
"--extra-context",
131-
"project_name='Test Project'",
132-
"project_slug='test_project'",
133-
"package_name='test_package'",
134-
"author_name='Test Author'",
135-
"author_email='test@example.com'",
136-
"license='MIT'",
137-
"python_version='3.13'", # Use a fixed version for test stability
138-
"add_rust_extension='n'", # Test without Rust initially, add another test session for Rust
139-
# Add other variables needed by cookiecutter.json here to ensure no prompts
140-
])
128+
141129

142130
session.run(*cookiecutter_command, external=True)
143131

{{cookiecutter.project_name}}/.cz.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ commit_msg_file = ".git/COMMIT_EDITMSG"
1616
release = true
1717
release_asset_path = "dist/*"
1818
release_asset_descriptions = { "*.tar.gz": "Source distribution", "*.whl": "Python Wheel" }
19-
base_url = "https://github.com/{{ cookiecutter.github_username | lower | replace(' ', '-') }}/{{ cookiecutter.project_slug.replace('_', '-') }}"
19+
base_url = "https://github.com/{{ cookiecutter.github_user | lower | replace(' ', '-') }}/{{ cookiecutter.project_name.replace('_', '-') }}"

{{cookiecutter.project_name}}/.github/workflows/bump-version.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ jobs:
1414
- name: Check out
1515
uses: actions/checkout@v3
1616
with:
17-
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
17+
token: {{ "${{ secrets.PERSONAL_ACCESS_TOKEN }}" }}
1818
fetch-depth: 0
1919
- name: Create bump and changelog
2020
uses: commitizen-tools/commitizen-action@master
2121
with:
22-
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
22+
github_token: {{ "${{ secrets.PERSONAL_ACCESS_TOKEN }}" }}
2323
changelog_increment_filename: body.md
2424
- name: Release
2525
uses: softprops/action-gh-release@v1
2626
with:
2727
body_path: "body.md"
28-
tag_name: ${{ env.REVISION }}
28+
tag_name: {{ "${{ env.REVISION }}" }}
2929
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
GITHUB_TOKEN: {{ "${{ secrets.GITHUB_TOKEN }}" }}

{{cookiecutter.project_name}}/.github/workflows/release-python.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
env:
6262
# TestPyPI credentials stored as secrets in GitHub Settings -> Secrets
6363
TWINE_USERNAME: __token__ # Standard username when using API tokens
64-
TWINE_PASSWORD: {% raw %}[{% raw %} ${{ secrets.TESTPYPI_API_TOKEN }} {% raw %}]{% endraw %} # Use GitHub Encrypted Secret
64+
TWINE_PASSWORD: {% raw %}[{% raw %} {{ "${{ secrets.TESTPYPI_API_TOKEN }}" }} {% raw %}]{% endraw %} # Use GitHub Encrypted Secret
6565
# Optional: If uv publish requires different config for repository URL, pass TWINE_REPOSITORY or similar
6666
run: uvx nox -s publish-package -- --repository testpypi # Call the publish-package session, passing repository arg
6767

@@ -116,7 +116,7 @@ jobs:
116116
env:
117117
# Production PyPI credentials stored as secrets in GitHub Settings -> Secrets
118118
TWINE_USERNAME: __token__
119-
TWINE_PASSWORD: {% raw %}[{% raw %} ${{ secrets.PYPI_API_TOKEN }} {% raw %}]{% endraw %} # Use GitHub Encrypted Secret
119+
TWINE_PASSWORD: {% raw %}[{% raw %} {{ "${{ secrets.PYPI_API_TOKEN }}" }} {% raw %}]{% endraw %} # Use GitHub Encrypted Secret
120120
# Optional: TWINE_REPOSITORY if publishing to a custom production index
121121
run: uvx nox -s publish-package # Call the publish-package session (defaults to pypi.org)
122122

{{cookiecutter.project_name}}/.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
rev: v0.3.5
1818
hooks:
1919
- id: ruff-format
20-
args: [--config={{ PROJECT_SLUG }}/.ruff.toml]
20+
args: [--config={{ cookiecutter.project_name }}/.ruff.toml]
2121

2222
- id: ruff
23-
args: [--fix, --exit-non-zero-on-fix, --config={{ PROJECT_SLUG }}/.ruff.toml]
23+
args: [--fix, --exit-non-zero-on-fix, --config={{ cookiecutter.project_name }}/.ruff.toml]

{{cookiecutter.project_name}}/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# {{ cookiecutter.project_name }}
22

3-
{{ cookiecutter.project_description }}
3+
{{ cookiecutter.package_name }}
44

55
---
66

7-
**[📚 View Documentation](https://{{ cookiecutter.project_slug.replace('_', '-') }}.readthedocs.io/)** | **[🐛 Report a Bug](https://github.com/{{ cookiecutter.github_username | lower | replace(' ', '-') }}/{{ cookiecutter.project_slug.replace('_', '-') }}/issues)** | **[✨ Request a Feature](https://github.com/{{ cookiecutter.github_username | lower | replace(' ', '-') }}/{{ cookiecutter.project_slug.replace('_', '-') }}/issues)**
7+
**[📚 View Documentation](https://{{ cookiecutter.project_name.replace('_', '-') }}.readthedocs.io/)** | **[🐛 Report a Bug](https://github.com/{{ cookiecutter.github_user | lower | replace(' ', '-') }}/{{ cookiecutter.project_name.replace('_', '-') }}/issues)** | **[✨ Request a Feature](https://github.com/{{ cookiecutter.github_user | lower | replace(' ', '-') }}/{{ cookiecutter.project_name.replace('_', '-') }}/issues)**
88

99
---
1010

@@ -22,8 +22,8 @@ To set up `{{ cookiecutter.package_name }}` for local development:
2222

2323
1. Clone the repository:
2424
```bash
25-
git clone https://github.com/{{ cookiecutter.github_username | lower | replace(' ', '-') }}/{{ cookiecutter.project_slug.replace('_', '-') }}.git
26-
cd {{ cookiecutter.project_slug }}
25+
git clone https://github.com/{{ cookiecutter.github_user | lower | replace(' ', '-') }}/{{ cookiecutter.project_name.replace('_', '-') }}.git
26+
cd {{ cookiecutter.project_name }}
2727
```
2828
2. Install dependencies using [:term:`uv`](uv-documentation):
2929
```bash
@@ -55,11 +55,11 @@ If your project defines command-line entry points in `pyproject.toml`:
5555

5656
```bash
5757
# Example usage of your CLI application
58-
# {{ cookiecutter.project_slug }} --help
59-
# {{ cookiecutter.project_slug }} do-something --input file.txt
58+
# {{ cookiecutter.project_name }} --help
59+
# {{ cookiecutter.project_name }} do-something --input file.txt
6060
```
6161

62-
For detailed API documentation and CLI command references, see the **[Documentation](https://{{ cookiecutter.project_slug.replace('_', '-') }}.readthedocs.io/)**.
62+
For detailed API documentation and CLI command references, see the **[Documentation](https://{{ cookiecutter.project_name.replace('_', '-') }}.readthedocs.io/)**.
6363

6464
## Development Workflow
6565

@@ -77,7 +77,7 @@ Explore the `noxfile.py` and the project documentation for detailed information
7777

7878
(This section should guide contributions *to this specific generated project*, not the template. It should refer to the project's `CODE_OF_CONDUCT.md` and link to a `CONTRIBUTING.md` specific to the project, if you choose to generate one.)
7979
80-
Report bugs or suggest features via the [issue tracker](https://github.com/{{ cookiecutter.github_username | lower | replace(' ', '-') }}/{{ cookiecutter.project_slug.replace('_', '-') }}/issues).
80+
Report bugs or suggest features via the [issue tracker](https://github.com/{{ cookiecutter.github_user | lower | replace(' ', '-') }}/{{ cookiecutter.project_name.replace('_', '-') }}/issues).
8181
8282
See [CONTRIBUTING.md](#) for contribution guidelines.
8383

{{cookiecutter.project_name}}/pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "{{ cookiecutter.package_name }}"
33
version = "0.1.0"
44
description = "{{ cookiecutter.package_name }}"
55
authors = [
6-
{ name = "{{ cookiecutter.author_name }}", email = "{{ cookiecutter.author_email }}" },
6+
{ name = "{{ cookiecutter.author }}", email = "{{ cookiecutter.email }}" },
77
]
88
license = { text = "{{ cookiecutter.license }}" }
99
readme = "README.md"
@@ -14,7 +14,7 @@ keywords = [
1414
]
1515

1616
classifiers = [
17-
"Programming Language :: Python :: {{cookiecutter.python_version}}",
17+
"Programming Language :: Python :: {{ cookiecutter.min_python_version }}",
1818
"Programming Language :: Python :: 3 :: Only",
1919
"License :: OSI Approved :: {{ cookiecutter.license }}",
2020
]
@@ -59,8 +59,8 @@ docs = [
5959
]
6060

6161
[project.urls]
62-
Homepage = "https://github.com/{{ cookiecutter.github_username | lower | replace(' ', '-') }}/{{ cookiecutter.project_slug.replace('_', '-') }}"
63-
Repository = "https://github.com/{{ cookiecutter.github_username | lower | replace(' ', '-') }}/{{ cookiecutter.project_slug.replace('_', '-') }}"
62+
Homepage = "https://github.com/{{ cookiecutter.github_user | lower | replace(' ', '-') }}/{{ cookiecutter.project_name.replace('_', '-') }}"
63+
Repository = "https://github.com/{{ cookiecutter.github_user | lower | replace(' ', '-') }}/{{ cookiecutter.project_name.replace('_', '-') }}"
6464

6565
[build-system]
6666
requires = [

{{cookiecutter.project_name}}/pyrightconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@
3939
"basic": true,
4040
"reportMissingParameterType": "warning",
4141
"reportOptionalOperand": "warning",
42-
"pythonVersion": "{{ cookiecutter.python_version }}"
42+
"pythonVersion": "{{ cookiecutter.min_python_version }}"
4343
}

0 commit comments

Comments
 (0)