Skip to content

Commit 587b4ea

Browse files
feat(python): generate the Python wrapper with UniFFI instead of pyo3
Build the Python bindings from the existing devolutions-crypto-uniffi scaffolding via maturin (bindings = "uniffi") rather than a hand-written pyo3 wrapper. Still imported as `devolutions_crypto`. - Drop the pyo3 crate and the hand-written .pyi stub; the python/ crate now only hosts the uniffi-bindgen binary maturin invokes - Gate that binary's uniffi CLI dependency to non-wasm targets so wasm builds (wasm-pack over the workspace) are unaffected - Build a single py3-none wheel per target in CI (UniFFI bindings are ABI-independent, so the per-Python-version matrix is no longer needed) - Port the Python test suite to the UniFFI API and add derive_encrypt tests mirroring the other wrappers - Update the PyPI usage examples for the UniFFI API This is a breaking API change for Python consumers (shapes follow UniFFI); the wrapper is used only for testing.
1 parent af495c0 commit 587b4ea

17 files changed

Lines changed: 176 additions & 1396 deletions

File tree

.github/workflows/python/build/linux/action.yml

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -31,61 +31,13 @@ runs:
3131
working-directory: "./python"
3232
shell: bash
3333

34-
- name: Building 3.14 wheel
34+
- name: Building wheels
3535
working-directory: ./python
3636
shell: bash
3737
run: |
38-
maturin build -i 3.14 --release --target=x86_64-unknown-linux-gnu
39-
maturin build -i 3.14 --release --target=i686-unknown-linux-gnu
40-
maturin build -i 3.14 --release --target=aarch64-unknown-linux-gnu
41-
42-
- uses: actions/setup-python@v5
43-
with:
44-
python-version: "3.13"
45-
46-
- name: Building 3.13 wheel
47-
working-directory: ./python
48-
shell: bash
49-
run: |
50-
maturin build -i 3.13 --release --target=x86_64-unknown-linux-gnu
51-
maturin build -i 3.13 --release --target=i686-unknown-linux-gnu
52-
maturin build -i 3.13 --release --target=aarch64-unknown-linux-gnu
53-
54-
- uses: actions/setup-python@v5
55-
with:
56-
python-version: "3.12"
57-
58-
- name: Building 3.12 wheel
59-
working-directory: ./python
60-
shell: bash
61-
run: |
62-
maturin build -i 3.12 --release --target=x86_64-unknown-linux-gnu
63-
maturin build -i 3.12 --release --target=i686-unknown-linux-gnu
64-
maturin build -i 3.12 --release --target=aarch64-unknown-linux-gnu
65-
66-
- uses: actions/setup-python@v5
67-
with:
68-
python-version: "3.11"
69-
70-
- name: Building 3.11 Wheel
71-
working-directory: ./python
72-
shell: bash
73-
run: |
74-
maturin build -i 3.11 --release --target=x86_64-unknown-linux-gnu
75-
maturin build -i 3.11 --release --target=i686-unknown-linux-gnu
76-
maturin build -i 3.11 --release --target=aarch64-unknown-linux-gnu
77-
78-
- uses: actions/setup-python@v5
79-
with:
80-
python-version: "3.10"
81-
82-
- name: Building 3.10 Wheel
83-
working-directory: ./python
84-
shell: bash
85-
run: |
86-
maturin build -i 3.10 --release --target=x86_64-unknown-linux-gnu
87-
maturin build -i 3.10 --release --target=i686-unknown-linux-gnu
88-
maturin build -i 3.10 --release --target=aarch64-unknown-linux-gnu
38+
maturin build --release --target=x86_64-unknown-linux-gnu
39+
maturin build --release --target=i686-unknown-linux-gnu
40+
maturin build --release --target=aarch64-unknown-linux-gnu
8941
9042
- name: Place Artifacts
9143
shell: bash

.github/workflows/python/build/macos/action.yml

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -22,66 +22,14 @@ runs:
2222
shell: bash
2323
run: pip install maturin --disable-pip-version-check
2424

25-
- name: Building 3.14 Wheel
25+
- name: Building wheels
2626
working-directory: ./python
2727
shell: bash
2828
run: |
2929
source $HOME/.cargo/env
3030
31-
maturin build --release -i 3.14 --target=x86_64-apple-darwin
32-
maturin build --release -i 3.14 --target=aarch64-apple-darwin
33-
34-
- uses: actions/setup-python@v5
35-
with:
36-
python-version: "3.13"
37-
38-
- name: Building 3.13 Wheel
39-
working-directory: ./python
40-
shell: bash
41-
run: |
42-
source $HOME/.cargo/env
43-
44-
maturin build --release -i 3.13 --target=x86_64-apple-darwin
45-
maturin build --release -i 3.13 --target=aarch64-apple-darwin
46-
47-
- uses: actions/setup-python@v5
48-
with:
49-
python-version: "3.12"
50-
51-
- name: Building 3.12 Wheel
52-
working-directory: ./python
53-
shell: bash
54-
run: |
55-
source $HOME/.cargo/env
56-
57-
maturin build --release -i 3.12 --target=x86_64-apple-darwin
58-
maturin build --release -i 3.12 --target=aarch64-apple-darwin
59-
60-
- uses: actions/setup-python@v5
61-
with:
62-
python-version: "3.11"
63-
64-
- name: Building 3.11 Wheel
65-
working-directory: ./python
66-
shell: bash
67-
run: |
68-
source $HOME/.cargo/env
69-
70-
maturin build --release -i 3.11 --target=x86_64-apple-darwin
71-
maturin build --release -i 3.11 --target=aarch64-apple-darwin
72-
73-
- uses: actions/setup-python@v5
74-
with:
75-
python-version: "3.10"
76-
77-
- name: Building 3.10 Wheel
78-
working-directory: ./python
79-
shell: bash
80-
run: |
81-
source $HOME/.cargo/env
82-
83-
maturin build --release -i 3.10 --target=x86_64-apple-darwin
84-
maturin build --release -i 3.10 --target=aarch64-apple-darwin
31+
maturin build --release --target=x86_64-apple-darwin
32+
maturin build --release --target=aarch64-apple-darwin
8533
8634
- name: Place Artifacts
8735
shell: bash

.github/workflows/python/build/windows/action.yml

Lines changed: 5 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ runs:
55
- uses: actions/setup-python@v5
66
with:
77
python-version: "3.14"
8+
architecture: "x64"
89

910
- name: Setting up PATH environment variable
1011
shell: bash
@@ -22,115 +23,13 @@ runs:
2223
shell: bash
2324
run: pip install maturin
2425

25-
- uses: actions/setup-python@v5
26-
with:
27-
python-version: "3.14"
28-
architecture: "x86"
29-
30-
- name: Building i686 3.14 wheel
31-
working-directory: ./python
32-
shell: bash
33-
run: maturin build -i 3.14 --release --target=i686-pc-windows-msvc
34-
35-
- uses: actions/setup-python@v5
36-
with:
37-
python-version: "3.14"
38-
architecture: "x64"
39-
40-
- name: Building x86_64, aarch64 3.14 wheel
41-
working-directory: ./python
42-
shell: bash
43-
run: |
44-
maturin build -i 3.14 --release --target=x86_64-pc-windows-msvc
45-
maturin build -i 3.14 --release --target=aarch64-pc-windows-msvc
46-
47-
- uses: actions/setup-python@v5
48-
with:
49-
python-version: "3.13"
50-
architecture: "x86"
51-
52-
- name: Building i686 3.13 wheel
53-
working-directory: ./python
54-
shell: bash
55-
run: maturin build -i 3.13 --release --target=i686-pc-windows-msvc
56-
57-
- uses: actions/setup-python@v5
58-
with:
59-
python-version: "3.13"
60-
architecture: "x64"
61-
62-
- name: Building x86_64, aarch64 3.13 wheel
63-
working-directory: ./python
64-
shell: bash
65-
run: |
66-
maturin build -i 3.13 --release --target=x86_64-pc-windows-msvc
67-
maturin build -i 3.13 --release --target=aarch64-pc-windows-msvc
68-
69-
- uses: actions/setup-python@v5
70-
with:
71-
python-version: "3.12"
72-
architecture: "x86"
73-
74-
- name: Building i686 3.12 wheel
75-
working-directory: ./python
76-
shell: bash
77-
run: maturin build -i 3.12 --release --target=i686-pc-windows-msvc
78-
79-
- uses: actions/setup-python@v5
80-
with:
81-
python-version: "3.12"
82-
architecture: "x64"
83-
84-
- name: Building x86_64, aarch64 3.12 wheel
85-
working-directory: ./python
86-
shell: bash
87-
run: |
88-
maturin build -i 3.12 --release --target=x86_64-pc-windows-msvc
89-
maturin build -i 3.12 --release --target=aarch64-pc-windows-msvc
90-
91-
- uses: actions/setup-python@v5
92-
with:
93-
python-version: "3.11"
94-
architecture: "x86"
95-
96-
- name: Building i686 3.11 wheel
97-
working-directory: ./python
98-
shell: bash
99-
run: maturin build -i 3.11 --release --target=i686-pc-windows-msvc
100-
101-
- uses: actions/setup-python@v5
102-
with:
103-
python-version: "3.11"
104-
architecture: "x64"
105-
106-
- name: Building x86_64, aarch64 3.11 wheel
107-
working-directory: ./python
108-
shell: bash
109-
run: |
110-
maturin build -i 3.11 --release --target=x86_64-pc-windows-msvc
111-
maturin build -i 3.11 --release --target=aarch64-pc-windows-msvc
112-
113-
- uses: actions/setup-python@v5
114-
with:
115-
python-version: "3.10"
116-
architecture: "x86"
117-
118-
- name: Building i686 3.10 wheel
119-
working-directory: ./python
120-
shell: bash
121-
run: maturin build -i 3.10 --release --target=i686-pc-windows-msvc
122-
123-
- uses: actions/setup-python@v5
124-
with:
125-
python-version: "3.10"
126-
architecture: "x64"
127-
128-
- name: Building x86_64, aarch64 3.10 wheel
26+
- name: Building wheels
12927
working-directory: ./python
13028
shell: bash
13129
run: |
132-
maturin build -i 3.10 --release --target=x86_64-pc-windows-msvc
133-
maturin build -i 3.10 --release --target=aarch64-pc-windows-msvc
30+
maturin build --release --target=x86_64-pc-windows-msvc
31+
maturin build --release --target=i686-pc-windows-msvc
32+
maturin build --release --target=aarch64-pc-windows-msvc
13433
13534
- name: Place Artifacts
13635
shell: bash

0 commit comments

Comments
 (0)