Documentation Index
Fetch the complete documentation index at: https://prefect-bd373955-pytest-markdown.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Set up a development environment
First, download the source code and install an editable copy of the Prefect Python package:ruff check and ruff format.
After installation, you can run the test suite with pytest:
Developer tooling
The Prefect CLI provides several helpful commands to aid development. Start all services with hot-reloading on code changes (requires installation of UI dependencies):UI development
Developing the Prefect UI requires installation of npm. We recommend using nvm to manage Node.js versions. Once installed, runnvm use from the root of the Prefect repository to initialize the proper version of npm and node.
Start a development UI that reloads on code changes:
prefect server start):
Docs development
We use Mintlify to host and build the documentation. The main branch of the prefecthq/prefect GitHub repository is used to build the Prefect 3.0rc docs at docs-3.prefect.io temporarily. The 2.x docs are hosted at docs.prefect.io and built from the 2.x branch of prefecthq/prefect. Make sure you have a recent version of Node.js installed. We recommend using nvm to manage Node.js versions.- Clone this repository.
- Run
cd docsto navigate to the docs directory. - Run
nvm use nodeto use the correct Node.js version. - Run
npm i -g mintlifyto install Mintlify. - Run
mintlify devto start the development server.
http://localhost:3000.
See the Mintlify documentation for more information on how install Mintlify, build previews, and use Mintlify’s features while writing docs.
.mdx files are Markdown files that can contain JavaScript and React components. They are used to create interactive documentation.
Add database migrations
To make changes to a table, first update the SQLAlchemy model insrc/prefect/server/database/orm_models.py. For example,
to add a new column to the flow_run table, add a new column to the FlowRun model:
PREFECT_API_DATABASE_CONNECTION_URL is set to.
See how to set the database connection URL for
each database type.
To generate a new migration file, run:
add_flow_run_new_columnadd_flow_run_new_column_idxrename_flow_run_old_column_to_new_column
--autogenerate flag automatically generates a migration file based on the changes to the models.
The new migration is in the src/prefect/server/database/migrations/versions/ directory. Each database type has its
own subdirectory. For example, the SQLite migrations are stored in src/prefect/server/database/migrations/versions/sqlite/.
After you inspect the migration file, you can apply the migration to your database by running:
MIGRATION-NOTES.md to
document your additions.