Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ff76ef8
Remove retworkx and Python 3.9 support
IvanIsCoding Sep 21, 2025
729755d
Add release notes for Python 3.9 EoL
IvanIsCoding Sep 21, 2025
2fbb343
Add retworkx removal release note
IvanIsCoding Sep 21, 2025
7df0fe9
Merge remote-tracking branch 'upstream/main' into remove-39-retworkx
IvanIsCoding Sep 21, 2025
3084019
Drop 3.9 support in pyproject.toml and uv
IvanIsCoding Sep 21, 2025
1dd621c
Bump other 39 -> 310 related things
IvanIsCoding Sep 21, 2025
f52487b
Merge remote-tracking branch 'upstream/main' into remove-39-retworkx
IvanIsCoding Oct 24, 2025
e5ca8f4
use 3.14 not 3.14-dev
IvanIsCoding Oct 24, 2025
78ce745
Move note to upgrade
IvanIsCoding Oct 24, 2025
711cfdc
Upgrade packages to support 3.14
IvanIsCoding Nov 2, 2025
03afe1b
Allowlist missing __all__ for mypy
IvanIsCoding Nov 2, 2025
a222850
Add 3.14 to workflow
IvanIsCoding Nov 2, 2025
7c87aa7
Add release note
IvanIsCoding Nov 2, 2025
fe13da0
Use Python 3.12 for release
IvanIsCoding Nov 2, 2025
03e6329
Skip Python 3.9
IvanIsCoding Nov 2, 2025
1ebe14a
Skip 3.14 free-threaded build
IvanIsCoding Nov 2, 2025
5b76c1f
Bump nox as well
IvanIsCoding Nov 3, 2025
e33e188
Merge branch 'main' into remove-39-retworkx
IvanIsCoding Nov 4, 2025
b875800
Merge branch 'main' into upgrade-314
IvanIsCoding Nov 4, 2025
795ad00
Use ruff
IvanIsCoding Nov 30, 2025
9b124f5
Use ruff in CI
IvanIsCoding Nov 30, 2025
6ea0993
Merge branch 'main' into ruff-format
IvanIsCoding Nov 30, 2025
435fb73
Merge branch 'main' into ruff-format
IvanIsCoding Dec 5, 2025
a2c5ea0
Merge branch 'main' into upgrade-314
IvanIsCoding Dec 5, 2025
7bd603c
Merge branch 'main' into remove-39-retworkx
IvanIsCoding Dec 5, 2025
b9d1a15
Use macos-15-intel for tests
IvanIsCoding Dec 13, 2025
cfa1ae6
Update wheels.yml to use macos-15-intel
IvanIsCoding Dec 13, 2025
418b6fc
Merge branch 'remove-39-retworkx' into upgrade-314
IvanIsCoding Dec 13, 2025
9e0b0b3
Merge branch 'upgrade-314' into ruff-format
IvanIsCoding Dec 13, 2025
11b9252
Merge branch 'main' into upgrade-314
IvanIsCoding Dec 13, 2025
b5600b9
Merge branch 'main' into ruff-format
IvanIsCoding Dec 13, 2025
ed086f9
Migrate to maturin
IvanIsCoding Dec 14, 2025
a3b4b07
Faster docs build
IvanIsCoding Dec 14, 2025
f443243
Try to fix coverage build
IvanIsCoding Dec 14, 2025
b8ce8cd
Use the PROFILE environment variable
IvanIsCoding Dec 14, 2025
ebe63c7
Another attempt
IvanIsCoding Dec 14, 2025
14f35bc
use release directory
IvanIsCoding Dec 14, 2025
bf72c35
Merge remote-tracking branch 'upstream/main' into upgrade-314
IvanIsCoding Dec 16, 2025
f53d0bc
Apply suggestions from code review
IvanIsCoding Dec 16, 2025
42ad1e1
Merge branch 'upgrade-314' into ruff-format
IvanIsCoding Dec 16, 2025
a4b4b77
Merge branch 'ruff-format' into free-threaded-314
IvanIsCoding Dec 16, 2025
25f0345
Reflect cibuildwheel in uv
IvanIsCoding Dec 16, 2025
c5d5c0d
Merge branch 'upgrade-314' into ruff-format
IvanIsCoding Dec 16, 2025
d52e23a
Merge branch 'ruff-format' into free-threaded-314
IvanIsCoding Dec 16, 2025
c4b9f4e
Merge branch 'main' into upgrade-314
IvanIsCoding Jan 1, 2026
f9a9a09
Merge branch 'upgrade-314' into ruff-format
IvanIsCoding Jan 1, 2026
2d78c29
Merge branch 'ruff-format' into free-threaded-314
IvanIsCoding Jan 1, 2026
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
19 changes: 13 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Black Codestyle Format
run: black --check --diff rustworkx tests
- name: Ruff Codestyle Format
run: ruff format --check --diff rustworkx tests
- name: Python Lint
run: ruff check rustworkx setup.py tests
- name: Check stray release notes
Expand All @@ -61,7 +61,7 @@ jobs:
strategy:
matrix:
rust: [stable]
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
platform: [
{ os: "macos-15-intel", python-architecture: "x64", rust-target: "x86_64-apple-darwin" },
{ os: "macOS-14", python-architecture: "arm64", rust-target: "aarch64-apple-darwin" },
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -146,7 +146,14 @@ jobs:
- name: Build rustworkx
run: pip install .
env:
SETUPTOOLS_RUST_CARGO_PROFILE: "dev"
CARGO_PROFILE_RELEASE_OPT_LEVEL: "0"
CARGO_PROFILE_RELEASE_DEBUG: "true"
CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS: "true"
CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS: "true"
CARGO_PROFILE_RELEASE_LTO: "false"
CARGO_PROFILE_RELEASE_PANIC: "unwind"
CARGO_PROFILE_RELEASE_INCREMENTAL: "true"
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16"
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "rustworkx-%p-%m.profraw"
Expand All @@ -158,7 +165,7 @@ jobs:
run: |
set -e
mv tests/rustworkx*profraw .
./grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o ./coveralls.lcov
./grcov . --binary-path ./target/release/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o ./coveralls.lcov
- uses: actions/upload-artifact@v4
with:
name: coverage
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
python-version: '3.12'
- name: Install deps
run: pip install -U setuptools-rust build
- name: Build sdist
Expand All @@ -53,7 +53,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
python-version: '3.12'
- uses: dtolnay/rust-toolchain@stable
- name: Install cibuildwheel
run: |
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
python-version: '3.12'
- uses: dtolnay/rust-toolchain@stable
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -110,7 +110,7 @@ jobs:
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: cp36-* cp37-* pp* *win32 *musl*
CIBW_SKIP: pp* cp314t* *win32 *musl*
CIBW_ARCHS_LINUX: ppc64le
- uses: actions/upload-artifact@v4
with:
Expand All @@ -135,7 +135,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
python-version: '3.12'
- uses: dtolnay/rust-toolchain@stable
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -148,7 +148,7 @@ jobs:
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: cp36-* cp37-* pp* *win32 *musl*
CIBW_SKIP: pp* cp314t* *win32 *musl*
CIBW_ARCHS_LINUX: s390x
- uses: actions/upload-artifact@v4
with:
Expand All @@ -167,7 +167,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
python-version: '3.12'
architecture: 'x86'
- uses: dtolnay/rust-toolchain@stable
with:
Expand All @@ -181,7 +181,7 @@ jobs:
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: cp36-* cp37-* pp* *amd64 *musl*
CIBW_SKIP: pp* cp314t* *amd64 *musl*
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ cargo clippy --workspace --all-targets -- -D warnings

Python is used primarily for tests and some small pieces of packaging
and namespace configuration code in the actual library.
[black](https://github.com/psf/black) and [flake8](https://flake8.pycqa.org/en/latest/) are used to enforce consistent
[ruff](https://github.com/astral-sh/ruff) is used to enforce consistent
style in the python code in the repository. You can run them via Nox using:

```bash
Expand All @@ -295,7 +295,7 @@ nox -e lint
This will also run `cargo fmt` in check mode to ensure that you ran `cargo fmt`
and will fail if the Rust code doesn't conform to the style rules.

If black returns a code formatting error you can run `nox -e black` to automatically
If ruff returns a code formatting error you can run `nox -e format` to automatically
update the code formatting to conform to the style.

### Building documentation
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ it just as it would if there was a prebuilt binary available.
> [!NOTE]
> To build from source you will need to ensure you have pip >=19.0.0
installed, which supports PEP-517, or that you have manually installed
`setuptools-rust>=1.9` prior to running `pip install rustworkx`. If you receive an
error about `setuptools-rust` not being found you should upgrade pip with
`pip install -U pip` or manually install `setuptools-rust` with
`pip install -U setuptools-rust` and try again.
`maturin>=1.9` prior to running `pip install rustworkx`. If you receive an
error about `maturin` not being found you should upgrade pip with
`pip install -U pip` or manually install `maturin` with
`pip install -U maturin>=1.9` and try again.

### Optional dependencies

Expand Down Expand Up @@ -134,7 +134,7 @@ git clone https://github.com/Qiskit/rustworkx.git
```

rustworkx uses [PyO3](https://github.com/pyo3/pyo3) and
[setuptools-rust](https://github.com/PyO3/setuptools-rust) to build the
[maturin](https://github.com/PyO3/maturin) to build the
python interface, which enables using standard python tooling to work. So,
assuming you have rust installed, you can easily install rustworkx into your
python environment using `pip`. Once you have a local clone of the repo, change
Expand Down Expand Up @@ -166,8 +166,8 @@ changes reflected in your python environment.
### Develop Mode

If you'd like to build rustworkx in debug mode and use an interactive debugger
while working on a change you can set `SETUPTOOLS_RUST_CARGO_PROFILE="dev"`
as an environment variable to build and install rustworkx in develop mode.
while working on a change you can run `maturin build --profile dev` to build rustworkx
and then install the wheel with `pip`.
This will build rustworkx without optimizations and include debuginfo
when running `pip install`. That can be handy for debugging.

Expand Down
4 changes: 2 additions & 2 deletions docs/source/tutorial/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,9 @@ operations on the graph. For example:

.. jupyter-execute::

lolipop_graph = rx.generators.lollipop_graph(4, 3)
lollipop_graph = rx.generators.lollipop_graph(4, 3)
mesh_graph = rx.generators.mesh_graph(4)
combined_graph = rx.cartesian_product(lolipop_graph, mesh_graph)[0]
combined_graph = rx.cartesian_product(lollipop_graph, mesh_graph)[0]
mpl_draw(combined_graph)

Additionally there are alternate constructors such as
Expand Down
17 changes: 12 additions & 5 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_with_version(session):

@nox.session(python=["3"])
def lint(session):
black(session)
format(session)
typos(session)
session.install(*lint_deps)
session.run("ruff", "check", "rustworkx", "setup.py")
Expand All @@ -44,7 +44,9 @@ def docs(session):
session.env["UV_PROJECT_ENVIRONMENT"] = session.virtualenv.location
session.env["UV_FROZEN"] = "1"
# faster build as generating docs already takes some time and we discard the env
session.env["SETUPTOOLS_RUST_CARGO_PROFILE"] = "dev"
session.env["CARGO_PROFILE_RELEASE_OPT_LEVEL"] = "1"
session.env["CARGO_PROFILE_RELEASE_CODEGEN_UNITS"] = "16"
session.env["CARGO_PROFILE_RELEASE_LTO"] = "thin"
session.run("uv", "sync", "--only-group", "docs")
session.install(".")
session.run(
Expand All @@ -71,10 +73,15 @@ def docs_clean(session):
session.chdir("docs")
session.run("rm", "-rf", "build", "source/apiref", external=True)

@nox.session(python=["3"])
def format(session):
session.install(*[d for d in lint_deps if "ruff" in d])
session.run("ruff", "format", "rustworkx", "tests", *session.posargs)

@nox.session(python=["3"])
def black(session):
session.install(*[d for d in lint_deps if "black" in d])
session.run("black", "rustworkx", "tests", *session.posargs)
# Legacy black formatting session is aliased
format(session)

@nox.session(python=["3"])
def typos(session):
Expand All @@ -87,4 +94,4 @@ def stubs(session):
install_rustworkx(session)
session.install(*stubs_deps)
session.chdir("tests")
session.run("python", "-m", "mypy.stubtest", "--concise", "rustworkx")
session.run("python", "-m", "mypy.stubtest", "--concise", "rustworkx", "--allowlist", "stubs_allowlist.txt")
55 changes: 27 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@ classifiers=[
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
]
keywords = ["Networks", "Network", "Graph", "Graph Theory", "DAG"]

[tool.setuptools]
packages = ["rustworkx", "rustworkx.visualization"]
include-package-data = true
[tool.maturin]
features = ["pyo3/extension-module"]
locked = true
bindings = "pyo3"

[tool.distutils.bdist_wheel]
py-limited-api = "cp310"

[[tool.setuptools-rust.ext-modules]]
target = "rustworkx.rustworkx"
path = "Cargo.toml"
binding = "PyO3"

[project.optional-dependencies]
mpl = ["matplotlib>=3.0"]
Expand All @@ -60,28 +55,27 @@ name = "Ivan Carvalho"
email = "[email protected]"

[build-system]
requires = ["setuptools>=77.0.0", "setuptools-rust>=1.9"]
build-backend = "setuptools.build_meta"
requires = ["maturin>=1.9,<2.0"]
build-backend = "maturin"

[dependency-groups]
testinfra = [
"nox==2025.5.1",
"uv==0.7.8",
"nox==2025.10.16",
"uv==0.9.7",
]
test = [
"setuptools-rust",
"maturin>=1.9.0,<2.0",
"testtools>=2.5.0",
"networkx>=3.2",
"stestr>=4.1",
]
lint = [
"black~=24.8",
"ruff==0.11.9",
"setuptools-rust",
"typos~=1.28",
"ruff==0.14.3",
"maturin>=1.9.0,<2.0",
"typos~=1.39",
]
stubs = [
"mypy==1.11.2",
"mypy==1.17.1",
"typing-extensions>=4.4",
]
docs = [
Expand All @@ -99,15 +93,11 @@ docs = [
"lxml_html_clean",
]
releaseinfra = [
"cibuildwheel==2.23.2",
"cibuildwheel==3.3.0; python_version >= '3.11'",
]

[tool.black]
line-length = 100
target-version = ['py310', 'py311', 'py312', 'py313']

[tool.ruff]
line-length = 105 # more lenient than black due to long function signatures
line-length = 100
src = ["rustworkx", "setup.py", "tests"]
lint.select = [
"E", # pycodestyle
Expand All @@ -123,18 +113,27 @@ extend-exclude = ["doc"]
"rustworkx/__init__.py" = ["F405", "F403"]
"*.pyi" = ["F403", "F405", "PYI001", "PYI002"]

[tool.ruff.lint.pycodestyle]
max-line-length = 105 # lint has a larger limit than the formatter because of long signatures

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true

[tool.typos.default]
extend-ignore-words-re = [
"[Ss]toer",
"[Bb]rin",
]

[tool.cibuildwheel]
manylinux-x86_64-image = "manylinux2014"
manylinux-i686-image = "manylinux2014"
skip = "pp* cp36-* cp37-* cp38-* *win32 *musllinux*i686"
skip = "pp* cp314t* *win32 *musllinux*i686"
test-requires = "networkx"
test-command = "python -m unittest discover {project}/tests"
before-build = "pip install -U setuptools-rust"
before-build = "pip install -U maturin>=1.9.0,<2.0"
test-skip = "*linux_s390x *ppc64le *i686 *win32"

[tool.cibuildwheel.linux]
Expand Down
7 changes: 7 additions & 0 deletions releasenotes/notes/py-314-d9385aa5b77cb478.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
features:
- |
This is the first release of rustworkx with official support Python 3.14. Although
previous versions of rustworkx do work with Python 3.14, this release has been
tested with 3.14. Likewise, we expect future versions of Python like 3.15 to work
as well.
2 changes: 1 addition & 1 deletion rustworkx-core/src/max_weight_matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ fn expand_blossom<E>(
endpoints,
mate,
)?;
// Step to the next S-sub-blossom and note it's forwward endpoint.
// Step to the next S-sub-blossom and note it's forward endpoint.
let endpoint_index = if j < 0 {
let tmp = j - endpoint_trick as i128;
let length = blossom_endpoints[blossom].len();
Expand Down
Loading