build-python-library

Build pip-installable Python libraries with typed APIs and pytest verification.

4|Updated Feb 23, 2026
One-click install
npx skills add https://github.com/npow/claude-skills --skill build-python-library
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: build-python-library
Source: https://github.com/npow/claude-skills/tree/main/build-python-library
Command: npx skills add https://github.com/npow/claude-skills --skill build-python-library

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill turns a Python library idea into a structured, pip-installable package with clear APIs, optional integrations, type safety, and verified tests.

Core Features & Use Cases

  • Project Scaffolding: Creates a standards-based src layout with pyproject.toml, public API exports, optional dependency groups, and a py.typed marker.
  • Library Implementation: Guides proxy wrappers, provider-agnostic protocols, async and sync interfaces, lazy imports, dataclasses, and framework adapters.
  • Testing and Verification: Enforces test-per-module development, deterministic mocks, pytest validation, installation checks, and public API import verification.
  • Use Case: Build a typed Python middleware package that wraps multiple vector stores, keeps framework dependencies optional, and verifies each adapter with isolated pytest tests.

Quick Start

Use the build-python-library skill to scaffold and implement a pip-installable Python package for the requested functionality, including tests and installation verification.

Frequently Asked Questions about build-python-library

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a pip-installable Python library with optional dependencies?

To build a pip-installable Python library, use a standards-based src layout with a pyproject.toml file that defines optional dependency groups for isolated integrations. This structure ensures reliable installation and clean public API exports.

What is the best way to configure type safety and public exports for a Python SDK?

Configuring type safety for a Python SDK requires including a py.typed marker and defining explicit public API exports. This approach ensures consumers can utilize static type checking while maintaining clear, lazily imported module boundaries.

How do I set up pytest verification for a Python middleware package?

Pytest verification for a Python middleware package is set up by enforcing test-per-module development with deterministic mocks. This validates each provider adapter through isolated tests and public API import checks.

Can I build a Python library that supports both async and sync interfaces with framework adapters?

Yes, you can build a Python library supporting both async and sync interfaces using proxy wrappers and provider-agnostic protocols. This allows framework adapters to handle multiple vector stores while keeping dependencies optional.

Does this Python package scaffolding approach validate installation and public API imports?

Yes, this Python package scaffolding approach validates installation and public API imports. It enforces installation checks and pytest validation to ensure the generated package is installable and its explicit exports function correctly.

When should I use a src layout over a flat layout for a Python library?

You should use a src layout over a flat layout for a Python library when you need strict separation between package code and tests. This prevents implicit imports during pytest validation and ensures installation checks accurately reflect the packaged structure.