Skip to content

Commit

Permalink
Merge #2875
Browse files Browse the repository at this point in the history
2875: Update `memoffset`, `send_wrapper` and `hashbrown` r=adamreichold a=messense



Co-authored-by: messense <messense@icloud.com>
  • Loading branch information
bors[bot] and messense authored Jan 12, 2023
2 parents 3fc0634 + a7a9dae commit ed0f338
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 43 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -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 }
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions newsfragments/2875.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update `memoffset` to 0.8 and relax `hashbrown` version constraint to allow 0.13.x
91 changes: 51 additions & 40 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,37 @@ 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",
"examples/maturin-starter",
"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.
Expand All @@ -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.12.3", "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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ed0f338

Please sign in to comment.