This file provides guidance to AI assistants when working with this repository.
Prefect is a workflow orchestration platform that coordinates and observes any data pipeline. It provides an SDK for building workflows and a server/cloud backend for orchestration.
Components:
src/prefect/(@src/prefect/, @tests/): Core SDK - flows, tasks, states, deploymentssrc/prefect/engine.py(@src/prefect/engine.py): Engine - orchestration entrypointsrc/prefect/client/(@src/prefect/client/, @tests/client/): Client SDK - client, schemas, utilitiessrc/prefect/server/(@src/prefect/server/, @tests/server/): Orchestration server - API, database, schedulingsrc/integrations/(@src/integrations/: External service integrations
uv sync # Install dependencies
uv run --extra aws repros/1234.py # Run repro related to prefect-aws
uv run pytest tests/ # Run tests
uv run pytest -n4 # Run tests in parallel
uv run pytest tests/some_file.py -k test_name # Run specific test
prefect server start # Start local server
prefect config view # Inspect configuration- FastAPI for REST APIs
- Pydantic v2 for validation
- SQLAlchemy 2.0 async ORM
- Alembic for migrations
- PostgreSQL/SQLite databases
- use
prefect config viewto check your current profile - run
prefect server startin the background if needed
- Python 3.10+ with modern typing (
list[int],T | None) - Private implementation details (
_private_method) - No public API changes without approval
- Use
uvfor dependency management, notpip
- Directory structure mirrors source code
- Run affected tests after changes:
uv run pytest tests/module/ - Tests require deterministic behavior
- Mock external dependencies
- Create repros in
repros/directory (gitignored) - Name files by issue number:
repros/1234.py(only create one file per issue) - Reproduce before fixing
- Add unit tests for fixes
- DO NOT delete files from
repros/directory after reproducing the issue unless asked
- Start with "closes #1234" if resolving issue
- Brief summary: "this PR {changes}"
- Details in
<details>tag - Include relevant links
- GitHub issues are used for tracking issues (use the
ghcli) - Pre-commit hooks required (never use
--no-verify) - Dependencies: updates to client-side deps in
@pyproject.tomlrequire parallel changes ing@client/pyproject.toml - AGENTS.md always symlinked to CLAUDE.md
- the redis lease storage lives in @src/integrations/prefect-redis/