Skip to content

Commit 4efae89

Browse files
fix: expand numpy compat range to >=1.26 (#1827)
* fix: expand numpy compat range to >=1.25 * fix: stringify numpy float and remove extra type ignore comment * chore: update lower bound on h11 to fix vuln * chore: don't use 3.10 syntax * chore: lock without update * chore: install latest poetry * chore: do not test for python 3.13 * chore: use legacy print options * chore: format * chore: fix one value from ifft output * chore: fix one value from ifft output * chore: run ci for pr * chore: update lbound on numpy for pickle compat * chore: try to fix np formatting at callsite * chore: keep trying to fix * chore: no need to change formatting in parameters test * chore: restrict numpy to <3 * chore: relax upper python constraint * chore: prepare release 4.16.2-rc.1 [skip ci] * chore: prepare release 4.16.2-rc.2 [skip ci] --------- Co-authored-by: jselig-rigetti <jselig-rigetti@users.noreply.github.com>
1 parent 6573ed0 commit 4efae89

9 files changed

Lines changed: 94 additions & 61 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
pull-requests: write # allows coverage bot to comment
134134
strategy:
135135
matrix:
136-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
136+
python-version: ["3.9", "3.10", "3.11", "3.12"]
137137
steps:
138138
- uses: actions/checkout@v2
139139
- name: Set up Python ${{ matrix.python-version }}
@@ -195,7 +195,7 @@ jobs:
195195
runs-on: ubuntu-latest
196196
strategy:
197197
matrix:
198-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
198+
python-version: ["3.9", "3.10", "3.11", "3.12"]
199199
steps:
200200
- uses: actions/checkout@v2
201201
- name: Set up Python ${{ matrix.python-version }}

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## 4.16.2-rc.2 (2025-05-02)
4+
5+
### Fixes
6+
7+
#### allow installation of pyquil and packaging-24.2 (#1823)
8+
9+
#### expand numpy compat range to >=1.25
10+
11+
#### stringify numpy float and remove extra type ignore comment
12+
13+
## 4.16.2-rc.1 (2025-05-02)
14+
15+
### Fixes
16+
17+
#### allow installation of pyquil and packaging-24.2 (#1823)
18+
19+
#### expand numpy compat range to >=1.25
20+
21+
#### stringify numpy float and remove extra type ignore comment
22+
323
## 4.16.2-rc.0 (2025-03-24)
424

525
### Fixes

docs/source/exercises.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ We can verify this works by computing the *inverse* FFT on the output with NumPy
214214

215215
.. testoutput:: qft
216216

217-
[ 0.00000000e+00+0.00000000e+00j 1.00000000e+00+5.45603965e-17j
217+
[ 0.00000000e+00+0.00000000e+00j 1.00000000e+00+4.30636606e-17j
218218
0.00000000e+00+0.00000000e+00j 0.00000000e+00-1.53080850e-17j
219-
0.00000000e+00+0.00000000e+00j -7.85046229e-17-2.39442265e-17j
219+
0.00000000e+00+0.00000000e+00j -7.85046229e-17-1.24474906e-17j
220220
0.00000000e+00+0.00000000e+00j 0.00000000e+00-1.53080850e-17j]
221221

222222
After ignoring the terms that are on the order of ``1e-17``, we get ``[0, 1, 0, 0, 0, 0, 0, 0]``, which was our input!

docs/source/wavefunction_simulator.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ amplitudes directly or look at a dictionary of associated outcome probabilities.
4848
.. testcode::
4949

5050
import numpy as np
51+
np.set_printoptions(legacy="1.21")
5152

5253
assert wavefunction[0] == 1 / np.sqrt(2)
5354
# The amplitudes are stored as a numpy array on the Wavefunction object

poetry.lock

Lines changed: 56 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "pyquil"
3-
version = "4.16.2-rc.0"
3+
version = "4.16.2-rc.2"
44
description = "A Python library for creating Quantum Instruction Language (Quil) programs."
55
authors = ["Rigetti Computing <softapps@rigetti.com>"]
66
readme = "README.md"
@@ -10,17 +10,19 @@ license = "Apache-2.0"
1010
classifiers = [
1111
"Development Status :: 5 - Production/Stable",
1212
"License :: OSI Approved :: Apache Software License",
13-
"Programming Language :: Python :: 3.8",
1413
"Programming Language :: Python :: 3.9",
14+
"Programming Language :: Python :: 3.10",
15+
"Programming Language :: Python :: 3.11",
16+
"Programming Language :: Python :: 3.12",
1517
"Operating System :: OS Independent",
1618
]
1719
keywords = ["quantum", "quil", "programming", "hybrid"]
1820
packages = [{ include = "pyquil" }]
1921
exclude = ["pyquil/conftest.py"]
2022

2123
[tool.poetry.dependencies]
22-
python = "^3.9,<4.0"
23-
numpy = "^1.25"
24+
python = "^3.9,<4"
25+
numpy = ">=1.26,<3"
2426
scipy = "^1.11"
2527
rpcq = "^3.11.0"
2628
networkx = ">=2.5"
@@ -63,6 +65,7 @@ pytest-benchmark = "4.0.0"
6365
respx = "^0.21.1"
6466
syrupy = "^4.6.1"
6567
jinja2 = {version = ">=3.1.6", optional = true} # see: https://osv.dev/vulnerability/GHSA-gmj6-6f8f-6699 and https://osv.dev/vulnerability/GHSA-q2x7-8rv6-6q7h and https://osv.dev/GHSA-cpwx-vrp4-4pq7
68+
h11 = {version = ">=0.16.0", optional = true} # see: https://osv.dev/vulnerability/GHSA-vqfr-h8mv-ghfj
6669

6770

6871
[tool.ruff]

pyquil/noise_gates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _transform_rpcq_qubit_gate_info_to_qvm_noise_supported_gate(qubit_id: int, g
5151
return None
5252

5353
parameters = [Parameter(param) if isinstance(param, str) else param for param in gate.parameters]
54-
return Gate(gate.operator, parameters, [unpack_qubit(qubit_id)]) # type: ignore
54+
return Gate(gate.operator, parameters, [unpack_qubit(qubit_id)])
5555

5656
if gate.operator == Supported1QGate.RZ:
5757
return Gate(Supported1QGate.RZ, [Parameter("theta")], [unpack_qubit(qubit_id)])

pyquil/quilatom.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,11 @@ def format_parameter(element: ParameterDesignator) -> str:
404404
:param element: The parameter to format for Quil output.
405405
"""
406406
if isinstance(element, (int, np.integer)):
407-
return repr(element)
408-
elif isinstance(element, float):
409-
return _check_for_pi(element)
410-
elif isinstance(element, complex):
407+
return repr(int(element))
408+
elif isinstance(element, (float, np.floating)):
409+
return _check_for_pi(float(element))
410+
elif isinstance(element, (complex, np.complexfloating)):
411+
element = complex(element.real, element.imag)
411412
out = ""
412413
r = element.real
413414
i = element.imag

test/unit/test_parameters.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
substitute_array,
1616
)
1717

18-
1918
def test_format_parameter():
2019
test_cases = [
2120
(1, "1"),

0 commit comments

Comments
 (0)