Skip to content

Commit ed3c9aa

Browse files
Migrate to pyproject.toml (PrefectHQ#17116)
Co-authored-by: Alex Streed <desertaxle@users.noreply.github.com> Co-authored-by: Alex Streed <alex.s@prefect.io>
1 parent 1c38054 commit ed3c9aa

57 files changed

Lines changed: 751 additions & 3849 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codespellrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[codespell]
2-
skip = .git,*.pdf,*.svg,versioneer.py,package-lock.json,_vendor,*.css,.codespellrc,tests/utilities/test_text.py
2+
skip = .git,*.pdf,*.svg,package-lock.json,_vendor,*.css,.codespellrc,tests/utilities/test_text.py
33
# from https://github.com/PrefectHQ/prefect/pull/10813#issuecomment-1732676130
44
ignore-regex = .*lazy=\"selectin\"|.*e import Bloc$|America/Nome
55

.dockerignore

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@ env/
3030
venv/
3131

3232
# Documentation artifacts
33-
docs/
3433
site/
3534

3635
# UI artifacts
3736
src/prefect/server/ui/*
3837
ui/node_modules
39-
ui-v2/
4038

4139
# Databases
4240
*.db
@@ -50,9 +48,3 @@ dask-worker-space/
5048
# Editors
5149
.idea/
5250
.vscode/
53-
54-
# Other
55-
tests/
56-
compat-tests/
57-
benches/
58-
build/

.github/workflows/api-compatibility-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
steps:
3838
- uses: actions/checkout@v4
3939
with:
40-
# Versioneer only generates correct versions with a full fetch
40+
# Versioningit only generates correct versions with a full fetch
4141
fetch-depth: 0
4242
persist-credentials: false
4343
submodules: true

.github/workflows/benchmarks.yaml

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,15 @@ jobs:
3636
persist-credentials: false
3737
fetch-depth: 0
3838

39-
- name: Set up Docker Buildx
40-
if: ${{ matrix.build-docker-images }}
41-
uses: docker/setup-buildx-action@v3
39+
- name: Set up uv
40+
uses: astral-sh/setup-uv@v5
4241
with:
43-
driver-opts: image=moby/buildkit:v0.12.5
42+
python-version: "3.12"
43+
enable-cache: true
44+
cache-dependency-glob: "pyproject.toml"
4445

45-
- name: Set up Python 3.10
46-
uses: actions/setup-python@v5
47-
with:
48-
python-version: "3.10"
49-
50-
- name: UV Cache
51-
uses: actions/cache@v4
52-
id: cache-uv
53-
with:
54-
path: ~/.cache/uv
55-
key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt') }}
56-
57-
- name: Install packages
58-
run: |
59-
python -m pip install -U uv
60-
uv pip install --upgrade --system -e .[dev]
46+
- name: Install the project
47+
run: uv sync --group benchmark --compile-bytecode
6148

6249
- name: Prepare benchmark comparisons
6350
# Note: We use a "cache" instead of artifacts because artifacts are not available
@@ -76,7 +63,7 @@ jobs:
7663
7764
- name: Start server
7865
run: |
79-
PREFECT_HOME=$(pwd) prefect server start&
66+
PREFECT_HOME=$(pwd) uv run prefect server start&
8067
PREFECT_API_URL="http://127.0.0.1:4200/api" ./scripts/wait-for-server.py
8168
8269
# TODO: Replace `wait-for-server` with dedicated command
@@ -103,7 +90,7 @@ jobs:
10390
sanitized_uniquename="${uniquename//[^a-zA-Z0-9_\-]/_}"
10491
10592
PREFECT_API_URL="http://127.0.0.1:4200/api" \
106-
python -m benches \
93+
uv run python -m benches \
10794
--ignore=benches/bench_import.py \
10895
--timeout=180 \
10996
--benchmark-save="${sanitized_uniquename}" \

.github/workflows/codspeed-benchmarks.yaml

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ env:
66
on:
77
pull_request:
88
paths:
9-
- .github/workflows/benchmarks.yaml
9+
- .github/workflows/codspeed-benchmarks.yaml
1010
- .github/workflows/python-tests.yaml
1111
- "src/prefect/**/*.py"
1212
- requirements.txt
@@ -37,33 +37,19 @@ jobs:
3737
persist-credentials: false
3838
fetch-depth: 0
3939

40-
- name: Set up Docker Buildx
41-
if: ${{ matrix.build-docker-images }}
42-
uses: docker/setup-buildx-action@v3
43-
with:
44-
driver-opts: image=moby/buildkit:v0.12.5
45-
46-
- name: Set up Python 3.12
47-
uses: actions/setup-python@v5
40+
- name: Set up uv
41+
uses: astral-sh/setup-uv@v5
4842
with:
4943
python-version: "3.12"
50-
51-
- name: UV Cache
52-
uses: actions/cache@v4
53-
id: cache-uv
54-
with:
55-
path: ~/.cache/uv
56-
key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt') }}
57-
58-
- name: Install packages
59-
run: |
60-
python -m pip install -U uv
61-
uv pip install --upgrade --system .[dev] pytest-codspeed
62-
uv pip uninstall --system pytest-benchmark
44+
enable-cache: true
45+
cache-dependency-glob: "pyproject.toml"
46+
47+
- name: Install the project
48+
run: uv sync --group benchmark --compile-bytecode
6349

6450
- name: Start server
6551
run: |
66-
PREFECT_HOME=$(pwd) prefect server start&
52+
PREFECT_HOME=$(pwd) uv run prefect server start&
6753
PREFECT_API_URL="http://127.0.0.1:4200/api" ./scripts/wait-for-server.py
6854
6955
# TODO: Replace `wait-for-server` with dedicated command
@@ -75,7 +61,7 @@ jobs:
7561
PREFECT_API_URL: "http://127.0.0.1:4200/api"
7662
with:
7763
run: >
78-
pytest
64+
uv run pytest
7965
benches/bench_import.py
8066
benches/bench_tasks.py
8167
benches/bench_flows.py::bench_flow_decorator

.github/workflows/integration-package-tests.yaml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,20 @@ jobs:
6262
with:
6363
persist-credentials: false
6464

65-
- name: Set up Python ${{ matrix.python-version }}
66-
uses: actions/setup-python@v5
67-
id: setup_python
65+
- name: Set up uv and Python ${{ matrix.python-version }}
66+
uses: astral-sh/setup-uv@v5
6867
with:
68+
enable-cache: true
6969
python-version: ${{ matrix.python-version }}
70-
71-
- name: UV Cache
72-
# Manually cache the uv cache directory
73-
# until setup-python supports it:
74-
# https://github.com/actions/setup-python/issues/822
75-
uses: actions/cache@v4
76-
id: cache-uv
77-
with:
78-
path: ~/.cache/uv
79-
key: uvcache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles(format('src/integrations/{0}/pyproject.toml', matrix.package)) }}
70+
cache-dependency-glob: "pyproject.toml"
8071

8172
- name: Install dependencies
8273
working-directory: src/integrations/${{ matrix.package }}
83-
# install uv, the package, and bleeding edge prefect
84-
run: |
85-
python -m pip install -U uv
86-
uv pip install --upgrade --system -e .[dev]
87-
uv pip install --upgrade --system -e ../../../
74+
run: uv sync --extra dev
8875

8976
- name: Build dev docker image
9077
if: matrix.package == 'prefect-docker'
91-
run : prefect dev build-image
78+
run : uv run prefect dev build-image
9279

9380
- name: Start redis
9481
if: matrix.package == 'prefect-redis'
@@ -105,7 +92,7 @@ jobs:
10592
PREFECT_API_DATABASE_CONNECTION_URL: "sqlite+aiosqlite:///./orion-tests.db"
10693
working-directory: src/integrations/${{ matrix.package }}
10794
run: >
108-
pytest tests
95+
uv run pytest tests
10996
--numprocesses auto
11097
--maxprocesses 4
11198
--dist worksteal
@@ -117,4 +104,4 @@ jobs:
117104
PREFECT_API_DATABASE_CONNECTION_URL: "sqlite+aiosqlite:///./orion-tests.db"
118105
working-directory: src/integrations/${{ matrix.package }}
119106
run: >
120-
pytest tests
107+
uv run pytest tests

.github/workflows/markdown-tests.yaml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,36 +74,23 @@ jobs:
7474
persist-credentials: false
7575
fetch-depth: 0
7676

77-
- name: Set up Python ${{ matrix.python-version }}
78-
uses: actions/setup-python@v5
79-
id: setup_python
77+
- name: Set up uv
78+
uses: astral-sh/setup-uv@v5
8079
with:
80+
enable-cache: true
8181
python-version: ${{ matrix.python-version }}
82-
83-
- name: UV Cache
84-
# Manually cache the uv cache directory
85-
# until setup-python supports it:
86-
# https://github.com/actions/setup-python/issues/822
87-
uses: actions/cache@v4
88-
id: cache-uv
89-
with:
90-
path: ~/.cache/uv
91-
key: uvcache-markdown-tests-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements-client.txt', 'requirements.txt', 'requirements-dev.txt', 'requirements-markdown.txt') }}
82+
cache-dependency-glob: "pyproject.toml"
9283

9384
- name: Install packages
94-
run: |
95-
python -m pip install -U uv
96-
uv pip install --upgrade -r requirements-markdown-tests.txt
97-
uv pip install --upgrade -e '.[dev]'
98-
uv pip uninstall pytest-benchmark
85+
run: uv sync --group markdown-docs
9986

10087
- name: Start server
10188
run: |
102-
PREFECT_HOME=$(pwd) prefect server start&
103-
PREFECT_API_URL="http://127.0.0.1:4200/api" ./scripts/wait-for-server.py
89+
PREFECT_HOME=$(pwd) uv run prefect server start&
90+
PREFECT_API_URL="http://127.0.0.1:4200/api" uv run ./scripts/wait-for-server.py
10491
10592
- name: Run tests
10693
run: >
107-
PREFECT_API_URL="http://127.0.0.1:4200/api" pytest docs/ --markdown-docs -m markdown-docs
94+
PREFECT_API_URL="http://127.0.0.1:4200/api" uv run pytest docs/ --markdown-docs -m markdown-docs
10895
--numprocesses auto
10996
--maxprocesses 6

.github/workflows/prefect-client.yaml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,18 @@ name: Verify prefect-client build
22

33
on:
44
pull_request:
5-
branches:
6-
- main
75
paths:
86
- client/*
97
- src/prefect/**/*.py
10-
- requirements.txt
11-
- requirements-client.txt
12-
- setup.cfg
8+
- pyproject.toml
139
- .github/workflows/prefect-client.yaml
1410
push:
1511
branches:
1612
- main
1713
paths:
1814
- client/*
1915
- src/prefect/**/*.py
20-
- requirements.txt
21-
- requirements-client.txt
22-
- setup.cfg
16+
- pyproject.toml
2317
- .github/workflows/prefect-client.yaml
2418
workflow_call:
2519
inputs:
@@ -39,16 +33,15 @@ jobs:
3933
steps:
4034
- uses: actions/checkout@v4
4135
with:
42-
# Versioneer only generates correct versions with a full fetch
4336
fetch-depth: 0
4437
persist-credentials: false
4538

46-
- name: Set up Python
47-
uses: actions/setup-python@v5
39+
- name: Set up uv
40+
uses: astral-sh/setup-uv@v5
4841
with:
42+
enable-cache: true
4943
python-version: "3.9"
50-
cache: "pip"
51-
cache-dependency-path: "requirements-client.txt"
44+
cache-dependency-glob: "pyproject.toml"
5245

5346
- name: Create a temp dir to stage our build
5447
run: echo "TMPDIR=$(mktemp -d)" >> $GITHUB_ENV
@@ -59,11 +52,11 @@ jobs:
5952
TMPDIR: ${{ env.TMPDIR }}
6053

6154
- name: Build a binary wheel and a source tarball
62-
run: pip install wheel && python setup.py sdist bdist_wheel
55+
run: uv build
6356
working-directory: ${{ env.TMPDIR }}
6457

6558
- name: Install the built client from the locally built package
66-
run: pip install dist/*.tar.gz
59+
run: uv pip install dist/*.tar.gz
6760
working-directory: ${{ env.TMPDIR }}
6861

6962
- name: Get the version of built `prefect-client`
@@ -74,14 +67,14 @@ jobs:
7467
id: prefect_client_version
7568

7669
- name: Run the smoke test flow using the built client
77-
run: python client/client_flow.py
70+
run: uv run python client/client_flow.py
7871
working-directory: ${{ env.TMPDIR }}
7972
env:
8073
PREFECT_API_KEY: ${{ secrets.PREFECT_CLIENT_SA_API_KEY }}
8174
PREFECT_API_URL: "https://api.prefect.cloud/api/accounts/9b649228-0419-40e1-9e0d-44954b5c0ab6/workspaces/96bd3cf8-85c9-4545-9713-b4e3c3e03466" # sandbox, prefect-client workspace
8275

8376
- name: Install prefect from source
84-
run: pip install .
77+
run: uv pip install .
8578

8679
- name: Get the version of built `prefect`
8780
run: |
@@ -97,7 +90,7 @@ jobs:
9790
fi
9891
9992
- name: Run the smoke test flow again with prefect and prefect-client installed
100-
run: python client/client_flow.py
93+
run: uv run python client/client_flow.py
10194
working-directory: ${{ env.TMPDIR }}
10295
env:
10396
PREFECT_API_KEY: ${{ secrets.PREFECT_CLIENT_SA_API_KEY }}

.github/workflows/python-package.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
- uses: actions/checkout@v4
2121
with:
2222
ref: ${{ github.event.inputs.commit }}
23-
# Versioneer only generates correct versions with a full fetch
2423
fetch-depth: 0
2524
persist-credentials: false
2625

0 commit comments

Comments
 (0)