Skip to content

Commit d1167b9

Browse files
committed
feat: replace poetry with uv for dependency management
Replace poetry with uv for managing Python dependencies and running commands across CI workflow. - Add astral-sh/setup-uv@v5 action to install uv - Replace all poetry run commands with uv run - Remove poetry-specific installation steps - Update Python setup in multiple jobs
1 parent 53aa811 commit d1167b9

File tree

3 files changed

+64
-59
lines changed

3 files changed

+64
-59
lines changed

.github/scripts/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ sudo chmod 0440 /etc/sudoers.d/tester
6565
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
6666
-y --default-toolchain ${RUST_VERSION}
6767

68+
uv sync --all-extras --all-groups
69+
6870
# We also need a relatively recent protobuf-compiler, at least 3.12.0,
6971
# in order to support the experimental `optional` flag.
7072

.github/workflows/ci.yaml

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,14 @@ jobs:
7171
- name: Set up Python 3.10
7272
uses: actions/setup-python@v5
7373
with:
74-
python-version: '3.10'
74+
python-version: "3.10"
75+
76+
- name: Install uv
77+
uses: astral-sh/setup-uv@v5
7578

7679
- name: Install dependencies
7780
run: |
7881
bash -x .github/scripts/setup.sh
79-
pip install -U pip wheel poetry
80-
poetry self add poetry-plugin-export
81-
# Export and then use pip to install into the current env
82-
poetry export -o /tmp/requirements.txt --without-hashes --with dev
83-
pip install -r /tmp/requirements.txt
8482
# We're going to check BOLT quotes, so get the latest version
8583
git clone https://github.com/lightning/bolts.git ../${BOLTDIR}
8684
- name: Configure
@@ -89,7 +87,8 @@ jobs:
8987
env:
9088
VALGRIND: 0
9189
PYTEST_OPTS: --timeout=1200
92-
run: make check-source BASE_REF="origin/${{ github.base_ref }}"
90+
run: |
91+
uv run make check-source BASE_REF="origin/${{ github.base_ref }}"
9392
- name: Check Generated Files have been updated
9493
run: make check-gen-updated
9594
- name: Check docs
@@ -128,7 +127,10 @@ jobs:
128127
- name: Set up Python 3.10
129128
uses: actions/setup-python@v5
130129
with:
131-
python-version: '3.10'
130+
python-version: "3.10"
131+
132+
- name: Install uv
133+
uses: astral-sh/setup-uv@v5
132134

133135
- name: Install dependencies
134136
run: |
@@ -144,13 +146,9 @@ jobs:
144146
CFG: ${{ matrix.CFG }}
145147
run: |
146148
set -e
147-
pip3 install --user pip wheel poetry
148-
poetry self add poetry-plugin-export
149-
poetry export -o requirements.txt --with dev --without-hashes
150-
python3 -m pip install -r requirements.txt
151149
./configure --enable-debugbuild CC="$COMPILER" ${{ matrix.COPTFLAGS_VAR }}
152150
153-
make -j $(nproc) testpack.tar.bz2
151+
uv run make -j $(nproc) testpack.tar.bz2
154152
155153
# Rename now so we don't clash
156154
mv testpack.tar.bz2 cln-${CFG}.tar.bz2
@@ -186,18 +184,16 @@ jobs:
186184
- name: Set up Python 3.10
187185
uses: actions/setup-python@v5
188186
with:
189-
python-version: '3.10'
187+
python-version: "3.10"
188+
189+
- name: Install uv
190+
uses: astral-sh/setup-uv@v5
190191

191192
- name: Install dependencies
192193
run: |
193194
bash -x .github/scripts/setup.sh
194195
sudo apt-get update -qq
195196
sudo apt-get install -y -qq lowdown
196-
pip install -U pip wheel poetry
197-
poetry self add poetry-plugin-export
198-
# Export and then use pip to install into the current env
199-
poetry export -o /tmp/requirements.txt --without-hashes --with dev
200-
pip install -r /tmp/requirements.txt
201197
# We're going to check BOLT quotes, so get the latest version
202198
git clone https://github.com/lightning/bolts.git ../${BOLTDIR}
203199
@@ -209,7 +205,7 @@ jobs:
209205
- name: Check
210206
run: |
211207
tar -xaf cln-${{ matrix.CFG }}.tar.bz2
212-
make -j $(nproc) check-units installcheck VALGRIND=${{ matrix.VALGRIND }}
208+
uv run make -j $(nproc) check-units installcheck VALGRIND=${{ matrix.VALGRIND }}
213209
214210
check-fuzz:
215211
name: Run fuzz regression tests
@@ -223,28 +219,26 @@ jobs:
223219
- name: Set up Python 3.10
224220
uses: actions/setup-python@v5
225221
with:
226-
python-version: '3.10'
222+
python-version: "3.10"
223+
224+
- name: Install uv
225+
uses: astral-sh/setup-uv@v5
227226

228227
- name: Install dependencies
229228
run: |
230229
bash -x .github/scripts/setup.sh
231-
pip install -U pip wheel poetry
232-
poetry self add poetry-plugin-export
233-
# Export and then use pip to install into the current env
234-
poetry export -o /tmp/requirements.txt --without-hashes --with dev
235-
pip install -r /tmp/requirements.txt
236230
237231
- name: Build
238232
run: |
239233
./configure --enable-debugbuild --enable-fuzzing --enable-address-sanitizer --enable-ub-sanitizer --disable-valgrind CC=clang
240-
make -j $(nproc) check-fuzz
234+
uv run make -j $(nproc) check-fuzz
241235
242236
integration:
243237
name: Test CLN ${{ matrix.name }}
244238
runs-on: ubuntu-22.04
245239
timeout-minutes: 120
246240
env:
247-
RUST_PROFILE: release # Has to match the one in the compile step
241+
RUST_PROFILE: release # Has to match the one in the compile step
248242
PYTEST_OPTS: --timeout=1200
249243
needs:
250244
- compile
@@ -297,12 +291,14 @@ jobs:
297291
- name: Set up Python 3.10
298292
uses: actions/setup-python@v5
299293
with:
300-
python-version: '3.10'
294+
python-version: "3.10"
295+
296+
- name: Install uv
297+
uses: astral-sh/setup-uv@v5
301298

302299
- name: Install dependencies
303300
run: |
304-
pip3 install --user pip wheel poetry
305-
poetry install
301+
bash -x .github/scripts/setup.sh
306302
307303
- name: Install bitcoind
308304
env:
@@ -343,14 +339,14 @@ jobs:
343339
run: |
344340
env
345341
cat config.vars
346-
VALGRIND=0 poetry run pytest tests/ -vvv -n ${PYTEST_PAR} ${PYTEST_OPTS}
342+
VALGRIND=0 uv run pytest tests/ -vvv -n ${PYTEST_PAR} ${PYTEST_OPTS}
347343
348344
integration-valgrind:
349345
name: Valgrind Test CLN ${{ matrix.name }}
350346
runs-on: ubuntu-22.04
351347
timeout-minutes: 120
352348
env:
353-
RUST_PROFILE: release # Has to match the one in the compile step
349+
RUST_PROFILE: release # Has to match the one in the compile step
354350
CFG: compile-gcc
355351
PYTEST_OPTS: --test-group-random-seed=42 --timeout=1800
356352
needs:
@@ -386,14 +382,16 @@ jobs:
386382
- name: Set up Python 3.10
387383
uses: actions/setup-python@v5
388384
with:
389-
python-version: '3.10'
385+
python-version: "3.10"
386+
387+
- name: Install uv
388+
uses: astral-sh/setup-uv@v5
390389

391390
- name: Install dependencies
392391
run: |
393392
sudo apt-get update -qq
394393
sudo apt-get install -yyq valgrind
395-
pip3 install --user pip wheel poetry
396-
poetry install
394+
bash -x .github/scripts/setup.sh
397395
398396
- name: Install bitcoind
399397
run: .github/scripts/install-bitcoind.sh
@@ -411,7 +409,7 @@ jobs:
411409
SLOW_MACHINE: 1
412410
TEST_DEBUG: 1
413411
run: |
414-
VALGRIND=1 poetry run pytest tests/ -vvv -n 3 ${PYTEST_OPTS} ${{ matrix.PYTEST_OPTS }}
412+
VALGRIND=1 uv run pytest tests/ -vvv -n 3 ${PYTEST_OPTS} ${{ matrix.PYTEST_OPTS }}
415413
416414
integration-sanitizers:
417415
name: Sanitizers Test CLN
@@ -455,14 +453,14 @@ jobs:
455453
- name: Set up Python 3.10
456454
uses: actions/setup-python@v5
457455
with:
458-
python-version: '3.10'
456+
python-version: "3.10"
457+
458+
- name: Install uv
459+
uses: astral-sh/setup-uv@v5
459460

460461
- name: Install dependencies
461462
run: |
462463
bash -x .github/scripts/setup.sh
463-
set -e
464-
pip3 install --user wheel poetry
465-
poetry install --with dev --no-root
466464
467465
- name: Install bitcoind
468466
run: .github/scripts/install-bitcoind.sh
@@ -477,7 +475,7 @@ jobs:
477475

478476
- name: Test
479477
run: |
480-
poetry run pytest tests/ -vvv -n 2 ${PYTEST_OPTS} ${{ matrix.PYTEST_OPTS }}
478+
uv run pytest tests/ -vvv -n 2 ${PYTEST_OPTS} ${{ matrix.PYTEST_OPTS }}
481479
482480
update-docs-examples:
483481
name: Update examples in doc schemas (disabled temporarily!)
@@ -499,14 +497,14 @@ jobs:
499497
- name: Set up Python 3.10
500498
uses: actions/setup-python@v5
501499
with:
502-
python-version: '3.10'
500+
python-version: "3.10"
501+
502+
- name: Install uv
503+
uses: astral-sh/setup-uv@v5
504+
503505
- name: Install dependencies
504506
run: |
505507
bash -x .github/scripts/setup.sh
506-
pip install -U pip wheel poetry
507-
poetry self add poetry-plugin-export
508-
poetry export -o /tmp/requirements.txt --without-hashes --with dev
509-
pip install -r /tmp/requirements.txt
510508
- name: Install bitcoind
511509
env:
512510
TEST_NETWORK: regtest
@@ -520,14 +518,14 @@ jobs:
520518
tar -xaf cln-compile-gcc.tar.bz2
521519
- name: Test
522520
run: |
523-
make -j $(nproc) check-doc-examples
521+
uv run make -j $(nproc) check-doc-examples
524522
525523
min-btc-support:
526524
name: Test minimum supported BTC v${{ matrix.MIN_BTC_VERSION }} with ${{ matrix.NAME }}
527525
runs-on: ubuntu-22.04
528526
timeout-minutes: 120
529527
env:
530-
RUST_PROFILE: release # Has to match the one in the compile step
528+
RUST_PROFILE: release # Has to match the one in the compile step
531529
PYTEST_OPTS: --timeout=1200
532530
needs:
533531
- compile
@@ -540,20 +538,22 @@ jobs:
540538
TEST_DB_PROVIDER: sqlite3
541539
COMPILER: clang
542540
TEST_NETWORK: regtest
543-
MIN_BTC_VERSION: '25.0'
541+
MIN_BTC_VERSION: "25.0"
544542
steps:
545543
- name: Checkout
546544
uses: actions/checkout@v4
547545

548546
- name: Set up Python 3.10
549547
uses: actions/setup-python@v5
550548
with:
551-
python-version: '3.10'
549+
python-version: "3.10"
550+
551+
- name: Install uv
552+
uses: astral-sh/setup-uv@v5
552553

553554
- name: Install dependencies
554555
run: |
555-
pip3 install --user pip wheel poetry
556-
poetry install
556+
bash -x .github/scripts/setup.sh
557557
558558
- name: Download Bitcoin Core
559559
run: wget "https://bitcoincore.org/bin/bitcoin-core-${{ matrix.MIN_BTC_VERSION }}/bitcoin-${{ matrix.MIN_BTC_VERSION }}-x86_64-linux-gnu.tar.gz"
@@ -592,7 +592,7 @@ jobs:
592592
run: |
593593
env
594594
cat config.vars
595-
VALGRIND=0 poetry run pytest tests/ -vvv -n ${PYTEST_PAR} ${PYTEST_OPTS}
595+
VALGRIND=0 uv run pytest tests/ -vvv -n ${PYTEST_PAR} ${PYTEST_OPTS}
596596
597597
check-flake:
598598
name: Check Nix Flake
@@ -603,7 +603,7 @@ jobs:
603603
- name: Checkout
604604
uses: actions/checkout@v4
605605
with:
606-
submodules: 'recursive'
606+
submodules: "recursive"
607607
- name: Check Nix flake inputs
608608
uses: DeterminateSystems/flake-checker-action@v8
609609
- name: Install Nix

.github/workflows/macos.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,24 @@ jobs:
2525
sudo mv bitcoin-${BITCOIND_VERSION}/bin/* /usr/local/bin
2626
rm -rf bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz bitcoin-${BITCOIND_VERSION}
2727
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v5
30+
2831
- name: Install dependencies
2932
run: |
3033
export PATH="/usr/local/opt:/Users/runner/.local/bin:/opt/homebrew/bin/python3.10/bin:$PATH"
3134
3235
brew install gnu-sed [email protected] autoconf automake libtool protobuf
33-
python3.10 -m pip install -U --user poetry==1.8.0 wheel pip mako
34-
python3.10 -m poetry install
36+
37+
uv sync --all-extras --all-groups
3538
3639
- name: Build and install CLN
3740
run: |
3841
export CPATH=/opt/homebrew/include
3942
export LIBRARY_PATH=/opt/homebrew/lib
4043
41-
python3.10 -m poetry run ./configure --disable-valgrind --disable-compat
42-
python3.10 -m poetry run make
44+
uv run ./configure --disable-valgrind --disable-compat
45+
uv run make
4346
4447
- name: Start bitcoind in regtest mode
4548
run: |

0 commit comments

Comments
 (0)