Important Links
π»GitHub: HYP3R00T/devcontainer-python-template
Python Template β
A modern Python development container template with best practices, automated tooling, and VS Code integration.
Features β
- π Python 3.13 with modern tooling
- π¦ UV for fast package management
- π§ Mise for tool version management
- π¨ Ruff for linting and formatting
- πͺ Pre-commit hooks for code quality
- π Conventional commits with Commitizen
- π³ Dev containers for consistent development environment
- βοΈ VS Code optimized settings and extensions
Quick Start β
Method 1: VS Code Dev Containers (Traditional) β
- Click "Use this template" on GitHub or clone the repository
- Open in VS Code with the Dev Containers extension
- When prompted, click "Reopen in Container"
- Wait for the container to build and setup to complete
Method 2: DevPod (Recommended for Clean Host) β
If you prefer to keep your host machine clean and avoid installing anything except the essentials:
Install Prerequisites:
Create Development Environment:
bash# Create a new workspace from this template devpod up https://github.com/YOUR_USERNAME/devcontainer-python-template.git
Choose your development experience:
- VS Code: DevPod will automatically open VS Code with the project
- SSH: Use any editor with SSH support (
devpod ssh devcontainer-python-template
) - Web IDE: Access via browser using DevPod's web interface
- Terminal: Direct terminal access (
devpod ssh devcontainer-python-template
)
Benefits of DevPod approach:
- β Zero configuration on host machine
- β Complete isolation from host environment
- β Consistent development environment across team members
- β Easy cleanup when project is done
- β Works with any container runtime (Docker, Podman, etc.)
- β Multiple editor/IDE options
Method 3: Manual Setup β
git clone https://github.com/YOUR_USERNAME/devcontainer-python-template.git
cd devcontainer-python-template
code .
# VS Code will prompt to reopen in container
Customization Required β
After creating your project from this template, you'll need to update the following files with your own information:
π Files to Update β
File | What to Change | Current Value | Update To |
---|---|---|---|
LICENSE | Copyright holder | hyperoot.dev | Your name/organization |
.github/FUNDING.yml | GitHub sponsor | HYP3R00T | Your GitHub username |
.github/CODEOWNERS | Code owners | @HYP3R00T | Your GitHub username/team |
.github/CODE_OF_CONDUCT.md | Contact email | [email protected] | Your email address |
.devcontainer/devcontainer.json | Container name | devcontainer-python-template | Your project name |
π Search and Replace β
You can quickly update all references by searching for these patterns in your editor:
hyperoot.dev
β Your domain/organizationHYP3R00T
β Your GitHub username[email protected]
β Your emaildevcontainer-python-template
β Your project name
π‘ Tip: Use VS Code's "Find and Replace" (Ctrl/Cmd + H) to quickly update all instances across your project.
Initial Setup After Customization β
Once you've updated all the references above, you need to initialize your Python project:
1. Initialize UV Project β
Choose one based on your project type:
# For a simple script/application project
uv init
# For a Python package that you plan to distribute
uv init --package
2. Install Essential Development Dependencies β
Based on the project configuration, install these required packages:
# Core development tools (already configured in the template)
uv add --dev pytest pytest-cov # Testing framework and coverage
uv add --dev mypy # Static type checking
uv add --dev commitizen # Conventional commits (if not installed via pipx)
# Optional: Add common project dependencies based on your needs
uv add --dev types-requests # Type stubs for requests (if using requests)
Note: ruff
, pre-commit
, and uv
are managed by Mise (see mise.toml
), so you don't need to install them separately.
Project Structure β
.
βββ .devcontainer/ # Development container configuration
β βββ devcontainer.json # VS Code dev container settings
β βββ Dockerfile # Container definition
βββ .github/ # GitHub templates and workflows
β βββ ISSUE_TEMPLATE/ # Issue templates
β βββ instructions/ # Copilot instructions
β βββ workflows/ # GitHub Actions
β βββ CODE_OF_CONDUCT.md # Community guidelines
β βββ CODEOWNERS # Code ownership
β βββ FUNDING.yml # Sponsorship info
β βββ PULL_REQUEST_TEMPLATE.md
βββ .vscode/ # VS Code workspace settings
βββ scripts/ # Setup and utility scripts
βββ mise.toml # Tool version management
βββ ruff.toml # Linting and formatting config
βββ .pre-commit-config.yaml # Pre-commit hooks
βββ .editorconfig # Editor configuration
βββ .gitignore # Git ignore patterns
Development Tools β
Mise (Tool Management) β
This project uses Mise to manage Python and other tool versions:
# Install tools defined in mise.toml
mise install
# Check installed versions
mise list
# Update tools
mise upgrade
UV (Package Management) β
UV is used for fast Python package management:
# Create a new project
uv init
# Add dependencies
uv add requests pandas
# Add development dependencies
uv add --dev pytest ruff
# Install dependencies
uv sync
# Run Python
uv run python
# Run scripts
uv run pytest
Ruff (Linting & Formatting) β
Code quality is maintained with Ruff:
# Check code
uv run ruff check
# Format code
uv run ruff format
# Fix auto-fixable issues
uv run ruff check --fix
Pre-commit Hooks β
Automated code quality checks run before each commit:
# Install hooks (done automatically in dev container)
pre-commit install
# Run hooks manually
pre-commit run --all-files
# Update hook versions
pre-commit autoupdate
VS Code Integration β
The template includes optimized VS Code settings and extensions:
Pre-installed Extensions β
- Python - Python language support
- Pylance - Advanced Python language server
- Ruff - Linting and formatting
- Even Better TOML - TOML file support
- Path Intellisense - Autocomplete for file paths
- YAML - YAML language support
- Mise - Tool version management integration
Configured Settings β
- Auto-format on save with Ruff
- Organized imports on save
- Consistent indentation (4 spaces for Python)
- 120 character line length
- GitHub Copilot integration with custom instructions
GitHub Actions β
The template includes a basic CI pipeline (.github/workflows/ci.yaml
) that:
- Installs dependencies with UV
- Runs Ruff linting and formatting checks
- Can be extended with testing, security scans, etc.
Contributing β
- Follow the coding standards defined in
.github/copilot-instructions.md
- Use conventional commits (enforced by Commitizen)
- Ensure all pre-commit hooks pass
- Add tests for new features
- Update documentation as needed
Coding Standards β
This project follows strict coding standards:
- Naming:
snake_case
for functions/variables,PascalCase
for classes - Type Safety: Type hints required for all functions and methods
- Data Validation: Use Pydantic for data models
- Error Handling: Specific exceptions with clear messages
- Documentation: Google-style docstrings
- Testing: Comprehensive test coverage with pytest
See .github/copilot-instructions.md
for detailed guidelines.
License β
This project is licensed under the MIT License - see the LICENSE file for details.
Support β
- π Documentation: Check the files in
.github/instructions/
- π Issues: Use the issue templates in
.github/ISSUE_TEMPLATE/
- π‘ Features: Submit feature requests via GitHub issues
- π€ Contributing: Follow the pull request template
Happy coding! π