build-python-library
Installation
SKILL.md
Build Python Library
Implements pip-installable Python libraries by scaffolding the project structure, building core abstractions with adapters, and verifying each module with pytest before proceeding.
Workflow
- Scaffold the project — create src layout, pyproject.toml, package structure, and py.typed marker. See SCAFFOLDING.md.
- Define the public API — write
__init__.pywith explicit exports and__all__. Only types and functions users need. See SCAFFOLDING.md. - Implement core abstractions — build protocols/ABCs, data classes, and shared types that all concrete implementations depend on. See PATTERNS.md.
- Test core abstractions — write pytest tests for core types and protocols. Run
pytestand verify zero failures before proceeding. See TESTING.md. - Implement concrete modules — build one module at a time (proxy wrappers, provider clients, adapters). See PATTERNS.md.
- Test each module before the next — write tests for the module just implemented. Run
pytestand verify zero failures before starting the next module. See TESTING.md. - Install and verify — run
pip install -e ".[dev]"and verify the package imports correctly from a clean script. See TESTING.md. - Run full test suite — run
pytest -vand verify all tests pass, then runpython -c "from packagename import ..."to verify public API. See TESTING.md.
Self-review checklist
Before delivering, verify ALL: