Skip to content

Commit 6123b7d

Browse files
authored
feat(python): Build & publish wheels for Windows (#351)
* restore initial stab at building windows wheels * test1 * use fixed pip command * try cmake setup action * try --no-index flag * fix path * oops, wrong path * remove extraneous build step * update pyo3 to 0.19.2, rigetti-pyo3 to 0.2.0 * remove test code from workflow * rename argument to inner * update maturin to ^1.0
1 parent 1d03feb commit 6123b7d

19 files changed

+201
-160
lines changed

.github/workflows/release-python.yml

+37-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
workflow_dispatch:
77
description: "Manually publish release"
88

9-
109
jobs:
1110
is-python-release:
1211
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'python/v') }}
@@ -43,7 +42,7 @@ jobs:
4342
# universal2 supports both x86_64 and aarch64
4443
uses: messense/maturin-action@v1
4544
with:
46-
args: -i python --release --universal2 --manifest-path crates/python/Cargo.toml --out dist
45+
args: -i python --release --target universal2-apple-darwin --manifest-path crates/python/Cargo.toml --out dist
4746
- name: Install wheel
4847
run: |
4948
pip install qcs-sdk-python --find-links dist --force-reinstall
@@ -90,10 +89,45 @@ jobs:
9089
name: wheels
9190
path: dist
9291

92+
windows:
93+
runs-on: windows-latest
94+
strategy:
95+
matrix:
96+
python-version: ['3.8', '3.9', '3.10', '3.11']
97+
target: [x64, x86]
98+
steps:
99+
- uses: actions/checkout@v2
100+
- uses: actions/setup-python@v2
101+
with:
102+
python-version: ${{ matrix.python-version }}
103+
architecture: ${{ matrix.target }}
104+
- name: Update rustup
105+
run: rustup self update
106+
- name: Install Rust toolchain
107+
uses: actions-rs/toolchain@v1
108+
with:
109+
toolchain: stable
110+
target: x86_64-pc-windows-msvc
111+
profile: minimal
112+
default: true
113+
- name: Build wheels
114+
uses: messense/maturin-action@v1
115+
with:
116+
target: ${{ matrix.target }}
117+
args: -i python --release --manifest-path crates/python/Cargo.toml --out dist
118+
- name: Install built wheel
119+
run: |
120+
pip install qcs-sdk-python --find-links dist --force-reinstall --no-deps --no-index
121+
- name: Upload wheels
122+
uses: actions/upload-artifact@v2
123+
with:
124+
name: wheels
125+
path: dist
126+
93127
release:
94128
name: Release
95129
runs-on: ubuntu-latest
96-
needs: [ macos, linux ]
130+
needs: [ macos, linux, windows ]
97131
steps:
98132
- uses: actions/download-artifact@v3
99133
- name: Publish to PyPi

Cargo.lock

+29-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ tokio = "1.24.2"
1515
# be a `quil-py` tag and should match the version used in `crates/python/pyproject.toml`
1616
# The version must also be specified in order to publish to crates.io. Cargo enforces
1717
# that the specified version is the same as the version in the git repository.
18-
quil-rs = { version = "0.21.0", git = "https://github.com/rigetti/quil-rs", tag = "quil-py/v0.5.0" }
18+
quil-rs = { version = "0.21.0", git = "https://github.com/rigetti/quil-rs", tag = "quil-py/v0.5.1" }
1919

2020
# ndarray is used by the `qcs` crate, but it is also used in the `python` crate via a
2121
# re-export through the numpy crate. They should be updated as a pair to keep both
2222
# crates' versions of ndarray in sync.
2323
# Similarly, pyo3 packages (`numpy`, `rigetti-pyo3`, `pyo3*`) track versions together
2424
# and need to be updated together.
2525
ndarray = { version = "0.15.6", features = ["serde"] }
26-
numpy = "0.17"
27-
pyo3 = { version = "0.17" }
28-
pyo3-asyncio = { version = "0.17", features = ["tokio-runtime"] }
29-
pyo3-build-config = { version = "0.17" }
30-
rigetti-pyo3 = { version = "0.1.0", features = ["complex"] }
26+
numpy = "0.19"
27+
pyo3 = "0.19.2"
28+
pyo3-asyncio = { version = "0.19", features = ["tokio-runtime"] }
29+
pyo3-build-config = "0.19.2"
30+
rigetti-pyo3 = { version = "0.2.0", features = ["complex"] }
3131

crates/python/poetry.lock

+16-38
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/python/pyproject.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ classifiers = [
2020
"Programming Language :: Python :: 3.11",
2121
"Operating System :: OS Independent",
2222
]
23-
dependencies = ["quil==0.5.0"]
23+
dependencies = ["quil==0.5.1"]
2424

2525
# PEP 621 specifies the [project] table as the source for project metadata. However, Poetry only supports [tool.poetry]
2626
# We can remove this table once this issue is resolved: https://github.com/python-poetry/poetry/issues/3332
@@ -45,17 +45,17 @@ sdist-include = ["README.md"]
4545
[tool.poetry.dependencies]
4646
python = "^3.8"
4747

48-
[tool.poetry.dev-dependencies]
48+
[tool.poetry.group.dev.dependencies]
4949
numpy = "^1.24.1"
50-
maturin = "^0.14.17"
50+
maturin = "^1.2.3"
5151
pytest = "^7.1.3"
5252
pytest-asyncio = "^0.19.0"
5353
black = "^22.8.0"
5454
syrupy = "^3.0.6"
5555
mypy = "^1.4.1"
5656

5757
[build-system]
58-
requires = ["maturin>=0.14,<0.15"]
58+
requires = ["maturin>=1.0.0,<2.0.0"]
5959
build-backend = "maturin"
6060

6161
[tool.black]

0 commit comments

Comments
 (0)