pyproject-modern-python

Configure modern Python projects with pyproject.toml, hatchling, and uv.

1|2|Updated Dec 4, 2025
One-click install
npx skills add https://github.com/co-labs-co/context-harness --skill pyproject-modern-python
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pyproject-modern-python
Source: https://github.com/co-labs-co/context-harness/tree/main/.opencode/skill/pyproject-modern-python
Command: npx skills add https://github.com/co-labs-co/context-harness --skill pyproject-modern-python

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Modern Python packaging often relies on legacy setup.py configurations. This skill guides users to adopt pyproject.toml with PEP 621 metadata, along with hatchling for builds, hatch-vcs for Git-based versioning, uv for dependency management, and a src-layout structure.

Core Features & Use Cases

  • PEP 621 metadata: centralize project metadata in pyproject.toml.
  • Hatchling + hatch-vcs: enabling Git-based versioning and modern builds.
  • uv integration: lockfiles and deterministic environments for CI.
  • Use Case: Convert an existing setup.py project to pyproject.toml and configure CI for packaging and testing.

Quick Start

Install and initialize a new Python project using pyproject-modern-python to configure pyproject.toml, build, and packaging tooling.

Frequently Asked Questions about pyproject-modern-python

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

FAQPage Schema
How do I migrate an existing setup.py project to pyproject.toml?

Migrating from setup.py to pyproject.toml involves centralizing your project metadata using PEP 621 standards. This skill configures the new file, replaces legacy scripts with hatchling builds, and sets up a src-layout package structure automatically.

What is the best way to configure hatchling and hatch-vcs for Python packaging?

Configuring hatchling with hatch-vcs enables modern Python builds driven by Git-based versioning. This skill sets up the build backend in pyproject.toml, linking your project version dynamically to Git tags for automated release tagging.

Does pyproject.toml support uv lockfile management for CI pipelines?

Yes, pyproject.toml supports uv lockfile management for deterministic CI environments. This skill integrates uv to generate lockfiles, manage optional dependencies, and configure dependency-groups to ensure consistent testing and packaging pipelines.

When do I need a src-layout package structure for a Python project?

A src-layout package structure is needed to prevent import errors during testing and ensure clean package builds. This skill configures the src-layout within your pyproject.toml, separating source code from project root to avoid accidental local imports.

Can I define optional dependencies and dependency-groups in pyproject.toml?

You can define optional dependencies and dependency-groups directly in pyproject.toml using PEP 621 metadata. This skill structures these dependency configurations, allowing precise environment management for development and production contexts.

Why should I use PEP 621 metadata instead of setup.py for Python packaging?

PEP 621 metadata provides a standardized, declarative way to define project information in pyproject.toml, replacing imperative setup.py scripts. This approach centralizes configuration, simplifies maintenance, and ensures compatibility with modern build tools like hatchling.