Deep fluency in modern Python (3.14+) for production systems. Use when writing Python code, designing APIs, building data pipelines, creating async services, or optimizing performance. Covers typing, tooling (uv/pyright/ruff), FastAPI, Polars, observability, and engineering judgment.
This skill provides expert-level Python development practices for building production systems.
Any is a code smellpyright and ruff block merges, not just warnuv + pyproject.toml as single source of truth# Initialize new project
uv init my-project
cd my-project
# Add dependencies
uv add fastapi pydantic httpx
# Add dev dependencies
uv add --dev pytest pyright ruff
# Sync environment
uv sync
[project]
requires-python = ">=3.14"
[tool.pyright]
pythonVersion = "3.14"
typeCheckingMode = "strict"
[tool.ruff]
target-version = "py314"
line-length = 100
[tool.ruff.lint]
select = ["E", "F", "I", "N", "UP", "B", "A", "C4", "PT", "RUF"]
from typing import Protocol, Self
from collections.abc import Sequence, Mapping
# Use protocols for duck typing
class Serializable(Protocol):
def to_dict(self) -> Mapping[str, object]: ...
# Use Self for fluent APIs
class Builder:
def with_name(self, name: str) -> Self:
self._name = name
return self
# Prefer collections.abc over typing module
def process(items: Sequence[str]) -> list[str]:
return [item.upper() for item in items]
from fastapi import FastAPI, HTTPException, status
from pydantic import BaseModel, Field
import httpx
app = FastAPI()
class CreateUserRequest(BaseModel):
email: str = Field(..., pattern=r"^[\w\.-]+@[\w\.-]+\.\w+$")
name: str = Field(..., min_length=1, max_length=100)
class UserResponse(BaseModel):
id: str
email: str
name: str
@app.post("/users", response_model=UserResponse, status_code=status.HTTP_201_CREATED)
async def create_user(request: CreateUserRequest) -> UserResponse:
# Implementation with proper error handling
...
import asyncio
from contextlib import asynccontextmanager
from collections.abc import AsyncIterator
@asynccontextmanager
async def managed_client() -> AsyncIterator[httpx.AsyncClient]:
"""Always use context managers for async resources."""
async with httpx.AsyncClient(timeout=30.0) as client:
yield client
async def fetch_with_timeout(url: str) -> bytes:
"""Explicit timeouts, never fire-and-forget."""
async with managed_client() as client:
response = await client.get(url)
response.raise_for_status()
return response.content
import polars as pl
from prefect import flow, task
@task(retries=3, retry_delay_seconds=60)
def extract_data(path: str) -> pl.LazyFrame:
return pl.scan_parquet(path)
@task
def transform_data(lf: pl.LazyFrame) -> pl.LazyFrame:
return lf.filter(pl.col("status") == "active").select(
pl.col("id"),
pl.col("value").cast(pl.Float64),
)
@flow(log_prints=True)
def etl_pipeline(input_path: str, output_path: str) -> None:
raw = extract_data(input_path)
transformed = transform_data(raw)
transformed.collect().write_parquet(output_path)
| Need | Tool/Approach | |------|---------------| | DataFrames (analytics) | Polars (lazy mode) | | DataFrames (compatibility) | pandas (explicit choice) | | Local SQL analytics | DuckDB | | Columnar interchange | Apache Arrow | | HTTP client | httpx (with timeouts) | | Web API | FastAPI + Pydantic v2 | | Task orchestration | Prefect | | Package management | uv only | | Type checking | pyright (strict mode) | | Linting + formatting | ruff |
| Workload | Model | |----------|-------| | I/O-bound, many connections | asyncio | | CPU-bound, parallelizable | multiprocessing | | CPU-bound, need shared state | threading (with locks) | | Mixed I/O + CPU | ProcessPoolExecutor from async |
except: — Always catch specific exceptionsasyncio.TaskGroup for lifecycle managementNone and initialize inside functionpyproject.toml + lockfileimport pytest
from hypothesis import given, strategies as st
# Unit test for logic
def test_normalize_email() -> None:
assert normalize_email("USER@Example.COM") == "user@example.com"
# Property-based test for invariants
@given(st.emails())
def test_email_normalization_is_idempotent(email: str) -> None:
normalized = normalize_email(email)
assert normalize_email(normalized) == normalized
# Integration test with real dependencies
@pytest.mark.integration
async def test_user_creation_flow(test_db: Database) -> None:
user = await create_user(test_db, email="test@example.com")
assert user.id is not None
For comprehensive coverage of specific topics, see:
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer