Skip to content

Commit 980268d

Browse files
fix check-msrv ci job by resolving to latest compatible dependencies (#4972)
* fix `check-msrv` ci job by resolving to latest compatible version using `resolver.incompatible-rust-versions = "fallback"` * Do the same for examples * Set `rust-version` in example projects * set msrv in examples, simplify noxfile * don't need toml * repeat for `pyo3-ffi` examples --------- Co-authored-by: David Hewitt <mail@davidhewitt.dev>
1 parent 059e249 commit 980268d

File tree

9 files changed

+28
-31
lines changed

9 files changed

+28
-31
lines changed

examples/decorator/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "decorator"
33
version = "0.1.0"
44
edition = "2021"
5+
rust-version = "1.63"
56

67
[lib]
78
name = "decorator"

examples/getitem/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "getitem"
33
version = "0.1.0"
44
edition = "2021"
5+
rust-version = "1.63"
56

67
[lib]
78
name = "getitem"

examples/maturin-starter/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "maturin-starter"
33
version = "0.1.0"
44
edition = "2021"
5+
rust-version = "1.63"
56

67
[lib]
78
name = "maturin_starter"

examples/plugin/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "plugin_example"
33
version = "0.1.0"
44
edition = "2021"
5-
5+
rust-version = "1.63"
66

77
[dependencies]
88
pyo3={path="../../", features=["macros"]}

examples/setuptools-rust-starter/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "setuptools-rust-starter"
33
version = "0.1.0"
44
edition = "2021"
5+
rust-version = "1.63"
56

67
[lib]
78
name = "setuptools_rust_starter"

examples/word-count/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "word-count"
33
version = "0.1.0"
44
edition = "2021"
5+
rust-version = "1.63"
56

67
[lib]
78
name = "word_count"

noxfile.py

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -624,21 +624,13 @@ def check_changelog(session: nox.Session):
624624
def set_msrv_package_versions(session: nox.Session):
625625
from collections import defaultdict
626626

627-
if toml is None:
628-
session.error("requires Python 3.11 or `toml` to be installed")
629-
630627
projects = (
631-
None,
632-
"examples/decorator",
633-
"examples/maturin-starter",
634-
"examples/setuptools-rust-starter",
635-
"examples/word-count",
628+
PYO3_DIR,
629+
*(Path(p).parent for p in glob("examples/*/Cargo.toml")),
630+
*(Path(p).parent for p in glob("pyo3-ffi/examples/*/Cargo.toml")),
636631
)
637632
min_pkg_versions = {
638-
"regex": "1.9.6",
639-
"proptest": "1.2.0",
640633
"trybuild": "1.0.89",
641-
"eyre": "0.6.8",
642634
"allocator-api2": "0.2.10",
643635
"indexmap": "2.5.0", # to be compatible with hashbrown 0.14
644636
"hashbrown": "0.14.5", # https://github.com/rust-lang/hashbrown/issues/574
@@ -647,13 +639,15 @@ def set_msrv_package_versions(session: nox.Session):
647639
# run cargo update first to ensure that everything is at highest
648640
# possible version, so that this matches what CI will resolve to.
649641
for project in projects:
650-
if project is None:
651-
_run_cargo(session, "update")
652-
else:
653-
_run_cargo(session, "update", f"--manifest-path={project}/Cargo.toml")
642+
_run_cargo(
643+
session,
644+
"+stable",
645+
"update",
646+
f"--manifest-path={project}/Cargo.toml",
647+
env=os.environ | {"CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS": "fallback"},
648+
)
654649

655-
for project in projects:
656-
lock_file = Path(project or "") / "Cargo.lock"
650+
lock_file = project / "Cargo.lock"
657651

658652
def load_pkg_versions():
659653
cargo_lock = toml.loads(lock_file.read_text())
@@ -679,19 +673,15 @@ def load_pkg_versions():
679673
# and re-read `Cargo.lock`
680674
pkg_versions = load_pkg_versions()
681675

682-
# As a smoke test, cargo metadata solves all dependencies, so
683-
# will break if any crates rely on cargo features not
684-
# supported on MSRV
685-
for project in projects:
686-
if project is None:
687-
_run_cargo(session, "metadata", silent=True)
688-
else:
689-
_run_cargo(
690-
session,
691-
"metadata",
692-
f"--manifest-path={project}/Cargo.toml",
693-
silent=True,
694-
)
676+
# As a smoke test, cargo metadata solves all dependencies, so
677+
# will break if any crates rely on cargo features not
678+
# supported on MSRV
679+
_run_cargo(
680+
session,
681+
"metadata",
682+
f"--manifest-path={project}/Cargo.toml",
683+
silent=True,
684+
)
695685

696686

697687
@nox.session(name="ffi-check")

pyo3-ffi/examples/sequential/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "sequential"
33
version = "0.1.0"
44
edition = "2021"
5+
rust-version = "1.63"
56

67
[lib]
78
name = "sequential"

pyo3-ffi/examples/string-sum/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "string_sum"
33
version = "0.1.0"
44
edition = "2021"
5+
rust-version = "1.63"
56

67
[lib]
78
name = "string_sum"

0 commit comments

Comments
 (0)