2.4 KiB
2.4 KiB
Template Generation Request
Create a template/ folder in project root with reusable files for new Python projects.
Required Structure
template/
├── .env # Environment variables (sample)
├── .gitignore # Git ignore rules
├── CHANGELOG.md # Changelog template
├── PROJECT.md # Project documentation template
├── README.md # Project overview, tool descriptions, build instructions
├── <tool_name>.py # Entry point — named by purpose or tool name
├── <tool_name>.spec # PyInstaller spec (only for projects shipping an .exe)
├── prebuild.py # Pre-build script: venv check, version print, console= rewrite
├── pyproject.toml # Poetry config (ruff, mypy, pytest)
├── docs/
│ └── .gitkeep # Detailed documentation lives here, never in the root
├── src/
│ ├── __init__.py
│ ├── _version.py # Version fallback for PyInstaller
│ └── constants.py # Version extraction from toml + DEBUG mode
└── tests/
├── __init__.py
└── test_constants.py # Basic test
CLAUDE.md, AGENTS.md and DESIGN_DOCUMENT.md are not part of the template — they are copied
into the project root from the documentation repository, which stays their source of truth. The
copies themselves are committed with the project and are never edited in place.
Key Features
- Version extraction from
pyproject.tomlwith_version.pyfallback for PyInstaller builds - DEBUG mode via
ENV_DEBUG=truein.env(adds "DEV" suffix to version: v1.2.3DEV) - Build configuration via
ENV_BUILD_CONSOLEandENV_BUILD_SPECin.env, applied byprebuild.py - loguru for logging (never print for debugging)
- Poetry for dependency management,
poetry.lockcommitted - pytest for testing (no unittest)
- ruff + mypy for linting and type checking (120-character lines)
Rules
- No
.examplesuffixes - the folder itself is the separator - Generic/reusable format
- Keep files simple and minimal
.gitignoreis the shared core fromProject template/.gitignorewithPython/.gitignoreappended- Entry point is named by purpose or tool name — a project may have several
prebuild.pyand the.specfile are only needed for projects distributed as a standalone.exe