From d6b15af0ff7c8197939652b1d6f59c97d9a50240 Mon Sep 17 00:00:00 2001 From: messense Date: Wed, 11 Jan 2023 23:09:51 +0800 Subject: [PATCH 1/5] Update memoffset to 0.8 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 2dbba30074b..5bd78373db8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ edition = "2018" cfg-if = "1.0" libc = "0.2.62" parking_lot = ">= 0.11, < 0.13" -memoffset = "0.7" +memoffset = "0.8" # ffi bindings to the python interpreter, split into a separate crate so they can be used independently pyo3-ffi = { path = "pyo3-ffi", version = "=0.17.3" } From cb969b7ea04ebd82ea3fe69e092d6733b6badaad Mon Sep 17 00:00:00 2001 From: messense Date: Wed, 11 Jan 2023 23:10:11 +0800 Subject: [PATCH 2/5] Update send_wrapper to 0.6 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5bd78373db8..cfd4fda0c92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ trybuild = ">=1.0.70" rustversion = "1.0" # 1.0.0 requires Rust 1.50 proptest = { version = "0.10.1", default-features = false, features = ["std"] } -send_wrapper = "0.5" +send_wrapper = "0.6" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.61" rayon = "1.0.2" From 15b1ff6c9afc1dc3e54be7ab9385dc2107cba941 Mon Sep 17 00:00:00 2001 From: messense Date: Wed, 11 Jan 2023 23:12:41 +0800 Subject: [PATCH 3/5] Relax hashbrown version constraint to allow 0.13.x --- Cargo.toml | 2 +- noxfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cfd4fda0c92..4b31bcf156e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ inventory = { version = "0.3.0", optional = true } anyhow = { version = "1.0", optional = true } chrono = { version = "0.4", optional = true } eyre = { version = ">= 0.4, < 0.7", optional = true } -hashbrown = { version = ">= 0.9, < 0.13", optional = true } +hashbrown = { version = ">= 0.9, < 0.14", optional = true } indexmap = { version = "1.6", optional = true } num-bigint = { version = "0.4", optional = true } num-complex = { version = ">= 0.2, < 0.5", optional = true } diff --git a/noxfile.py b/noxfile.py index dbaa2ef7aa6..d04824c269a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -430,7 +430,7 @@ def set_minimal_package_versions(session: nox.Session): ) _run_cargo_set_package_version(session, "indexmap", "1.6.2") - _run_cargo_set_package_version(session, "hashbrown:0.12.3", "0.9.1") + _run_cargo_set_package_version(session, "hashbrown:0.13.1", "0.9.1") _run_cargo_set_package_version(session, "plotters", "0.3.1") _run_cargo_set_package_version(session, "plotters-svg", "0.3.1") _run_cargo_set_package_version(session, "plotters-backend", "0.3.2") From 40a51985b32686be016ed85615881d9ca482d668 Mon Sep 17 00:00:00 2001 From: messense Date: Thu, 12 Jan 2023 10:14:23 +0800 Subject: [PATCH 4/5] Set minimal package versions by parsing Cargo.lock --- noxfile.py | 91 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/noxfile.py b/noxfile.py index d04824c269a..e054224bab6 100644 --- a/noxfile.py +++ b/noxfile.py @@ -406,7 +406,14 @@ def check_changelog(session: nox.Session): @nox.session(name="set-minimal-package-versions") -def set_minimal_package_versions(session: nox.Session): +def set_minimal_package_versions(session: nox.Session, venv_backend="none"): + from collections import defaultdict + + try: + import tomllib as toml + except ImportError: + import toml + projects = ( None, "examples/decorator", @@ -414,6 +421,22 @@ def set_minimal_package_versions(session: nox.Session): "examples/setuptools-rust-starter", "examples/word-count", ) + min_pkg_versions = { + "indexmap": "1.6.2", + "hashbrown": "0.9.1", + "plotters": "0.3.1", + "plotters-svg": "0.3.1", + "plotters-backend": "0.3.2", + "bumpalo": "3.10.0", + "once_cell": "1.14.0", + "rayon": "1.5.3", + "rayon-core": "1.9.3", + # string_cache 0.8.4 depends on parking_lot 0.12 + "string_cache": "0.8.3", + # 1.15.0 depends on hermit-abi 0.2.6 which has edition 2021 and breaks 1.48.0 + "num_cpus": "1.14.0", + "parking_lot": "0.11.0", + } # run cargo update first to ensure that everything is at highest # possible version, so that this matches what CI will resolve to. @@ -429,44 +452,32 @@ def set_minimal_package_versions(session: nox.Session): external=True, ) - _run_cargo_set_package_version(session, "indexmap", "1.6.2") - _run_cargo_set_package_version(session, "hashbrown:0.13.1", "0.9.1") - _run_cargo_set_package_version(session, "plotters", "0.3.1") - _run_cargo_set_package_version(session, "plotters-svg", "0.3.1") - _run_cargo_set_package_version(session, "plotters-backend", "0.3.2") - _run_cargo_set_package_version(session, "bumpalo", "3.10.0") - _run_cargo_set_package_version(session, "once_cell", "1.14.0") - _run_cargo_set_package_version(session, "rayon", "1.5.3") - _run_cargo_set_package_version(session, "rayon-core", "1.9.3") - - # string_cache 0.8.4 depends on parking_lot 0.12 - _run_cargo_set_package_version(session, "string_cache:0.8.4", "0.8.3") - - # 1.15.0 depends on hermit-abi 0.2.6 which has edition 2021 and breaks 1.48.0 - _run_cargo_set_package_version(session, "num_cpus", "1.14.0") - _run_cargo_set_package_version( - session, "num_cpus", "1.14.0", project="examples/word-count" - ) - - projects = ( - None, - "examples/decorator", - "examples/maturin-starter", - "examples/setuptools-rust-starter", - "examples/word-count", - ) for project in projects: - _run_cargo_set_package_version( - session, "parking_lot:0.12.1", "0.11.0", project=project - ) - _run_cargo_set_package_version(session, "once_cell", "1.14.0", project=project) - - _run_cargo_set_package_version( - session, "rayon", "1.5.3", project="examples/word-count" - ) - _run_cargo_set_package_version( - session, "rayon-core", "1.9.3", project="examples/word-count" - ) + lock_file = Path(project or "") / "Cargo.lock" + + def load_pkg_versions(): + cargo_lock = toml.loads(lock_file.read_text()) + # Cargo allows to depends on multiple versions of the same package + pkg_versions = defaultdict(list) + for pkg in cargo_lock["package"]: + name = pkg["name"] + if name not in min_pkg_versions: + continue + pkg_versions[name].append(pkg["version"]) + return pkg_versions + + pkg_versions = load_pkg_versions() + for (pkg_name, min_version) in min_pkg_versions.items(): + versions = pkg_versions.get(pkg_name, []) + for version in versions: + if version != min_version: + pkg_id = pkg_name + ":" + version + _run_cargo_set_package_version( + session, pkg_id, min_version, project=project + ) + # assume `_run_cargo_set_package_version` has changed something + # and re-read `Cargo.lock` + pkg_versions = load_pkg_versions() # As a smoke test, cargo metadata solves all dependencies, so # will break if any crates rely on cargo features not @@ -595,12 +606,12 @@ def _run_cargo_publish(session: nox.Session, *, package: str) -> None: def _run_cargo_set_package_version( session: nox.Session, - package: str, + pkg_id: str, version: str, *, project: Optional[str] = None, ) -> None: - command = ["cargo", "update", "-p", package, "--precise", version] + command = ["cargo", "update", "-p", pkg_id, "--precise", version] if project: command.append(f"--manifest-path={project}/Cargo.toml") _run(session, *command, external=True) From a7a9daed24c761f271d0092bdb50f2ca79aa6004 Mon Sep 17 00:00:00 2001 From: messense Date: Thu, 12 Jan 2023 13:56:48 +0800 Subject: [PATCH 5/5] Add a changelog entry for `#2875` --- newsfragments/2875.changed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 newsfragments/2875.changed.md diff --git a/newsfragments/2875.changed.md b/newsfragments/2875.changed.md new file mode 100644 index 00000000000..b2f82e4b433 --- /dev/null +++ b/newsfragments/2875.changed.md @@ -0,0 +1 @@ +Update `memoffset` to 0.8 and relax `hashbrown` version constraint to allow 0.13.x