Skip to content

Commit 0e409f1

Browse files
Add python3.14 and remove python3.9. Upgrade twisterl to 0.5.1. Upgrade pyo3 0.27.2 (#13)
* Add python3.14 and remove python3.9. Upgrade twisterl to 0.5.0. Upgrade pyo3 0.27.2 * Add python 3.14. Remove python 3.9. Resrict macos x86 * Update min python version in pyproject
1 parent 3621baa commit 0e409f1

File tree

5 files changed

+67
-57
lines changed

5 files changed

+67
-57
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ jobs:
2020
# Used for the ARM builds.
2121
- macos-15
2222
- windows-latest
23-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
23+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
24+
exclude:
25+
# torch wheels not available for macOS x86_64 on Python >= 3.13
26+
- os: macos-15-intel
27+
python-version: '3.13'
28+
- os: macos-15-intel
29+
python-version: '3.14'
2430
steps:
2531
- uses: actions/checkout@v4
2632
- uses: actions/setup-python@v5

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "qiskit_gym"
7-
requires-python = ">=3.9"
7+
requires-python = ">=3.10"
88
version = "0.1.0"
99
description = "A collection of quantum information science problems formulated as reinforcement learning environments"
1010
authors = [{ name = "David Kremer" }]
@@ -18,7 +18,7 @@ dynamic = ["version"]
1818
dependencies = [
1919
"qiskit>=2.1",
2020
"gymnasium",
21-
"twisterl~=0.4.1",
21+
"twisterl~=0.5.1",
2222
]
2323

2424

rust/Cargo.lock

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

rust/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ name = "qiskit_gym_rs"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "0.24", features = ["extension-module", "multiple-pymethods"] }
12+
pyo3 = { version = "0.27.2", features = ["extension-module", "multiple-pymethods"] }
1313
nalgebra = "0.33.0"
1414
rand = "0.8.4"
1515
rayon = "1.1.0"
1616
petgraph = "0.6.5"
17-
twisterl = {version = "~0.4.1", features = ["python_bindings"]}
17+
twisterl = {version = "~0.5.1", features = ["python_bindings"]}
1818

1919
[profile.release]
2020
opt-level = 3

rust/src/envs/common.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ that they have been altered from the originals.
1414
use pyo3::prelude::*;
1515
use pyo3::exceptions::{PyTypeError, PyValueError};
1616
use pyo3::types::PySequence;
17+
use pyo3::Borrowed;
1718

1819
#[derive(Clone, Debug)]
1920
pub enum Gate {
@@ -42,11 +43,13 @@ impl std::fmt::Display for Gate {
4243
}
4344
}
4445

45-
impl<'py> FromPyObject<'py> for Gate {
46-
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
46+
impl<'a, 'py> FromPyObject<'a, 'py> for Gate {
47+
type Error = PyErr;
48+
49+
fn extract(ob: Borrowed<'a, 'py, PyAny>) -> PyResult<Self> {
4750
// Expect (name, indices)
4851
let pair = ob
49-
.downcast::<PySequence>()
52+
.cast::<PySequence>()
5053
.map_err(|_| PyTypeError::new_err("Each gate must be a 2-item sequence: (name, indices)"))?;
5154
if pair.len()? != 2 {
5255
return Err(PyValueError::new_err(
@@ -63,7 +66,7 @@ impl<'py> FromPyObject<'py> for Gate {
6366

6467
let idx_obj = pair.get_item(1)?;
6568
let idx_seq = idx_obj
66-
.downcast::<PySequence>()
69+
.cast::<PySequence>()
6770
.map_err(|_| PyTypeError::new_err("Gate indices must be a list/tuple of integers"))?;
6871
let n = idx_seq.len()?;
6972
let mut idx = Vec::with_capacity(n);

0 commit comments

Comments
 (0)