python-development
Modern Python development with Python 3.12+, Django, FastAPI, async patterns, and production best practices
View on GitHubTable of content
Modern Python development with Python 3.12+, Django, FastAPI, async patterns, and production best practices
Installation
npx claude-plugins install @HermeticOrmus/claude-code-workflows/python-development
Contents
Folders: agents, commands, skills
Files: README.md
Documentation
Modern Python development patterns, testing, packaging, and the blazing-fast uv package manager.
Python Development provides:
- 5 Skills - Async patterns, testing, packaging, performance, uv
- 1 Agent - Python development expert
- 1 Command - Python project scaffolding
Result: Production-ready Python code with modern tooling.
Quick Start
Invoke the Agent
@python-pro scaffold a FastAPI project with uv
@python-pro review this async code for best practices
@python-pro optimize this data processing function
Access Skills
# Skills are auto-loaded when relevant
"Set up uv for this project" -> uv-package-manager skill activates
"Write pytest tests" -> python-testing-patterns skill activates
The 5 Skills
1. UV Package Manager
10-100x faster than pip, modern Python project management
- Project setup with
uv init - Dependency management with lockfiles
- Virtual environment creation
- Python version management
- CI/CD optimization
Example:
# Create project
uv init myproject
cd myproject
# Add dependencies
uv add fastapi uvicorn sqlalchemy
# Sync environment
uv sync
2. Python Testing Patterns
Comprehensive testing with pytest and modern fixtures
- Test organization and discovery
- Fixture composition patterns
- Mocking and patching strategies
- Async test patterns
- Property-based testing with Hypothesis
Example:
@pytest.fixture
def db_session():
"""Provide clean database session per test."""
engine = create_engine("sqlite:///:memory:")
with Session(engine) as session:
yield session
session.rollback()
3. Async Python Patterns
Concurrency with asyncio, avoiding common pitfalls
- Async context managers
- Task groups and structured concurrency
- Semaphores for rate limiting
- Async generators
- Error handling in async code
Example:
async def fetch_all(urls: list[str]) -> list[Response]:
async with aiohttp.ClientSession() as session:
async with asyncio.TaskGroup() as tg:
tasks = [tg.create_task(fetch(session, url)) for url in urls]
return [t.result() for t in tasks]
4. Python Packaging
Modern packaging with pyproject.toml and setuptools
- pyproject.toml configuration
- Entry points and scripts
- Package distribution (wheel, sdist)
- Version management
- Dependency specification
Example:
[project]
name = "mypackage"
version = "1.0.0"
dependencies = ["requests>=2.28"]
[project.scripts]
mycommand = "mypackage.cli:main"
5. Python Performance Optimization
Making Python fast where it matters
- Profiling with cProfile, py-spy
- Memory optimization
- NumPy/Pandas vectorization
- JIT compilation with Numba
- Multiprocessing patterns
Example:
# Before: 100x slower
result = [x**2 for x in large_list]
# After: Vectorized
result = np.array(large_list) ** 2
Plugin Structure
python-development/
├── README.md # This file
│
├── skills/ # Knowledge base
│ ├── uv-package-manager/
│ │ └── SKILL.md # uv patterns
│ ├── python-testing-patterns/
│ │ └── SKILL.md # pytest patterns
│ ├── async-python-patterns/
│ │ └── SKILL.md # asyncio patterns
│ ├── python-packaging/
│ │ └── SKILL.md # packaging patterns
│ └── python-performance-optimization/
│ └── SKILL.md # performance patterns
│
├── commands/ # Slash commands
│ └── python-scaffold.md # Project scaffolding
│
└── agents/ # Specialist agents
└── python-pro.md # Python expert agent
Usage Examples
Example 1: New Project Setup
User: Set up a new FastAPI project with uv, pytest, and async support
@python-pro responds:
- Creates project with uv init
- Adds dependencies (fastapi, uvicorn, pytest, pytest-asyncio)
- Sets up project structure
- Creates sample async endpoint
- Creates sample async test
Example 2: Code Review
User: Review this Python code for async best practices
@python-pro analyzes:
- Identifies blocking calls in async context
- Suggests asyncio.to_thread for CPU-bound work
- Recommends structured concurrency with TaskGroup
- Points out error handling improvements
Example 3: Performance Issue
User: This data processing is too slow, help me optimize
@python-pro:
1. Profiles the code to find bottlenecks
2. Suggests vectorization with NumPy
3. Recommends caching with functools.lru_cache
4. Proposes multiprocessing for CPU-bound work
When to Use This Plugin
Perfect For:
- Python application development
- FastAPI/Flask/Django projects
- Data processing pipelines
- Async/concurrent programming
- Testing and quality assurance
- Packag
…(truncated)
Included Skills
This plugin includes 5 skill definitions:
async-python-patterns
Master Python asyncio, concurrent programming, and async/await patterns for high-performance applications. Use when building async APIs, concurrent systems, or I/O-bound applications requiring non-blocking operations.
View skill definition
Async Python Patterns
Comprehensive guidance for implementing asynchronous Python applications using asyncio, concurrent programming patterns, and async/await for building high-performance, non-blocking systems.
When to Use This Skill
- Building async web APIs (FastAPI, aiohttp, Sanic)
- Implementing concurrent I/O operations (database, file, network)
- Creating web scrapers with concurrent requests
- Developing real-time applications (WebSocket servers, chat systems)
- Processing multiple independent tasks simultaneously
- Building microservices with async communication
- Optimizing I/O-bound workloads
- Implementing async background tasks and queues
Core Concepts
1. Event Loop
The event loop is the heart of asyncio, managing and scheduling asynchronous tasks.
Key characteristics:
- Single-threaded cooperative multitasking
- Schedules coroutines for execution
- Handles I/O operations without blocking
- Manages callbacks and futures
2. Coroutines
Functions defined with async def that can be paused and resumed.
Syntax:
async def my_coroutine():
result = await some_async_operation()
return result
3. Tasks
Scheduled coroutines that run concurrently on the event loop.
4. Futures
Low-level objects representing eventual results of async operations.
5. Async Context Managers
Resources that support async with for proper cleanup.
6. Async Iterators
Objects that support async for for iterating over async da
…(truncated)
python-packaging
Create distributable Python packages with proper project structure, setup.py/pyproject.toml, and publishing to PyPI. Use when packaging Python libraries, creating CLI tools, or distributing Python code.
View skill definition
Python Packaging
Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.
When to Use This Skill
- Creating Python libraries for distribution
- Building command-line tools with entry points
- Publishing packages to PyPI or private repositories
- Setting up Python project structure
- Creating installable packages with dependencies
- Building wheels and source distributions
- Versioning and releasing Python packages
- Creating namespace packages
- Implementing package metadata and classifiers
Core Concepts
1. Package Structure
- Source layout:
src/package_name/(recommended) - Flat layout:
package_name/(simpler but less flexible) - Package metadata: pyproject.toml, setup.py, or setup.cfg
- Distribution formats: wheel (.whl) and source distribution (.tar.gz)
2. Modern Packaging Standards
- PEP 517/518: Build system requirements
- PEP 621: Metadata in pyproject.toml
- PEP 660: Editable installs
- pyproject.toml: Single source of configuration
3. Build Backends
- setuptools: Traditional, widely used
- hatchling: Modern, opinionated
- flit: Lightweight, for pure Python
- poetry: Dependency management + packaging
4. Distribution
- PyPI: Python Package Index (public)
- TestPyPI: Testing before production
- Private repositories: JFrog, AWS CodeArtifact, etc.
Quick Start
Minimal Package Stru
…(truncated)
python-performance-optimization
Profile and optimize Python code using cProfile, memory profilers, and performance best practices. Use when debugging slow Python code, optimizing bottlenecks, or improving application performance.
View skill definition
Python Performance Optimization
Comprehensive guide to profiling, analyzing, and optimizing Python code for better performance, including CPU profiling, memory optimization, and implementation best practices.
When to Use This Skill
- Identifying performance bottlenecks in Python applications
- Reducing application latency and response times
- Optimizing CPU-intensive operations
- Reducing memory consumption and memory leaks
- Improving database query performance
- Optimizing I/O operations
- Speeding up data processing pipelines
- Implementing high-performance algorithms
- Profiling production applications
Core Concepts
1. Profiling Types
- CPU Profiling: Identify time-consuming functions
- Memory Profiling: Track memory allocation and leaks
- Line Profiling: Profile at line-by-line granularity
- Call Graph: Visualize function call relationships
2. Performance Metrics
- Execution Time: How long operations take
- Memory Usage: Peak and average memory consumption
- CPU Utilization: Processor usage patterns
- I/O Wait: Time spent on I/O operations
3. Optimization Strategies
- Algorithmic: Better algorithms and data structures
- Implementation: More efficient code patterns
- Parallelization: Multi-threading/processing
- Caching: Avoid redundant computation
- Native Extensions: C/Rust for critical paths
Quick Start
Basic Timing
import time
def measure_time():
"""Simple timing me
...(truncated)
</details>
### python-testing-patterns
> Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.
<details>
<summary>View skill definition</summary>
# Python Testing Patterns
Comprehensive guide to implementing robust testing strategies in Python using pytest, fixtures, mocking, parameterization, and test-driven development practices.
## When to Use This Skill
- Writing unit tests for Python code
- Setting up test suites and test infrastructure
- Implementing test-driven development (TDD)
- Creating integration tests for APIs and services
- Mocking external dependencies and services
- Testing async code and concurrent operations
- Setting up continuous testing in CI/CD
- Implementing property-based testing
- Testing database operations
- Debugging failing tests
## Core Concepts
### 1. Test Types
- **Unit Tests**: Test individual functions/classes in isolation
- **Integration Tests**: Test interaction between components
- **Functional Tests**: Test complete features end-to-end
- **Performance Tests**: Measure speed and resource usage
### 2. Test Structure (AAA Pattern)
- **Arrange**: Set up test data and preconditions
- **Act**: Execute the code under test
- **Assert**: Verify the results
### 3. Test Coverage
- Measure what code is exercised by tests
- Identify untested code paths
- Aim for meaningful coverage, not just high percentages
### 4. Test Isolation
- Tests should be independent
- No shared state between tests
- Each test should clean up after itself
## Quick Start
```python
# test_example.py
def add(a, b):
return a + b
def test_add():
"""Basic test example."""
result = add(2, 3)
assert
...(truncated)
</details>
### uv-package-manager
> Master the uv package manager for fast Python dependency management, virtual environments, and modern Python project workflows. Use when setting up Python projects, managing dependencies, or optimizing Python development workflows with uv.
<details>
<summary>View skill definition</summary>
# UV Package Manager
Comprehensive guide to using uv, an extremely fast Python package installer and resolver written in Rust, for modern Python project management and dependency workflows.
## When to Use This Skill
- Setting up new Python projects quickly
- Managing Python dependencies faster than pip
- Creating and managing virtual environments
- Installing Python interpreters
- Resolving dependency conflicts efficiently
- Migrating from pip/pip-tools/poetry
- Speeding up CI/CD pipelines
- Managing monorepo Python projects
- Working with lockfiles for reproducible builds
- Optimizing Docker builds with Python dependencies
## Core Concepts
### 1. What is uv?
- **Ultra-fast package installer**: 10-100x faster than pip
- **Written in Rust**: Leverages Rust's performance
- **Drop-in pip replacement**: Compatible with pip workflows
- **Virtual environment manager**: Create and manage venvs
- **Python installer**: Download and manage Python versions
- **Resolver**: Advanced dependency resolution
- **Lockfile support**: Reproducible installations
### 2. Key Features
- Blazing fast installation speeds
- Disk space efficient with global cache
- Compatible with pip, pip-tools, poetry
- Comprehensive dependency resolution
- Cross-platform support (Linux, macOS, Windows)
- No Python required for installation
- Built-in virtual environment support
### 3. UV vs Traditional Tools
- **vs pip**: 10-100x faster, better resolver
- **vs pip-tools**: Faster, simpler, better UX
- **vs poe
...(truncated)
</details>
## Source
[View on GitHub](https://github.com/HermeticOrmus/LibreUIUX-Claude-Code)