From 85f5334568a2a1780cb3612e7a617c5574214473 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Tue, 1 Aug 2023 12:56:02 +0100 Subject: [PATCH] Use workspace versioning and relax `hashbrown`/`indexmap` deps This commit does two things: first, switch a lot of metadata-definition to use the workspace-package inheritance allowed since Rust 1.64 (including several shared dependencies); second, relax the installation requirements on `indexmap` and `hashbrown` to allow both to use their most recent two majors. Dependents can then install `rustworkx-core` using either (say) `hashbrown 0.13.2` or `hashbrown 0.14.0` as desired, and similar between `indexmap 1.9.3` and `indexmap 2.0.0`. This commit leaves the lock file in the `hashbrown 0.14.0`, `indexmap 2.0.0` state, although note that some other crate dependents still use `hashbrown 0.12.3` internally, but this doesn't matter for the public API surface. I tested it manually in the `hashbrown 0.13.2`, `indexmap 1.9.3` state by updating those two dependencies with: cargo update -p 'indexmap@2.0.0' --precise 1.9.3 cargo update -p 'hashmap@0.14.0' --precise 0.13.2 cargo update -p 'hashmap@0.12.3' --- Cargo.lock | 134 ++++++++++++++++++++++---------------- Cargo.toml | 57 ++++++++++------ rustworkx-core/Cargo.toml | 38 +++++------ 3 files changed, 129 insertions(+), 100 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5874a1169..7c73ed65b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,6 +25,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "approx" version = "0.3.2" @@ -97,9 +103,15 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "fixedbitset" @@ -126,22 +138,20 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" dependencies = [ "ahash", + "allocator-api2", "rayon", ] [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "indexmap" @@ -151,6 +161,16 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", "rayon", ] @@ -180,15 +200,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libm" @@ -251,7 +271,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af5a8477ac96877b5bd1fd67e0c28736c12943aba24eda92b127e036b0c8f400" dependencies = [ - "indexmap", + "indexmap 1.9.3", "itertools 0.10.5", "ndarray", "noisy_float", @@ -321,9 +341,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ "hermit-abi", "libc", @@ -380,7 +400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 1.9.3", ] [[package]] @@ -396,27 +416,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fff39edfcaec0d64e8d0da38564fad195d2d51b680940295fcc307366e101e61" dependencies = [ "autocfg", - "indexmap", + "indexmap 1.9.3", ] [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "pyo3" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb88ae05f306b4bfcde40ac4a51dc0b05936a9207a4b75b798c7729c4258a59" +checksum = "e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38" dependencies = [ "cfg-if", - "hashbrown 0.13.2", - "indexmap", + "hashbrown 0.14.0", + "indexmap 2.0.0", "indoc", "libc", "memoffset", @@ -431,9 +451,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "554db24f0b3c180a9c0b1268f91287ab3f17c162e15b54caaae5a6b3773396b0" +checksum = "076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5" dependencies = [ "once_cell", "target-lexicon", @@ -441,9 +461,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "922ede8759e8600ad4da3195ae41259654b9c55da4f7eec84a0ccc7d067a70a4" +checksum = "e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9" dependencies = [ "libc", "pyo3-build-config", @@ -451,9 +471,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a5caec6a1dd355964a841fcbeeb1b89fe4146c87295573f94228911af3cc5a2" +checksum = "dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -463,9 +483,9 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0b78ccbb160db1556cdb6fd96c50334c5d4ec44dc5e0a968d0a1208fa0efa8b" +checksum = "947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536" dependencies = [ "proc-macro2", "quote", @@ -483,9 +503,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -589,8 +609,8 @@ version = "0.14.0" dependencies = [ "ahash", "fixedbitset", - "hashbrown 0.13.2", - "indexmap", + "hashbrown 0.14.0", + "indexmap 2.0.0", "ndarray", "ndarray-stats", "num-bigint", @@ -615,8 +635,8 @@ version = "0.14.0" dependencies = [ "ahash", "fixedbitset", - "hashbrown 0.13.2", - "indexmap", + "hashbrown 0.14.0", + "indexmap 2.0.0", "num-traits", "petgraph", "priority-queue", @@ -628,34 +648,34 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.179" +version = "1.0.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a5bf42b8d227d4abf38a1ddb08602e229108a517cd4e5bb28f9c7eaafdce5c0" +checksum = "0ea67f183f058fe88a4e3ec6e2788e003840893b91bac4559cabedd00863b3ed" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.179" +version = "1.0.180" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "741e124f5485c7e60c03b043f79f320bff3527f4bbf12cf3831750dc46a0ec2c" +checksum = "24e744d7782b686ab3b73267ef05697159cc0e5abbed3f47f9933165e5219036" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -671,9 +691,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "sprs" @@ -703,9 +723,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", @@ -714,15 +734,15 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.8" +version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" +checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unindent" @@ -744,9 +764,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", diff --git a/Cargo.toml b/Cargo.toml index 81a7df4f8..273b86749 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,37 +1,60 @@ [package] name = "rustworkx" description = "A python graph library implemented in Rust" -version = "0.14.0" -authors = ["Matthew Treinish "] -license = "Apache-2.0" readme = "README.md" -repository = "https://github.com/Qiskit/rustworkx" keywords = ["python", "graph"] -edition = "2021" -rust-version = "1.64" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +license.workspace = true [workspace] members = [ "rustworkx-core", ] -[lib] -name = "rustworkx" -crate-type = ["cdylib"] +[workspace.package] +version = "0.14.0" +edition = "2021" +rust-version = "1.64" +authors = ["Matthew Treinish "] +repository = "https://github.com/Qiskit/rustworkx" +license = "Apache-2.0" -[dependencies] +[workspace.dependencies] ahash = "0.8.3" -petgraph = "0.6.3" fixedbitset = "0.4.2" +hashbrown = { version = ">=0.13, <0.15", features = ["rayon"] } +indexmap = { version = ">=1.9, <3", features = ["rayon"] } +num-traits = "0.2" numpy = "0.19.0" +petgraph = "0.6.3" rand = "0.8" rand_pcg = "0.3" rayon = "1.7" -num-traits = "0.2" +rayon-cond = "1.7" + +[lib] +name = "rustworkx" +crate-type = ["cdylib"] + +[dependencies] +ahash.workspace = true +fixedbitset.workspace = true +hashbrown.workspace = true +indexmap.workspace = true +ndarray-stats = "0.5.1" num-bigint = "0.4" num-complex = "0.4" -ndarray-stats = "0.5.1" +num-traits.workspace = true +numpy.workspace = true +petgraph.workspace = true quick-xml = "0.30" +rand.workspace = true +rand_pcg.workspace = true +rayon.workspace = true serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" rustworkx-core = { path = "rustworkx-core", version = "=0.14.0" } @@ -40,18 +63,10 @@ rustworkx-core = { path = "rustworkx-core", version = "=0.14.0" } version = "0.19.1" features = ["extension-module", "hashbrown", "num-bigint", "num-complex", "indexmap"] -[dependencies.hashbrown] -version = "0.13" -features = ["rayon"] - [dependencies.ndarray] version = "^0.15.6" features = ["rayon"] -[dependencies.indexmap] -version = "1.9" -features = ["rayon"] - [dependencies.sprs] version = "^0.11" features = ["multi_thread"] diff --git a/rustworkx-core/Cargo.toml b/rustworkx-core/Cargo.toml index b69869912..7b64841e8 100644 --- a/rustworkx-core/Cargo.toml +++ b/rustworkx-core/Cargo.toml @@ -1,31 +1,25 @@ [package] name = "rustworkx-core" -version = "0.14.0" -edition = "2021" -authors = ["Matthew Treinish "] description = "Rust APIs used for rustworkx algorithms" -license = "Apache-2.0" readme = "README.md" -repository = "https://github.com/Qiskit/rustworkx" -homepage = "https://github.com/Qiskit/rustworkx/tree/main/rustworkx-core" keywords = ["graph"] -rust-version = "1.64" +homepage = "https://github.com/Qiskit/rustworkx/tree/main/rustworkx-core" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +license.workspace = true [dependencies] -ahash = "0.8.3" -fixedbitset = "0.4.2" -petgraph = "0.6.3" -rand = "0.8.5" -rand_pcg = "0.3.1" -rayon = "1.7" -num-traits = "0.2" +ahash.workspace = true +fixedbitset.workspace = true +hashbrown.workspace = true +indexmap.workspace = true +num-traits.workspace = true +petgraph.workspace = true priority-queue = "1.3" +rand.workspace = true +rand_pcg.workspace = true +rayon.workspace = true rayon-cond = "0.3" - -[dependencies.hashbrown] -version = "0.13" -features = ["rayon"] - -[dependencies.indexmap] -version = "1.9" -features = ["rayon"]