Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12"]
python-version: ["3.12", "3.13", "3.14"]
os: [ubuntu-latest, windows-latest, macos-latest]
exclude:
- os: windows-latest
python-version: "3.14"

steps:
- name: Checkout code
Expand All @@ -38,7 +41,7 @@ jobs:
cache: 'pip' # Enable caching for pip dependencies

- name: Install dependencies
run: pip install -e ".[stim,dev]"
run: pip install -e ".[stim]" --group dev

- name: Run tests
run: pytest # Or your preferred testing command
173 changes: 173 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# This file is autogenerated by maturin v1.12.4
# To update, run
#
# maturin generate-ci github
#
name: Release Python Package

env:
DEFAULT_PYTHON_VERSIONS: "3.8 3.9 3.10 3.11 3.12 3.13 3.14"

on:
push:
tags:
- '*'
workflow_dispatch:

permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: aarch64
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --interpreter ${{ matrix.platform.interpreter || env.DEFAULT_PYTHON_VERSIONS }}
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v5
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

musllinux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: aarch64
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --interpreter ${{ matrix.platform.interpreter || env.DEFAULT_PYTHON_VERSIONS}}
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v5
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
python_arch: x64
interpreter: "3.11 3.12 3.13 3.14"
- runner: windows-11-arm
target: aarch64
python_arch: arm64
interpreter: "3.12 3.13 3.14"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.13
architecture: ${{ matrix.platform.python_arch }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --interpreter ${{ matrix.platform.interpreter || env.DEFAULT_PYTHON_VERSIONS}}
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Upload wheels
uses: actions/upload-artifact@v5
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-15-intel
target: x86_64
- runner: macos-latest
target: aarch64
interpreter: "3.10 3.11 3.12 3.13 3.14"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --interpreter ${{ matrix.platform.interpreter || env.DEFAULT_PYTHON_VERSIONS}}
sccache: ${{ !startsWith(github.ref, 'refs/tags/') }}
- name: Upload wheels
uses: actions/upload-artifact@v5
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist

sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v5
with:
name: wheels-sdist
path: dist

# release:
# name: Release
# runs-on: ubuntu-latest
# if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
# needs: [linux, musllinux, windows, macos, sdist]
# permissions:
# # Use to sign the release artifacts
# id-token: write
# # Used to upload release artifacts
# contents: write
# # Used to generate artifact attestation
# attestations: write
# steps:
# - uses: actions/download-artifact@v6
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v3
# with:
# subject-path: 'wheels-*/*'
# - name: Install uv
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
# uses: astral-sh/setup-uv@v7
# - name: Publish to PyPI
# if: ${{ startsWith(github.ref, 'refs/tags/') }}
# run: uv publish 'wheels-*/*'
# env:
# UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
cache: 'pip' # cache pip downloads

- name: Install Python deps (dev)
run: pip install -U pip && pip install -e ".[dev]"
run: pip install -U pip && pip install -e . --group dev

- name: Install pre-commit (if not in dev extras)
run: pip install pre-commit
Expand Down
55 changes: 15 additions & 40 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ readme = "./README.md"
[workspace.dependencies]
ndarray = {version = ">= 0.15, < 0.17", features = ["serde"]}
ndarray-npy = "0.9.1"
numpy = "0.23"
numpy = "0.28"
serde = {version = ">=1.0", features = ["derive"]}
pyo3 = "^0.23.5"
pyo3 = "~0.28"
rayon = "1.10.0"
sprs = {version = ">= 0.11"}
indicatif = {version = ">=0.17", features = ["rayon"]}
Expand Down
4 changes: 2 additions & 2 deletions crates/relay_bp_py/src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn get_sprs_bit_matrix_from_python(
) -> PyResult<SparseBitMatrix> {
let matrix = matrix.call_method1("astype", ("uint8",))?;

if let Ok(dense) = matrix.downcast::<PyArray2<Bit>>() {
if let Ok(dense) = matrix.cast::<PyArray2<Bit>>() {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason why you would want to remove downcast here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this change comes from changes to PyO3, which you can find in the release notes here: https://pyo3.rs/main/migration#from-026-to-027

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing this out!

let dense = dense.to_owned_array();
Ok(SparseBitMatrix::from_dense(dense))
} else {
Expand Down Expand Up @@ -70,7 +70,7 @@ pub fn get_sprs_bit_matrix_from_python(
}
}

#[pyclass(subclass, module = "decoder")]
#[pyclass(from_py_object, subclass, module = "decoder")]
#[derive(Clone)]
pub struct DynDecoder(pub Box<dyn DecoderInner + Send + 'static>);

Expand Down
Loading
Loading