Python Starter
Automatically configures formatter and linter when initializing Python projects.
Workflow
- •
Environment Detection and Selection
- •Use UV if
uv.lockfile exists oruvcommand is available - •Use Poetry if
[tool.poetry]section exists inpyproject.toml - •If no environment is configured, recommend uv
- •Otherwise use venv
- •Ask the user if uncertain
- •Use UV if
- •
Install ruff
- •Install ruff as dev dependency based on selected environment
- •Use commands (avoid writing code directly)
- •Reference: environment-setup.md
- •
Configure pyproject.toml
- •Create
pyproject.tomlif it doesn't exist - •Add ruff configuration (see pyproject-toml-examples.md for default settings)
- •Template: assets/pyproject.toml.template
- •Create
- •
Install pytest
- •Install pytest as dev dependency based on selected environment
- •Use commands (avoid writing code directly)
- •
Type Checking Setup (Optional)
- •Ask the user if they want ty setup
- •Install ty as dev dependency if needed
- •Add ty configuration to
pyproject.toml - •Reference: pyproject-toml-examples.md
- •
Pre-commit Setup (Optional)
- •Ask the user if they want pre-commit setup
- •Install pre-commit and create
.pre-commit-config.yamlif needed - •Reference: pre-commit-setup.md
- •Template: assets/.pre-commit-config.yaml.template
- •
VSCode Settings Suggestion
- •Suggest creating
.vscode/settings.jsonwhen using VSCode - •Include ruff and ty (if configured) settings
- •Reference: vscode-settings.md
- •Template: assets/.vscode-settings.json.template
- •Suggest creating
- •
Create .gitignore
- •Create
.gitignoreif it doesn't exist - •Include common Python ignores for virtual environments, cache files, build artifacts, IDE files, and OS files
- •Template: assets/.gitignore.template
- •Create
Principles
- •Command-first: Use commands whenever possible instead of writing code directly
- •Use pyproject.toml: Store all configuration in
pyproject.toml - •Dev dependencies: Install ruff, pytest, ty, and pre-commit as dev dependencies
- •User confirmation: Confirm with user for environment selection, ty, and pre-commit before proceeding
References
- •Environment setup: references/environment-setup.md
- •pyproject.toml examples: references/pyproject-toml-examples.md
- •Pre-commit setup: references/pre-commit-setup.md
- •VSCode settings: references/vscode-settings.md