- Home
- Skills
- Skillcreatorai
- Ai Agent Skills
- Python Development
python-development_skill
- Python
620
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill skillcreatorai/ai-agent-skills --skill python-development- SKILL.md2.9 KB
Overview
This skill teaches modern Python development for Python 3.12+ with practical patterns for Django/FastAPI services, async code, and production-ready projects. It focuses on typing, project layout, testing, and tooling that improve reliability and developer productivity. Use it to build APIs, data pipelines, or automation with clear, maintainable code.
How this skill works
It inspects and applies idiomatic project structure, pyproject.toml configuration, and recommended linters/type checkers (ruff, mypy). It demonstrates typed code patterns, async primitives, FastAPI endpoints, and testing approaches using pytest and AsyncMock. It highlights production best practices like using pathlib, Pydantic/dataclasses, and async context management for resources.
When to use it
- Starting a new Python 3.12+ project (library, service, CLI).
- Building HTTP APIs with FastAPI or integrating async I/O.
- Implementing strict static typing and runtime validation with Pydantic.
- Setting up CI with linting, formatting, and type checks.
- Writing async tests and mocking async dependencies.
Best practices
- Use a src/ layout and declare requires-python >=3.12 in pyproject.toml.
- Enforce linting and formatting with ruff and set mypy strict mode for types.
- Prefer pathlib.Path for file paths and contextlib.asynccontextmanager for async resources.
- Model external data with Pydantic or dataclasses and keep validation close to boundaries.
- Use asyncio.gather for concurrent I/O tasks and stream large files with async iterators.
Example use cases
- Create a FastAPI user service with Pydantic request/response models and dependency-injected DB access.
- Implement an async data ingestion pipeline that fetches many URLs concurrently and streams large files to storage.
- Set up a library with strict type coverage using mypy and ruff, plus unit and async tests with pytest and AsyncMock.
- Build automation scripts that use pathlib and type hints for predictable, testable behavior.
FAQ
Target Python 3.12 or later to use new typing features and language improvements described here.
When should I use Pydantic vs dataclasses?
Use Pydantic for runtime validation and parsing of external input (API requests). Use dataclasses for simple internal data structures where validation is not required.
How do I test async code?
Use pytest with asyncio support and AsyncMock to mock async dependencies. Mark async tests with pytest.mark.asyncio and assert calls with awaitable mocks.