Skip to content

Commit

Permalink
feat(python): Build & publish wheels for Windows (#280)
Browse files Browse the repository at this point in the history
* test windows wheel build for quil-py

* fix path and version matrix

* update build backend

* try gnu toolchain

* remove compiler step, test x64 only

* another toolchain test

* add x86 back

* try another method to install toolchain

* full toolchain name

* update to pyo3 0.19

* try updating maturin

* try to get macro-backtrace

* alternate toolchain action

* different way of specifying macro-backtrace

* trigger rebuild

* update Cargo.lock

* update rigetti-pyo3 to 0.2.0

* remove test code from workflow

* simplify dependency specs

* use & test regular toolchain

* remove workflow test code
  • Loading branch information
MarquessV authored Sep 7, 2023
1 parent 670b73c commit 3a1e522
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 107 deletions.
33 changes: 32 additions & 1 deletion .github/workflows/publish-quil-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,41 @@ jobs:
name: wheels
path: dist

windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
target: [x64, x86]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.target }}
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
args: -i python --release --manifest-path quil-py/Cargo.toml --out dist
- name: Install built wheel
run: |
pip install quil --find-links dist --force-reinstall --no-deps --no-index
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

publish-python-package:
name: Release
runs-on: ubuntu-latest
needs: [ macos, linux ]
needs: [ macos, linux, windows ]
steps:
- uses: actions/download-artifact@v3
- name: Publish to PyPi
Expand Down
53 changes: 25 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions quil-py/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ ndarray.workspace = true
quil-rs = { path = "../quil-rs", version = "0.21.0" }
strum.workspace = true
# pyo3 dependencies should be updated together
numpy = { version = "0.17.2" }
pyo3 = { version = "0.17" }
rigetti-pyo3 = "0.1.0"
numpy = "0.19.0"
pyo3 = "0.19.2"
rigetti-pyo3 = "0.2.0"

[build-dependencies]
pyo3-build-config = { version = "0.17" }
pyo3-build-config = "0.19.2"
4 changes: 2 additions & 2 deletions quil-py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ numpy = "^1.21"

[tool.poetry.group.dev.dependencies]
black = "^23.1.0"
maturin = "^0.14.15"
maturin = "^1.2.3"
mypy = "^1.1.1"
pytest = "^7.2.2"

Expand All @@ -40,7 +40,7 @@ compatibility = "linux"
sdist-include = ["README.md"]

[build-system]
requires = ["maturin>=0.13,<0.14"]
requires = ["maturin>=1.0.0,<2.0.0"]
build-backend = "maturin"

[tool.black]
Expand Down
14 changes: 7 additions & 7 deletions quil-py/quil/expression/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Expression:
"""
...
@staticmethod
def parse(quil: str) -> Expression:
def parse(input: str) -> Expression:
"""
Parses an ``Expression`` from a string. Raises a ``ParseExpressionError`` if the string
isn't a valid Quil expression.
Expand All @@ -63,17 +63,17 @@ class Expression:
@staticmethod
def new_pi() -> "Expression": ...
@staticmethod
def from_address(memory_reference: MemoryReference) -> "Expression": ...
def from_address(inner: MemoryReference) -> "Expression": ...
@staticmethod
def from_function_call(function_call: FunctionCallExpression) -> "Expression": ...
def from_function_call(inner: FunctionCallExpression) -> "Expression": ...
@staticmethod
def from_infix(infix: InfixExpression) -> "Expression": ...
def from_infix(inner: InfixExpression) -> "Expression": ...
@staticmethod
def from_number(number: complex) -> "Expression": ...
def from_number(inner: complex) -> "Expression": ...
@staticmethod
def from_prefix(prefix: PrefixExpression) -> "Expression": ...
def from_prefix(inner: PrefixExpression) -> "Expression": ...
@staticmethod
def from_variable(variable: str) -> "Expression": ...
def from_variable(inner: str) -> "Expression": ...
def as_address(self) -> Optional[MemoryReference]: ...
def to_address(self) -> MemoryReference: ...
def as_function_call(self) -> Optional[FunctionCallExpression]: ...
Expand Down
Loading

0 comments on commit 3a1e522

Please sign in to comment.