Skip to content

Commit ed0f338

Browse files
bors[bot]messense
andauthored
Merge #2875
2875: Update `memoffset`, `send_wrapper` and `hashbrown` r=adamreichold a=messense Co-authored-by: messense <[email protected]>
2 parents 3fc0634 + a7a9dae commit ed0f338

File tree

3 files changed

+55
-43
lines changed

3 files changed

+55
-43
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ edition = "2018"
1717
cfg-if = "1.0"
1818
libc = "0.2.62"
1919
parking_lot = ">= 0.11, < 0.13"
20-
memoffset = "0.7"
20+
memoffset = "0.8"
2121

2222
# ffi bindings to the python interpreter, split into a separate crate so they can be used independently
2323
pyo3-ffi = { path = "pyo3-ffi", version = "=0.17.3" }
@@ -34,7 +34,7 @@ inventory = { version = "0.3.0", optional = true }
3434
anyhow = { version = "1.0", optional = true }
3535
chrono = { version = "0.4", optional = true }
3636
eyre = { version = ">= 0.4, < 0.7", optional = true }
37-
hashbrown = { version = ">= 0.9, < 0.13", optional = true }
37+
hashbrown = { version = ">= 0.9, < 0.14", optional = true }
3838
indexmap = { version = "1.6", optional = true }
3939
num-bigint = { version = "0.4", optional = true }
4040
num-complex = { version = ">= 0.2, < 0.5", optional = true }
@@ -49,7 +49,7 @@ trybuild = ">=1.0.70"
4949
rustversion = "1.0"
5050
# 1.0.0 requires Rust 1.50
5151
proptest = { version = "0.10.1", default-features = false, features = ["std"] }
52-
send_wrapper = "0.5"
52+
send_wrapper = "0.6"
5353
serde = { version = "1.0", features = ["derive"] }
5454
serde_json = "1.0.61"
5555
rayon = "1.0.2"

newsfragments/2875.changed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update `memoffset` to 0.8 and relax `hashbrown` version constraint to allow 0.13.x

noxfile.py

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,37 @@ def check_changelog(session: nox.Session):
406406

407407

408408
@nox.session(name="set-minimal-package-versions")
409-
def set_minimal_package_versions(session: nox.Session):
409+
def set_minimal_package_versions(session: nox.Session, venv_backend="none"):
410+
from collections import defaultdict
411+
412+
try:
413+
import tomllib as toml
414+
except ImportError:
415+
import toml
416+
410417
projects = (
411418
None,
412419
"examples/decorator",
413420
"examples/maturin-starter",
414421
"examples/setuptools-rust-starter",
415422
"examples/word-count",
416423
)
424+
min_pkg_versions = {
425+
"indexmap": "1.6.2",
426+
"hashbrown": "0.9.1",
427+
"plotters": "0.3.1",
428+
"plotters-svg": "0.3.1",
429+
"plotters-backend": "0.3.2",
430+
"bumpalo": "3.10.0",
431+
"once_cell": "1.14.0",
432+
"rayon": "1.5.3",
433+
"rayon-core": "1.9.3",
434+
# string_cache 0.8.4 depends on parking_lot 0.12
435+
"string_cache": "0.8.3",
436+
# 1.15.0 depends on hermit-abi 0.2.6 which has edition 2021 and breaks 1.48.0
437+
"num_cpus": "1.14.0",
438+
"parking_lot": "0.11.0",
439+
}
417440

418441
# run cargo update first to ensure that everything is at highest
419442
# possible version, so that this matches what CI will resolve to.
@@ -429,44 +452,32 @@ def set_minimal_package_versions(session: nox.Session):
429452
external=True,
430453
)
431454

432-
_run_cargo_set_package_version(session, "indexmap", "1.6.2")
433-
_run_cargo_set_package_version(session, "hashbrown:0.12.3", "0.9.1")
434-
_run_cargo_set_package_version(session, "plotters", "0.3.1")
435-
_run_cargo_set_package_version(session, "plotters-svg", "0.3.1")
436-
_run_cargo_set_package_version(session, "plotters-backend", "0.3.2")
437-
_run_cargo_set_package_version(session, "bumpalo", "3.10.0")
438-
_run_cargo_set_package_version(session, "once_cell", "1.14.0")
439-
_run_cargo_set_package_version(session, "rayon", "1.5.3")
440-
_run_cargo_set_package_version(session, "rayon-core", "1.9.3")
441-
442-
# string_cache 0.8.4 depends on parking_lot 0.12
443-
_run_cargo_set_package_version(session, "string_cache:0.8.4", "0.8.3")
444-
445-
# 1.15.0 depends on hermit-abi 0.2.6 which has edition 2021 and breaks 1.48.0
446-
_run_cargo_set_package_version(session, "num_cpus", "1.14.0")
447-
_run_cargo_set_package_version(
448-
session, "num_cpus", "1.14.0", project="examples/word-count"
449-
)
450-
451-
projects = (
452-
None,
453-
"examples/decorator",
454-
"examples/maturin-starter",
455-
"examples/setuptools-rust-starter",
456-
"examples/word-count",
457-
)
458455
for project in projects:
459-
_run_cargo_set_package_version(
460-
session, "parking_lot:0.12.1", "0.11.0", project=project
461-
)
462-
_run_cargo_set_package_version(session, "once_cell", "1.14.0", project=project)
463-
464-
_run_cargo_set_package_version(
465-
session, "rayon", "1.5.3", project="examples/word-count"
466-
)
467-
_run_cargo_set_package_version(
468-
session, "rayon-core", "1.9.3", project="examples/word-count"
469-
)
456+
lock_file = Path(project or "") / "Cargo.lock"
457+
458+
def load_pkg_versions():
459+
cargo_lock = toml.loads(lock_file.read_text())
460+
# Cargo allows to depends on multiple versions of the same package
461+
pkg_versions = defaultdict(list)
462+
for pkg in cargo_lock["package"]:
463+
name = pkg["name"]
464+
if name not in min_pkg_versions:
465+
continue
466+
pkg_versions[name].append(pkg["version"])
467+
return pkg_versions
468+
469+
pkg_versions = load_pkg_versions()
470+
for (pkg_name, min_version) in min_pkg_versions.items():
471+
versions = pkg_versions.get(pkg_name, [])
472+
for version in versions:
473+
if version != min_version:
474+
pkg_id = pkg_name + ":" + version
475+
_run_cargo_set_package_version(
476+
session, pkg_id, min_version, project=project
477+
)
478+
# assume `_run_cargo_set_package_version` has changed something
479+
# and re-read `Cargo.lock`
480+
pkg_versions = load_pkg_versions()
470481

471482
# As a smoke test, cargo metadata solves all dependencies, so
472483
# will break if any crates rely on cargo features not
@@ -595,12 +606,12 @@ def _run_cargo_publish(session: nox.Session, *, package: str) -> None:
595606

596607
def _run_cargo_set_package_version(
597608
session: nox.Session,
598-
package: str,
609+
pkg_id: str,
599610
version: str,
600611
*,
601612
project: Optional[str] = None,
602613
) -> None:
603-
command = ["cargo", "update", "-p", package, "--precise", version]
614+
command = ["cargo", "update", "-p", pkg_id, "--precise", version]
604615
if project:
605616
command.append(f"--manifest-path={project}/Cargo.toml")
606617
_run(session, *command, external=True)

0 commit comments

Comments
 (0)