Skip setup, start building. A smart coding template for Python that comes preconfigured with modern development tools and AI-assisted coding practices.
- Overview
- Getting Started
- Assisted AI Coding Workflow
- Best Practices
- Template details
- License
- Contributing to the Template
scot.py is a comprehensive Python project template designed to accelerate development with best practices built-in. It includes everything you need for professional Python development: linting, type checking, dependency management, CI/CD, and most importantly, optimized Cursor AI rules for enhanced AI-assisted development.
- Development Tools: Pre-configured with Poetry, Ruff linter, Pyright type checker
- CI/CD: GitHub Actions workflow with format checking, linting, testing and coverage reports
- Editor Support: VSCode settings and extensions
- AI-Optimized: Cursor rules specifically designed for effective AI-assisted development
- Code Quality: High-quality code style guidelines and contribution templates
- License Compliance: Automated license checking in CI pipeline
- Cursor: Version 1.0 or higher
- Python: Version 3.10 or higher
For optimal AI-assisted development experience:
- Enable Auto-run mode: (previously known as YOLO mode) and whitelist
poetrycommands - Recommended AI models:
- Project definition: Claude 4
- Feature definition: Claude 4
- Coding: Auto mode (generally sufficient)
- Navigate to github.com/ezorita/scotpy
- Click "Use this template"
- Generate your own repository from the template
Fork the repository and adapt it to your project. Keeping the remote branch will allow you to pull the latest changes of the template later.
To sync with upstream changes later:
# Add upstream remote (one-time setup)
git remote add upstream https://github.com/ezorita/scotpy.git
# Sync with latest template changes
git fetch upstream
git merge upstream/main# Clone the repository
git clone https://github.com/ezorita/scotpy.git your-project-name
# Navigate to your project
cd your-project-name
# Rename and set up your repository
git remote rm origin
git remote add origin your-repository-url
git push -u origin mainFor existing projects, copy these essential files:
# Minimum required
cp -r .cursor/rules /path/to/your/project/
cp CONTRIBUTING.md /path/to/your/project/Additional considerations:
- Guidelines: Update
CONTRIBUTING.mdto match your project's contribution guidelines. You can ask the Cursor Agent to help adapt it based on your existing codebase. - Development tools: Copy the relevant sections of
pyproject.tomlif you want to use the same development tools as the template (recommended).
Use of pyenv is recommended to control your base Python version, especially if you are a Linux user.
This project relies on poetry which will create a virtual environment to manage your dependencies. The template is preconfigured with virtualenvs.in-project=false setting to avoid collision between Docker mapped folders and local virtual environments. This prevents issues when using Docker containers that mount your project directory.
Virtual environment locations:
- Default setting (
virtualenvs.in-project=false): Virtual environment created in~/.cache/pypoetry/virtualenvs/ - Alternative setting (
virtualenvs.in-project=true): Virtual environment created in.venv/directory within your project
Important: If you change to virtualenvs.in-project=true in poetry.toml, ensure the .venv/ directory is included in your .gitignore to avoid committing virtual environment files.
# Install dependencies and create virtual environment
poetry install
# Set up pre-commit hooks (run once after installation)
poetry run pre-commit installNote: The pre-commit hooks will automatically run code quality checks (linting, type checking) before each commit, ensuring consistent code quality.
- After running
poetry install, pressCtrl+Shift+P(orCmd+Shift+Pon Mac) - Search for "Python: Select Interpreter"
- Choose the Poetry virtual environment interpreter (usually shows the project name)
This enables AI agents to see your dependencies and provide accurate code suggestions.
- Open a new Cursor chat
- Reference
@new_project.mdc - The Agent will guide you through:
- Project vision definition
- Repository setup and configuration
- Initial project structure creation
- Review and confirm each step
- Result: A
project/vision.mdfile containing your project's vision and scope
π‘ Tip: Use Claude 4 for this step for best results
- Open a new Cursor chat
- Reference
@new_feature.mdc - The Agent will assist with:
- Feature definition: Clear specification of what the feature should do
- Implementation plan: Technical approach and architecture decisions
- Task breakdown: Granular, actionable development tasks
- Review and approve each step
- Result: A new folder in
project/containing:feature.md- Feature specificationimplementation.md- Technical implementation plantasks.md- Detailed task breakdown
π‘ Tip: Use Claude 4 for this step for best results
- Open a new Cursor chat
- Reference
@implement_feature.mdc - The Agent will:
- Identify the next task to implement
- Ask for confirmation
- Implement the task with proper code structure
- Review the generated files and confirm
- For next task: Open a fresh Cursor chat to clear context and improve implementation effectiveness
- Start Fresh: Use new Cursor chats for each major task to maintain clean context
- Review Everything: Always review AI-generated code and plans before confirming
- Follow the Workflow: Use the three-step process (project β feature β implementation) for best results
- Leverage AI Models: Use Claude 4 for high-level planning, Auto mode for implementation
- Maintain Documentation: Keep project and feature documentation updated as you develop
- Traceability: Export all conversations and store them in
chat/folders for traceability
| Component | Tool | Purpose |
|---|---|---|
| Dependency Management | Poetry | Package management and virtual environments |
| Linting | Ruff | Fast Python linter and formatter |
| Type Checking | Pyright | Static type analysis |
| Pre-commit Hooks | pre-commit | Automated code quality checks before commits |
| CI/CD | GitHub Actions | Automated testing, linting, and quality checks |
| Coverage | Codecov | Test coverage reporting in CI |
| License Compliance | Automated | License header verification in Pull Request |
Coverage: You can set up codecov by setting this secret in your repository (or global secret in organization): CODECOV_GLOBAL_TOKEN. If you do not wish to use codecov for code coverage, either delete the action from .github/workflows/ci.yml or update it to use your preferred provider.
# Code quality
poetry run poe lint # Run linter (ruff)
poetry run poe typecheck # Run type checker (pyright)
# Testing
poetry run poe test # Run all tests
poetry run poe test_cov # Run tests with coverage report
# Combined checks (run before committing)
poetry run poe check # Run all quality checks (lint + typecheck + test)
# Pre-commit
poetry run pre-commit run --all-files # Run pre-commit hooks manually on all files
poetry run pre-commit run # Run pre-commit hooks on staged files only
poetry run pre-commit autoupdate # Update hook versionsyour-project/
βββ .cursor/
β βββ rules/ # AI-optimized Cursor rules
βββ .github/
β βββ workflows/
β βββ ci.yml # Continuous integration pipeline
βββ .vscode/ # Editor settings and extension recommendations
βββ project/ # Auto-generated project documentation
β βββ vision.md # Project vision (created during setup)
β βββ 00_feature-name/ # Feature-specific docs (created per feature)
β βββ feature.md # Feature specification and requirements
β βββ implementation.md # Technical implementation strategy
β βββ tasks.md # Detailed task breakdown
βββ src/ # Source code
βββ tests/ # Test suite
βββ .pre-commit-config.yaml # Pre-commit hooks configuration
βββ .secrets.baseline # Known secrets patterns for security scanning
βββ CONTRIBUTING.md # Development and contribution guidelines
βββ LICENSE # Template license (replace with your project's license)
βββ poetry.toml # Poetry-specific configuration
βββ pyproject.toml # Project configuration
βββ README.md # This document (replace with your project README)
This template is released under the MIT License - see the LICENSE file for details.
For your projects: You are free to use any license for projects created from this template. The template's MIT license only applies to the template itself, not to projects you create using it.
Contributions are very welcome, feel free to request them via Pull Request.
Ready to start coding smarter? Follow the setup instructions above and begin with @new_project.mdc to define your first AI-assisted Python project.
