Skip to content

Fix 5 cookiecutter template issues#28

Open
fbidu wants to merge 5 commits intomainfrom
fbidu/review-cookiecutter
Open

Fix 5 cookiecutter template issues#28
fbidu wants to merge 5 commits intomainfrom
fbidu/review-cookiecutter

Conversation

@fbidu
Copy link
Copy Markdown
Owner

@fbidu fbidu commented Feb 7, 2026

Summary

This PR implements 5 critical and minor fixes to the cookiecutter template, all tested and committed atomically:

  • Fix GitHub workflow rendering: Remove _copy_without_render and use {% raw %} blocks for GitHub Actions expressions
  • Fix node_modules build error: Add explicit [build-system] config and hatchling backend
  • Fix license deprecation: Update to modern SPDX string format
  • Fix dev dependencies: Change [project.optional-dependencies] to [dependency-groups]
  • Document pre-commit prerequisite: Update README with pre-commit installation steps

Test Results

All 10 integration tests pass (8 existing + 2 new). Generated projects now build successfully with uv build and have properly rendered templates.

🤖 Generated with Claude Code

fbidu and others added 5 commits February 7, 2026 15:57
Previously, _copy_without_render prevented Jinja2 from rendering
{{cookiecutter.*}} variables in workflow files, causing generated
projects to have literal {{cookiecutter.python_version}} in CI.
Fixed by removing the setting and wrapping GitHub Actions ${{ }}
expressions in {% raw %} blocks instead.

Changes:
- Add test for workflow file rendering validation
- Remove _copy_without_render from cookiecutter.json
- Wrap GitHub Actions expressions in test.yml with {% raw %} blocks

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The prettier pre-commit hook creates node_modules/.cache in the
generated project root. Without an explicit build-system config,
setuptools discovers it as a top-level package, causing
"Multiple top-level packages discovered" errors.

Changes:
- Add [build-system] with hatchling backend to pyproject.toml
- Explicitly specify package name in [tool.hatch.build.targets.wheel]
- Add node_modules/ to .gitignore to prevent accidental commits

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The old `license = { text = "..." }` format triggers a
SetuptoolsDeprecationWarning. Modern pyproject.toml should use
a plain SPDX string instead of a TOML table.

Changes:
- Add test for SPDX string license format validation
- Update pyproject.toml to use license = "MIT" format

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The root pyproject.toml used [project.optional-dependencies] for
dev tools, but `uv sync --dev` only recognizes [dependency-groups].
This meant dev dependencies required `--extra dev` instead.

Changes:
- Change [project.optional-dependencies] to [dependency-groups]
- Regenerate uv.lock to reflect the change

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The hooks/pre_gen_project.py requires pre-commit to be installed
globally, but the README only listed uv and cookiecutter. Users
would encounter errors without knowing they needed pre-commit.

Changes:
- Add pre-commit installation as step 3 in Portuguese section
- Add pre-commit installation as step 3 in English section
- Renumber subsequent steps accordingly

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant