Skip to content

Commit efb5282

Browse files
committed
build: migrate from pip to uv
1 parent 79224f7 commit efb5282

14 files changed

Lines changed: 849 additions & 130 deletions

.github/workflows/publish-python.yaml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,24 @@ jobs:
3030
- name: "Configure Git safe directory"
3131
run: git config --global --add safe.directory /__w/bdk-python/bdk-python
3232

33+
- name: "Install uv"
34+
uses: astral-sh/setup-uv@v7
35+
3336
- name: "Set up Rust"
3437
uses: actions-rust-lang/setup-rust-toolchain@v1
3538

3639
- name: "Generate bdk.py and binaries"
3740
run: bash ./scripts/generate-linux.sh
3841

39-
- name: "Install build"
40-
run: ${PYBIN}/pip install build
41-
4242
- name: "Build wheel"
4343
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
4444
# see issue #350 for more information
45-
run: ${PYBIN}/python -m build --wheel --config-setting=--build-option=--plat-name=manylinux_2_28_x86_64 --verbose
45+
run: UV_PYTHON=${PYBIN}/python uv build --wheel -C=--build-option=--plat-name=manylinux_2_28_x86_64 -v
4646

4747
- uses: actions/upload-artifact@v4
4848
with:
4949
name: bdkpython-manylinux_2_28_x86_64-${{ matrix.python }}
50-
path: /home/runner/work/bdk-python/bdk-python/dist/*.whl
50+
path: dist/*.whl
5151

5252
build-macos-arm64-wheels:
5353
name: "Build macOS arm64 wheel"
@@ -72,25 +72,25 @@ jobs:
7272
with:
7373
python-version: ${{ matrix.python }}
7474

75+
- name: "Install uv"
76+
uses: astral-sh/setup-uv@v7
77+
7578
- name: "Set up Rust"
7679
uses: actions-rust-lang/setup-rust-toolchain@v1
7780

7881
- name: "Generate bdk.py and binaries"
7982
run: bash ./scripts/generate-macos-arm64.sh
80-
81-
- name: "Install build"
82-
run: pip3 install build
8383

8484
- name: "Build wheel"
8585
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
8686
# see issue #350 for more information
87-
run: python3 -m build --wheel --config-setting=--build-option=--plat-name=macosx_11_0_arm64 --verbose
87+
run: uv build --wheel -C=--build-option=--plat-name=macosx_11_0_arm64 -v
8888

8989
- name: "Upload artifacts"
9090
uses: actions/upload-artifact@v4
9191
with:
9292
name: bdkpython-macos-arm64-${{ matrix.python }}
93-
path: /Users/runner/work/bdk-python/bdk-python/dist/*.whl
93+
path: dist/*.whl
9494

9595
build-macos-x86_64-wheels:
9696
name: "Build macOS x86_64 wheel"
@@ -115,24 +115,24 @@ jobs:
115115
with:
116116
python-version: ${{ matrix.python }}
117117

118+
- name: "Install uv"
119+
uses: astral-sh/setup-uv@v7
120+
118121
- name: "Set up Rust"
119122
uses: actions-rust-lang/setup-rust-toolchain@v1
120123

121124
- name: "Generate bdk.py and binaries"
122125
run: bash ./scripts/generate-macos-x86_64.sh
123126

124-
- name: "Install build"
125-
run: pip3 install build
126-
127127
- name: "Build wheel"
128128
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
129129
# see issue #350 for more information
130-
run: python3 -m build --wheel --config-setting=--build-option=--plat-name=macosx_11_0_x86_64 --verbose
130+
run: uv build --wheel -C=--build-option=--plat-name=macosx_11_0_x86_64 -v
131131

132132
- uses: actions/upload-artifact@v4
133133
with:
134134
name: bdkpython-macos-x86_64-${{ matrix.python }}
135-
path: /Users/runner/work/bdk-python/bdk-python/dist/*.whl
135+
path: dist/*.whl
136136

137137
build-windows-wheels:
138138
name: "Build Windows wheel"
@@ -156,23 +156,23 @@ jobs:
156156
with:
157157
python-version: ${{ matrix.python }}
158158

159+
- name: "Install uv"
160+
uses: astral-sh/setup-uv@v7
161+
159162
- name: "Set up Rust"
160163
uses: actions-rust-lang/setup-rust-toolchain@v1
161-
164+
162165
- name: "Generate bdk.py and binaries"
163166
run: bash ./scripts/generate-windows.sh
164167

165-
- name: "Install build"
166-
run: pip install build
167-
168168
- name: "Build wheel"
169-
run: python -m build --wheel --verbose
169+
run: uv build --wheel -v
170170

171171
- name: "Upload artifacts"
172172
uses: actions/upload-artifact@v4
173173
with:
174174
name: bdkpython-win-${{ matrix.python }}
175-
path: D:\a\bdk-python\bdk-python\dist\*.whl
175+
path: dist/*.whl
176176

177177
publish-pypi:
178178
name: "Publish on PyPI"
@@ -202,4 +202,4 @@ jobs:
202202
with:
203203
user: __token__
204204
password: ${{ secrets.PYPI_API_TOKEN }}
205-
packages_dir: dist/*/
205+
packages_dir: dist/*/

.github/workflows/python-api-docs.yaml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,32 @@ jobs:
2222

2323
- name: "Configure Git safe directory"
2424
run: git config --global --add safe.directory /__w/bdk-python/bdk-python
25-
25+
2626
- name: "Set up Python"
2727
uses: actions/setup-python@v5
2828
with:
2929
python-version: "3.12"
3030

31+
- name: "Install uv"
32+
uses: astral-sh/setup-uv@v7
33+
3134
- name: "Set up Rust"
3235
uses: actions-rust-lang/setup-rust-toolchain@v1.15.2
3336
with:
3437
cache: true
3538
rust-src-dir: ${{ github.workspace }}/bdk-ffi/bdk-ffi
36-
39+
3740
- name: "Generate bdk.py"
38-
env:
39-
PYBIN: ${{ env.pythonLocation }}/bin
4041
run: bash ./scripts/generate-linux.sh
4142

42-
- name: "Install Sphinx and Theme"
43-
run: pip3 install sphinx sphinx_rtd_theme
43+
- name: "Install docs dependencies"
44+
run: uv sync --frozen --group dev
4445

4546
- name: "Generate python API Documentation"
46-
run: python3 ./docs/generate_docs.py
47-
47+
run: uv run python ./docs/generate_docs.py
48+
4849
- name: "Build HTML Documentation"
49-
run: python3 -m sphinx -b html -W --keep-going docs/source docs/_build/html
50+
run: uv run python -m sphinx -b html -W --keep-going docs/source docs/_build/html
5051

5152
- name: "Upload API Docs"
5253
uses: actions/upload-artifact@v4
@@ -69,4 +70,4 @@ jobs:
6970
steps:
7071
- name: "Deploy to GitHub Pages"
7172
id: deployment
72-
uses: actions/deploy-pages@v4
73+
uses: actions/deploy-pages@v4

.github/workflows/test-bdk-ffi-latest.yaml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
- name: "Configure Git safe directory"
3535
run: git config --global --add safe.directory /__w/bdk-python/bdk-python
3636

37+
- name: "Install uv"
38+
uses: astral-sh/setup-uv@v7
39+
3740
- name: "Set up Rust"
3841
uses: actions-rust-lang/setup-rust-toolchain@v1
3942

@@ -53,18 +56,15 @@ jobs:
5356
~/.cargo/git
5457
./target
5558
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
56-
59+
5760
- name: "Generate bdk.py and binaries"
5861
run: bash ./scripts/generate-linux.sh
5962

60-
- name: "Install build"
61-
run: ${PYBIN}/pip install build
62-
6363
- name: "Build wheel"
64-
run: ${PYBIN}/python -m build --wheel --config-setting=--build-option=--plat-name=manylinux_2_28_x86_64 --verbose
64+
run: UV_PYTHON=${PYBIN}/python uv build --wheel -C=--build-option=--plat-name=manylinux_2_28_x86_64 -v
6565

6666
- name: "Install wheel"
67-
run: ${PYBIN}/pip install ./dist/*.whl
67+
run: uv pip install --python ${PYBIN}/python ./dist/*.whl
6868

6969
- name: "Run tests"
7070
run: ${PYBIN}/python -m unittest discover --start "./tests/" --pattern "test_offline_*.py" --verbose
@@ -86,7 +86,10 @@ jobs:
8686
submodules: recursive
8787
persist-credentials: false
8888
fetch-depth: 0
89-
89+
90+
- name: "Install uv"
91+
uses: astral-sh/setup-uv@v7
92+
9093
- name: "Update bdk-ffi submodule to latest"
9194
run: |
9295
cd ./bdk-ffi/ \
@@ -106,17 +109,14 @@ jobs:
106109
- name: "Generate bdk.py and binaries"
107110
run: bash ./scripts/generate-macos-arm64.sh
108111

109-
- name: "Install build"
110-
run: pip3 install build
111-
112112
- name: "Build wheel"
113113
# Specifying the plat-name argument is necessary to build a wheel with the correct name,
114114
# see issue #350 for more information
115-
run: python3 -m build --wheel --config-setting=--build-option=--plat-name=macosx_11_0_arm64 --verbose
115+
run: uv build --wheel -C=--build-option=--plat-name=macosx_11_0_arm64 -v
116116

117117
- name: "Install wheel"
118-
run: pip3 install ./dist/*.whl
119-
118+
run: uv pip install --python python3 ./dist/*.whl
119+
120120
- name: "Run tests"
121121
run: python3 -m unittest discover --start "./tests/" --pattern "test_offline_*.py" --verbose
122122

@@ -138,6 +138,9 @@ jobs:
138138
persist-credentials: false
139139
fetch-depth: 0
140140

141+
- name: "Install uv"
142+
uses: astral-sh/setup-uv@v7
143+
141144
- name: "Update bdk-ffi submodule to latest"
142145
run: |
143146
cd ./bdk-ffi/ \
@@ -156,14 +159,11 @@ jobs:
156159
- name: "Generate bdk.py and binaries"
157160
run: bash ./scripts/generate-macos-x86_64.sh
158161

159-
- name: "Install build"
160-
run: pip3 install build
161-
162162
- name: "Build wheel"
163-
run: python3 -m build --wheel --config-setting=--build-option=--plat-name=macosx_11_0_x86_64 --verbose
163+
run: uv build --wheel -C=--build-option=--plat-name=macosx_11_0_x86_64 -v
164164

165165
- name: "Install wheel"
166-
run: pip3 install ./dist/*.whl
166+
run: uv pip install --python python3 ./dist/*.whl
167167

168168
- name: "Run tests"
169169
run: python3 -m unittest discover --start "./tests/" --pattern "test_offline_*.py" --verbose
@@ -186,17 +186,20 @@ jobs:
186186
persist-credentials: false
187187
fetch-depth: 0
188188

189+
- name: "Install uv"
190+
uses: astral-sh/setup-uv@v7
191+
189192
- name: "Update bdk-ffi submodule to latest"
190193
run: |
191-
cd ./bdk-ffi/;
192-
git fetch origin;
193-
git checkout master;
194-
git pull origin master;
194+
cd ./bdk-ffi/;
195+
git fetch origin;
196+
git checkout master;
197+
git pull origin master;
195198
echo "Testing commit: $(git log -1 --pretty=format:'%h %s (author: %cn)')"
196199
197200
- name: "Set up Rust"
198201
uses: actions-rust-lang/setup-rust-toolchain@v1
199-
202+
200203
- name: "Install Python"
201204
uses: actions/setup-python@v4
202205
with:
@@ -205,14 +208,11 @@ jobs:
205208
- name: "Generate bdk.py and binaries"
206209
run: bash ./scripts/generate-windows.sh
207210

208-
- name: "Install build"
209-
run: pip install build
210-
211211
- name: "Build wheel"
212-
run: python -m build --wheel --verbose
212+
run: uv build --wheel -v
213213

214214
- name: "Install dependencies"
215-
run: Get-ChildItem 'D:\a\bdk-python\bdk-python\dist\*.whl' | ForEach-Object {pip install $_.FullName}
215+
run: Get-ChildItem 'D:\a\bdk-python\bdk-python\dist\*.whl' | ForEach-Object {uv pip install --python python $_.FullName}
216216
shell: powershell
217217

218218
- name: "Run tests"
@@ -232,8 +232,8 @@ jobs:
232232
- name: "Configure Git safe directory"
233233
run: git config --global --add safe.directory /__w/bdk-python/bdk-python
234234

235-
- name: "Install Ruff"
236-
run: curl -LsSf https://astral.sh/ruff/install.sh | sh
235+
- name: "Install uv"
236+
uses: astral-sh/setup-uv@v7
237237

238238
- name: "Lint test targets"
239-
run: ruff check ./tests/
239+
run: uvx ruff check ./tests/

0 commit comments

Comments
 (0)