Implementation:PrefectHQ Prefect Pyproject Configuration
| Knowledge Sources | |
|---|---|
| Domains | Packaging, Configuration, Build_System |
| Last Updated | 2026-02-09 22:00 GMT |
Overview
Central project configuration for the Prefect Python package, defining build system, dependencies, entry points, and development tool settings.
Description
The pyproject.toml file is the single source of truth for the Prefect package metadata and build configuration. It uses hatchling as the build backend with versioningit for dynamic Git-based versioning. The file declares approximately 60 core dependencies split between server dependencies (SQLAlchemy, Alembic, aiosqlite, asyncpg) and client dependencies (httpx, Pydantic, FastAPI, anyio). It also defines optional integration extras (aws, gcp, docker, kubernetes, dbt), dependency groups for development (dev, perf, benchmark, type-checking), the `prefect` CLI entry point, and tool configurations for pytest, mypy, ruff, codespell, coverage, and uv.
Usage
Reference this file when adding or updating Prefect dependencies, configuring the build pipeline, modifying the CLI entry point, or adjusting development tool settings. This is the authoritative source for what gets published to PyPI as the `prefect` package.
Code Reference
Source Location
- Repository: PrefectHQ_Prefect
- File: pyproject.toml
- Lines: 1-372
Signature
[build-system]
requires = ["hatchling", "versioningit"]
build-backend = "hatchling.build"
[project]
name = "prefect"
dynamic = ["version"]
description = "Workflow orchestration and management."
requires-python = ">=3.10,<3.15"
license = { text = "Apache-2.0" }
[project.scripts]
prefect = "prefect.cli:app"
[project.optional-dependencies]
aws = [...]
gcp = [...]
docker = [...]
kubernetes = [...]
dbt = [...]
Import
# Not importable; consumed by pip, hatch, and build tools
pip install prefect
pip install prefect[aws,docker,kubernetes]
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| build-system | table | Yes | Build backend (hatchling) and requirements |
| project.name | string | Yes | Package name on PyPI ("prefect") |
| project.dependencies | array | Yes | Core runtime dependencies (~60 packages) |
| project.optional-dependencies | table | No | Extra dependency groups (aws, gcp, docker, etc.) |
| project.scripts | table | No | CLI entry points (prefect = prefect.cli:app) |
| tool.pytest | table | No | pytest configuration and markers |
| tool.ruff | table | No | Ruff linter/formatter rules |
Outputs
| Name | Type | Description |
|---|---|---|
| prefect package | wheel/sdist | Built Python distribution published to PyPI |
| prefect CLI | entry point | Command-line interface accessible via `prefect` command |
Usage Examples
Installing Prefect with Extras
# Install base package
pip install prefect
# Install with cloud provider integrations
pip install prefect[aws,gcp]
# Install with Docker and Kubernetes support
pip install prefect[docker,kubernetes]
# Install with dbt integration
pip install prefect[dbt]
# Install development dependencies
pip install -e ".[dev]"
Adding a New Dependency
# In pyproject.toml, add to the dependencies list:
dependencies = [
# ... existing dependencies ...
"new-package>=1.0.0,<2.0.0",
]