diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 0a1c2885a..29e175372 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -154,6 +154,82 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: wheelhouse/ + build_wheels_musl_aarch64: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + environment: release + permissions: + id-token: write + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + name: Install Python + with: + python-version: '3.8' + - uses: dtolnay/rust-toolchain@stable + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: all + - name: Install cibuildwheel + run: | + python -m pip install cibuildwheel==2.16.2 + - name: Build wheels + run: | + python -m cibuildwheel --output-dir wheelhouse + env: + CIBW_ARCHS_LINUX: aarch64 + CIBW_SKIP: cp36-* cp37-* cp311-* cp312-* *many* + CIBW_TEST_SKIP: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* *many* + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: wheelhouse/ + build_wheels_musl_aarch64_part_2: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + environment: release + permissions: + id-token: write + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + name: Install Python + with: + python-version: '3.8' + - uses: dtolnay/rust-toolchain@stable + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: all + - name: Install cibuildwheel + run: | + python -m pip install cibuildwheel==2.16.2 + - name: Build wheels + run: | + python -m cibuildwheel --output-dir wheelhouse + env: + CIBW_ARCHS_LINUX: aarch64 + CIBW_SKIP: cp36-* cp37-* cp38-* cp39-* cp310-* *many* + CIBW_TEST_SKIP: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* *many* + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: wheelhouse/ build_wheels_ppc64le: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/Cargo.lock b/Cargo.lock index 90a5de9ea..93b46008b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,14 +4,15 @@ version = 3 [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "getrandom", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -128,9 +129,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" dependencies = [ "ahash", "allocator-api2", @@ -161,12 +162,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.1", + "hashbrown 0.14.2", "rayon", ] @@ -214,9 +215,9 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -378,9 +379,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", @@ -396,7 +397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.2", + "indexmap 2.1.0", ] [[package]] @@ -431,8 +432,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04e8453b658fe480c3e70c8ed4e3d3ec33eb74988bd186561b0cc66b85c3bc4b" dependencies = [ "cfg-if", - "hashbrown 0.14.1", - "indexmap 2.0.2", + "hashbrown 0.14.2", + "indexmap 2.1.0", "indoc", "libc", "memoffset", @@ -491,9 +492,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" +checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" dependencies = [ "memchr", ] @@ -585,9 +586,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags", ] @@ -604,8 +605,8 @@ version = "0.14.0" dependencies = [ "ahash", "fixedbitset", - "hashbrown 0.14.1", - "indexmap 2.0.2", + "hashbrown 0.14.2", + "indexmap 2.1.0", "ndarray", "ndarray-stats", "num-bigint", @@ -630,8 +631,8 @@ version = "0.14.0" dependencies = [ "ahash", "fixedbitset", - "hashbrown 0.14.1", - "indexmap 2.0.2", + "hashbrown 0.14.2", + "indexmap 2.1.0", "num-traits", "petgraph", "priority-queue", @@ -655,18 +656,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -675,9 +676,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -718,9 +719,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.11" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" +checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" [[package]] name = "unicode-ident" @@ -802,3 +803,23 @@ name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "zerocopy" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686b7e407015242119c33dab17b8f61ba6843534de936d94368856528eae4dcc" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020f3dfe25dfc38dfea49ce62d5d45ecdd7f0d8a724fa63eb36b6eba4ec76806" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index d8fba5163..e5fc6bbc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ repository = "https://github.com/Qiskit/rustworkx" license = "Apache-2.0" [workspace.dependencies] -ahash = "0.8.3" +ahash = "0.8.6" fixedbitset = "0.4.2" hashbrown = { version = ">=0.13, <0.15", features = ["rayon"] } indexmap = { version = ">=1.9, <3", features = ["rayon"] } @@ -51,7 +51,7 @@ num-complex = "0.4" num-traits.workspace = true numpy.workspace = true petgraph.workspace = true -quick-xml = "0.30" +quick-xml = "0.31" rand.workspace = true rand_pcg.workspace = true rayon.workspace = true diff --git a/docs/source/install.rst b/docs/source/install.rst index f55bcb711..b2f961ec2 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -93,6 +93,10 @@ source. - x86_64 - :ref:`tier-3` - + * - Linux (musl) + - aarch64 + - :ref:`tier-4` + - * - macOS (10.12 or newer) - x86_64 - :ref:`tier-1` diff --git a/releasenotes/notes/fix-all-simple-paths-03f4534438d1068d.yaml b/releasenotes/notes/fix-all-simple-paths-03f4534438d1068d.yaml new file mode 100644 index 000000000..e56393348 --- /dev/null +++ b/releasenotes/notes/fix-all-simple-paths-03f4534438d1068d.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixed the behavior of :func:`~rustworkx.graph_all_simple_paths` and + :func:`~rustworkx.digraph_all_simple_paths` when ``min_depth`` is set to + ``0``. Refer to `#955 `__ for + more information. diff --git a/releasenotes/notes/numpy-2-pin-11bc3a379fb29bf7.yaml b/releasenotes/notes/numpy-2-pin-11bc3a379fb29bf7.yaml new file mode 100644 index 000000000..d5ac7a617 --- /dev/null +++ b/releasenotes/notes/numpy-2-pin-11bc3a379fb29bf7.yaml @@ -0,0 +1,12 @@ +--- +other: + - | + This version of rustworkx is explicitly pinned to the Numpy 1.x series, + because it includes compiled extensions that are not yet compiled against + the as-yet-unreleased Numpy 2.x series. We will release a new version of + rustworkx with Numpy 2.x support as soon as feasible. + + We cannot prevent your package manager from resolving to older versions of + rustworkx (which do not have the same pin but are still likely to be + incompatible) if you forcibly try to install rustworkx alongside Numpy 2, + before we have released a compatible version. diff --git a/releasenotes/notes/platform-updates-e9b296144e633c95.yaml b/releasenotes/notes/platform-updates-e9b296144e633c95.yaml index 876fabbc8..adbf3bd27 100644 --- a/releasenotes/notes/platform-updates-e9b296144e633c95.yaml +++ b/releasenotes/notes/platform-updates-e9b296144e633c95.yaml @@ -1,7 +1,8 @@ --- features: - | - Added support for musl Linux platforms on x86_64 and aarch64 at :ref:`tier-3`. + Added support for musl Linux platforms on x86_64 at :ref:`tier-3` + and aarch64 at :ref:`tier-4`. upgrade: - | Support for the Linux ppc64le pllatform has changed from tier 3 to tier 4 diff --git a/setup.py b/setup.py index 7c0eac95d..4843ca98b 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ def readme(): PKG_NAME = os.getenv("RUSTWORKX_PKG_NAME", "rustworkx") PKG_VERSION = "0.14.0" PKG_PACKAGES = ["rustworkx", "rustworkx.visualization"] -PKG_INSTALL_REQUIRES = ["numpy>=1.16.0"] +PKG_INSTALL_REQUIRES = ["numpy>=1.16.0,<2"] RUST_EXTENSIONS = [RustExtension("rustworkx.rustworkx", "Cargo.toml", binding=Binding.PyO3, debug=rustworkx_debug)] diff --git a/src/connectivity/mod.rs b/src/connectivity/mod.rs index efd803eb5..77c5c4ad5 100644 --- a/src/connectivity/mod.rs +++ b/src/connectivity/mod.rs @@ -548,8 +548,8 @@ pub fn graph_all_simple_paths( )); } let min_intermediate_nodes: usize = match min_depth { + Some(0) | None => 0, Some(depth) => depth - 2, - None => 0, }; let cutoff_petgraph: Option = cutoff.map(|depth| depth - 2); let result: Vec> = algo::all_simple_paths( @@ -573,7 +573,7 @@ pub fn graph_all_simple_paths( /// :param int to: The node index to find the paths to /// :param int min_depth: The minimum depth of the path to include in the output /// list of paths. By default all paths are included regardless of depth, -/// sett to 0 will behave like the default. +/// setting to 0 will behave like the default. /// :param int cutoff: The maximum depth of path to include in the output list /// of paths. By default includes all paths regardless of depth, setting to /// 0 will behave like default. @@ -602,8 +602,8 @@ pub fn digraph_all_simple_paths( )); } let min_intermediate_nodes: usize = match min_depth { + Some(0) | None => 0, Some(depth) => depth - 2, - None => 0, }; let cutoff_petgraph: Option = cutoff.map(|depth| depth - 2); let result: Vec> = algo::all_simple_paths( diff --git a/tests/rustworkx_tests/digraph/test_all_simple_paths.py b/tests/rustworkx_tests/digraph/test_all_simple_paths.py index c63ea2c41..3ee4ed54b 100644 --- a/tests/rustworkx_tests/digraph/test_all_simple_paths.py +++ b/tests/rustworkx_tests/digraph/test_all_simple_paths.py @@ -53,6 +53,25 @@ def test_all_simple_paths(self): for i in expected: self.assertIn(i, paths) + def test_all_simple_paths_default_min_depth(self): + dag = rustworkx.PyDAG() + for i in range(6): + dag.add_node(i) + dag.add_edges_from_no_data(self.edges) + paths = rustworkx.digraph_all_simple_paths(dag, 0, 5, min_depth=0) + expected = [ + [0, 1, 2, 3, 4, 5], + [0, 1, 2, 4, 5], + [0, 1, 3, 2, 4, 5], + [0, 1, 3, 4, 5], + [0, 2, 3, 4, 5], + [0, 2, 4, 5], + [0, 3, 2, 4, 5], + [0, 3, 4, 5], + ] + for i in expected: + self.assertIn(i, paths) + def test_all_simple_paths_min_depth(self): dag = rustworkx.PyDAG() for i in range(6): diff --git a/tests/rustworkx_tests/graph/test_all_simple_paths.py b/tests/rustworkx_tests/graph/test_all_simple_paths.py index b179be29a..9e0ad998f 100644 --- a/tests/rustworkx_tests/graph/test_all_simple_paths.py +++ b/tests/rustworkx_tests/graph/test_all_simple_paths.py @@ -89,6 +89,61 @@ def test_all_simple_paths(self): for i in expected: self.assertIn(i, paths) + def test_all_simple_paths_default_min_depth(self): + graph = rustworkx.PyGraph() + for i in range(6): + graph.add_node(i) + graph.add_edges_from_no_data(self.edges) + paths = rustworkx.graph_all_simple_paths(graph, 0, 5, min_depth=0) + expected = [ + [0, 3, 4, 5], + [0, 3, 4, 2, 5], + [0, 3, 4, 2, 5], + [0, 3, 2, 4, 5], + [0, 3, 2, 5], + [0, 3, 2, 4, 5], + [0, 3, 5], + [0, 3, 2, 4, 5], + [0, 3, 2, 5], + [0, 3, 2, 4, 5], + [0, 3, 1, 2, 4, 5], + [0, 3, 1, 2, 5], + [0, 3, 1, 2, 4, 5], + [0, 2, 4, 5], + [0, 2, 4, 3, 5], + [0, 2, 3, 4, 5], + [0, 2, 3, 5], + [0, 2, 5], + [0, 2, 4, 5], + [0, 2, 4, 3, 5], + [0, 2, 3, 4, 5], + [0, 2, 3, 5], + [0, 2, 1, 3, 4, 5], + [0, 2, 1, 3, 5], + [0, 1, 3, 4, 5], + [0, 1, 3, 4, 2, 5], + [0, 1, 3, 4, 2, 5], + [0, 1, 3, 2, 4, 5], + [0, 1, 3, 2, 5], + [0, 1, 3, 2, 4, 5], + [0, 1, 3, 5], + [0, 1, 3, 2, 4, 5], + [0, 1, 3, 2, 5], + [0, 1, 3, 2, 4, 5], + [0, 1, 2, 4, 5], + [0, 1, 2, 4, 3, 5], + [0, 1, 2, 3, 4, 5], + [0, 1, 2, 3, 5], + [0, 1, 2, 5], + [0, 1, 2, 4, 5], + [0, 1, 2, 4, 3, 5], + [0, 1, 2, 3, 4, 5], + [0, 1, 2, 3, 5], + ] + self.assertEqual(len(expected), len(paths)) + for i in expected: + self.assertIn(i, paths) + def test_all_simple_paths_with_min_depth(self): graph = rustworkx.PyGraph() for i in range(6):