This repository is a reusable template for bootstrapping Python CLI projects with typer, uv, and a src/ package layout.
- Project scaffolding and package naming via
scripts/setup.sh - Optional follow-up automation scripts for:
- DVC initialization (
scripts/setup_dvc.sh) - Minimal GitHub Actions CI workflow (
scripts/setup_github_actions.sh)
- DVC initialization (
- Cursor rules in
.cursor/rules/to enforce coding conventions
Run from the template root:
bash scripts/setup.shThe script will:
- Ask for the new project/package name
- Ask for a destination parent path (default: same parent directory as this template)
- Copy the template into a new folder named after your project
- Rename the package under
src/ - Update
pyproject.tomlplaceholders - Cache the generated project path in
.cache/template-last-project - Optionally run
uvbootstrap (uv sync,uv venv,uv pip install -e .)
Both scripts can use either:
- The cached project path from
.cache/template-last-project, or - An explicit project path argument
bash scripts/setup_dvc.sh
# or
bash scripts/setup_dvc.sh /absolute/path/to/your-projectBehavior:
- Validates target path
- Initializes DVC only if it is not already initialized
- Does not configure remotes automatically
bash scripts/setup_github_actions.sh
# or
bash scripts/setup_github_actions.sh /absolute/path/to/your-projectTo replace existing workflows safely:
bash scripts/setup_github_actions.sh --reset-workflowsBehavior:
- Validates target path
- Writes a minimal CI workflow at
.github/workflows/ci.yml - With
--reset-workflows, moves existing workflows to a timestamped backup folder first
- CLI-first development with
typer - Code lives under
src/${package_name}/ - Pipeline modules follow:
abc.ABC+@abstractmethod- Strategy Pattern
- Factory Method
- Fail-fast error handling by default
- Central paths/constants in
src/${package_name}/config.pyusingpathlib.Path - Readability over cleverness
See .cursor/rules/ for detailed guidance applied in Cursor.
.cache/template-last-projectis local state and should not be committed.- If your target project already exists,
scripts/setup.shwill exit without overwriting it.