Skip to content

Commit c5719c4

Browse files
chore(server): Migrate from poetry to uv
- Replace `build-system` with `maturin` - Update docker build for testbed & server - Update `make.py` to rely on `uv` - Delegate to `make.py` building of rust lib during ci install Co-authored-by: Marcos Medrano <786907+mmmarcos@users.noreply.github.com>
1 parent 28607d0 commit c5719c4

32 files changed

Lines changed: 1536 additions & 3237 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Cargo.lock @Scille/rust-code-owners
3535
/server/parsec/ @Scille/python-code-owners
3636
/server/tests/ @Scille/python-code-owners
3737
pyproject.toml @Scille/python-code-owners
38-
poetry.lock @Scille/python-code-owners
38+
uv.lock @Scille/python-code-owners
3939
readthedocs.yml @Scille/python-code-owners
4040
mypy.ini @Scille/python-code-owners
4141
setup.cfg @Scille/python-code-owners

.github/actions/setup-python-poetry/action.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ updates:
99
- package-ecosystem: github-actions
1010
directories:
1111
- /
12-
- /.github/actions/setup-python-poetry
1312
- /.github/actions/use-pre-commit
1413
pull-request-branch-name:
1514
separator: "-"
@@ -150,7 +149,7 @@ updates:
150149
open-pull-requests-limit: 5
151150
rebase-strategy: disabled
152151

153-
- package-ecosystem: pip
152+
- package-ecosystem: uv
154153
directory: /server
155154
versioning-strategy: increase-if-necessary
156155
ignore:

.github/filters/ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,10 @@ python-server: &python-server
8888
- server/parsec/**
8989
- server/tests/**
9090
- make.py
91-
- server/build.py
9291

9392
python-dependencies-project: &python-dependencies-project
9493
- server/pyproject.toml
95-
- server/poetry.lock
94+
- server/uv.lock
9695
- server/setup.cfg
9796

9897
python-changes: &python-changes
@@ -101,7 +100,6 @@ python-changes: &python-changes
101100

102101
# The python jobs need to be run when:
103102
# - The ci workflow has changed
104-
# - The action `setup-python-poetry` has changed
105103
# - The rust has changed
106104
# - The dependencies
107105
# - The pure code has changed
@@ -169,6 +167,6 @@ docs-jobs:
169167
- docs/locale/**.po
170168
- docs/conf.py
171169
- docs/pyproject.toml
172-
- docs/poetry.lock
170+
- docs/uv.lock
173171
- docs/Makefile
174172
- docs/**.rst

.github/filters/codeql.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
codeql-workflow: &codeql-workflow .github/workflows/codeql.yml
22

3-
setup-python-action: &setup-python-action .github/actions/setup-python-poetry/**
4-
53
python: &python
64
- parsec/**
75
- tests/**
8-
- build.py
96
- make.py
107

118
python-dependencies-project: &python-dependencies-project
12-
- poetry.lock
9+
- uv.lock
1310
- pyproject.toml
1411

1512
# The python analyze job need to be run when:
@@ -18,7 +15,6 @@ python-dependencies-project: &python-dependencies-project
1815
# - The codeql workflow is changed
1916
python-analyze:
2017
- *codeql-workflow
21-
- *setup-python-action
2218
- *python
2319
- *python-dependencies-project
2420

.github/workflows/ci-docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343

4444
- name: Install uv
4545
uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
46+
with:
47+
version: 0.11.29 # marker:uv-version
4648
timeout-minutes: 5
4749

4850
- name: Install gettext (required by powrap)

.github/workflows/ci-python.yml

Lines changed: 16 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ concurrency:
2626
cancel-in-progress: true
2727

2828
env:
29-
poetry-version: 2.2.1
3029
pytest-base-args: >-
3130
--log-level=DEBUG
3231
--durations=10
@@ -35,6 +34,7 @@ env:
3534
-x
3635
postgresql-version: 16
3736
libparsec-cache-version: 1
37+
UV_EXTRA_ARGS: --verbose
3838

3939
permissions:
4040
contents: read
@@ -113,47 +113,32 @@ jobs:
113113
postgresql-${{ env.postgresql-version }}
114114
timeout-minutes: 5
115115

116-
- uses: ./.github/actions/setup-python-poetry
117-
id: setup-python
116+
- name: Install uv
117+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
118118
with:
119-
poetry-version: ${{ env.poetry-version }}
120-
project-path: ./server
121-
timeout-minutes: 10
122-
123-
# libparsec is slow to compile, so we save it in cache and skip the
124-
# compilation entirely if the Rust code hasn't changed !
119+
working-directory: server
120+
version: 0.11.29 # marker:uv-version
121+
timeout-minutes: 5
125122

126123
# Key cache contains a hash of all the files that are used to produce _parsec.so
127124
# Hence if we have a cache hit we know that there is no need for a rebuild !
128-
- name: Setup cache-key
125+
- name: Setup rust cache-key
129126
id: cache-key
130-
run: echo "key=libparsec-v${{ env.libparsec-cache-version }}-${{ steps.runner-specs.outputs.os }}-${{ steps.runner-specs.outputs.release }}-${{ hashFiles('make.py', 'server/build.py', 'server/src/**', 'server/Cargo.toml', 'libparsec/**', 'rust-toolchain.toml', 'Cargo.toml', 'Cargo.lock') }}-no-bundle-extra-shared-libraries" >> $GITHUB_OUTPUT
127+
run: echo "key=libparsec-v${{ env.libparsec-cache-version }}-${{ steps.runner-specs.outputs.os }}-${{ steps.runner-specs.outputs.release }}-${{ hashFiles('make.py', 'server/src/**', 'server/Cargo.toml', 'libparsec/**', 'rust-toolchain.toml', 'Cargo.toml', 'Cargo.lock') }}-no-bundle-extra-shared-libraries" >> $GITHUB_OUTPUT
131128
shell: bash
132129

133-
- name: Restore libparsec if Rust hasn't been modified
134-
id: cache-libparsec
135-
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # pin v6.1.0
136-
with:
137-
key: ${{ steps.cache-key.outputs.key }}
138-
path: |
139-
server/parsec/_parsec.*.pyd
140-
server/parsec/_parsec.*.so
141-
# Note `server/parsec.libs/` is not included since we are going to build
142-
# with POETRY_LIBPARSEC_BUNDLE_EXTRA_SHARED_LIBRARIES=false (see below)
143-
timeout-minutes: 2
144-
145130
- name: Setup Rust toolchain
131+
if: (!inputs.style-only)
146132
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # pin v1.17.0
147-
if: steps.cache-libparsec.outputs.cache-hit != 'true'
148133
with:
149134
# We setup the cache by hand, see below
150135
cache: false
151136
rustflags: "" # Set value to prevent default which deny cargo check warnings.
152137
timeout-minutes: 5
153138

154139
- name: Retrieve Rust cache
140+
if: (!inputs.style-only)
155141
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # pin v2.9.1
156-
if: steps.cache-libparsec.outputs.cache-hit != 'true'
157142
with:
158143
# Cache is limited to 10Go (and cache is ~700mo per platform !). On top of that.
159144
# cache is only shared between master and the PRs (and not across PRs).
@@ -166,20 +151,17 @@ jobs:
166151
- name: Install python deps
167152
shell: bash -ex {0}
168153
run: |
169-
poetry --directory ./server env info
170-
if ${{ env.SKIP_EXT_BUILD }}; then export POETRY_LIBPARSEC_BUILD_STRATEGY=no_build; fi
154+
if ${{ env.SKIP_EXT_BUILD }}; then export PYTHON_LIBPARSEC_BUILD_STRATEGY=no_build; fi
171155
python make.py python-ci-install
172156
173-
# Make sure POETRY_LIBPARSEC_BUNDLE_EXTRA_SHARED_LIBRARIES=false worked
157+
# Make sure install does not tries to bundle shared libs by default
174158
if [ -d "./server/parsec.libs" ] && [ -n "$(ls -A ./server/parsec.libs)" ];
175159
then
176160
echo "::error title=Directory './server/parsec.libs' is not empty::Extra libs disabled but './server/parsec.libs/' is not empty: " ./server/parsec.libs/*
177161
exit 1
178162
fi
179163
env:
180-
SKIP_EXT_BUILD: ${{ steps.cache-libparsec.outputs.cache-hit == 'true' || inputs.style-only }}
181-
# No need to bundle given we compile and run on the same machine
182-
POETRY_LIBPARSEC_BUNDLE_EXTRA_SHARED_LIBRARIES: false
164+
SKIP_EXT_BUILD: ${{ inputs.style-only }}
183165
timeout-minutes: 20
184166

185167
- name: Install pre-commit
@@ -191,7 +173,7 @@ jobs:
191173
- name: Check python code style
192174
shell: bash -eux {0}
193175
run: |
194-
poetry -P server run ruff version
176+
uv --project server run --locked ruff version
195177
for step in ruff-format ruff-check pyright ${{ !inputs.style-only && 'sqlfluff sqlfluff-in-python' || '' }}; do
196178
python \
197179
${{ steps.pre-commit.outputs.install-path }} \
@@ -204,31 +186,15 @@ jobs:
204186
done
205187
timeout-minutes: 10
206188

207-
# We only save the libparsec lib when:
208-
# - We are not in a github queue branch (they're a one time use so caching won't help)
209-
# - We haven't already cached it.
210-
- name: Save cached libparsec to be reused on later call
211-
if: >-
212-
(!inputs.style-only)
213-
&& steps.cache-libparsec.outputs.cache-hit != 'true'
214-
&& !contains(github.ref, 'gh-readonly-queue')
215-
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # pin v6.1.0
216-
with:
217-
key: ${{ steps.cache-key.outputs.key }}
218-
path: |
219-
server/parsec/_parsec.*.pyd
220-
server/parsec/_parsec.*.so
221-
timeout-minutes: 2
222-
223189
- name: Basic tests
224190
if: (!inputs.style-only)
225-
run: poetry run pytest ${{ env.pytest-base-args }} tests -n auto
191+
run: uv run --locked pytest ${{ env.pytest-base-args }} tests -n auto
226192
timeout-minutes: 10
227193
working-directory: server
228194

229195
- name: PostgreSQL tests
230196
if: (!inputs.style-only)
231-
run: poetry run pytest ${{ env.pytest-base-args }} tests -n auto --postgresql
197+
run: uv run --locked pytest ${{ env.pytest-base-args }} tests -n auto --postgresql
232198
env:
233199
PGINSTALLATION: /usr/lib/postgresql/${{ env.postgresql-version }}/bin
234200
working-directory: server

.github/workflows/ci-rust.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ concurrency:
3636
cancel-in-progress: true
3737

3838
env:
39-
poetry-version: 2.1.1
4039
CARGO_CI_FLAGS: --locked --profile=ci-rust
4140
CARGO_NEXTEST_CI_FLAGS: --profile=ci --locked --cargo-profile=ci-rust
4241
WINFSP_VERSION: 2.1.25156

.github/workflows/ci-web.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ env:
2828
node-version: 24.18.0
2929
wasm-pack-version: 0.12.1
3030
libparsec-cache-version: 1
31+
UV_EXTRA_ARGS: --verbose
3132

3233
permissions:
3334
contents: read
@@ -61,7 +62,7 @@ jobs:
6162
uses: ./.github/actions/system-info
6263
timeout-minutes: 1
6364

64-
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # pin v7.0.0
65+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # pin v7.0.0
6566
with:
6667
node-version: ${{ env.node-version }}
6768
cache: npm
@@ -311,7 +312,7 @@ jobs:
311312
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # pin v7.0.1
312313
timeout-minutes: 2
313314

314-
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # pin v7.0.0
315+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # pin v7.0.0
315316
with:
316317
node-version: ${{ env.node-version }}
317318
cache: npm

.github/workflows/codeql.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ jobs:
3131
python-analyze:
3232
name: 🐍 Python static code Analysis
3333
runs-on: ubuntu-24.04
34-
env:
35-
poetry-version: 2.2.1
3634
steps:
3735
- name: Checkout repository
3836
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # pin v7.0.1
3937
timeout-minutes: 5
4038

41-
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # pin v4.0.2
39+
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # pin v4.0.2
4240
id: changes
4341
with:
4442
filters: .github/filters/codeql.yml
@@ -70,21 +68,17 @@ jobs:
7068
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
7169
# queries: security-extended,security-and-quality
7270

73-
- uses: ./.github/actions/setup-python-poetry
74-
if: steps.should-run-python-analysis.outputs.run == 'true'
75-
id: setup-python
71+
- name: Install uv
72+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
7673
with:
77-
poetry-version: ${{ env.poetry-version }}
78-
project-path: ./server
74+
working-directory: server
75+
version: 0.11.29 # marker:uv-version
76+
timeout-minutes: 5
7977

8078
- name: Install python deps
8179
if: steps.should-run-python-analysis.outputs.run == 'true'
82-
run: |
83-
poetry install
84-
poetry run sh -c 'echo "CODEQL_PYTHON=$(which python)"' >> $GITHUB_ENV
80+
run: uv run --locked sh -c 'echo "CODEQL_PYTHON=$(which python)"' | tee -a $GITHUB_ENV
8581
working-directory: server
86-
env:
87-
POETRY_LIBPARSEC_BUILD_STRATEGY: no_build
8882

8983
- name: Perform CodeQL Analysis
9084
if: steps.should-run-python-analysis.outputs.run == 'true'
@@ -100,7 +94,7 @@ jobs:
10094
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # pin v7.0.1
10195
timeout-minutes: 5
10296

103-
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # pin v4.0.2
97+
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # pin v4.0.2
10498
id: changes
10599
with:
106100
filters: .github/filters/codeql.yml

0 commit comments

Comments
 (0)