Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion guide/src/bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ maturin automatically detects pyo3 bindings when it's added as a dependency in `
pyo3 bindings has `Py_LIMITED_API`/abi3 support, enable the `abi3` feature of the `pyo3` crate to use it:

```toml
pyo3 = { version = "0.27.0", features = ["abi3"] }
pyo3 = { version = "0.28.2", features = ["abi3"] }
```

You may additionally specify a minimum Python version by using the `abi3-pyXX`
Expand Down
2 changes: 1 addition & 1 deletion guide/src/distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ or providing any Windows Python library files.

```toml
[dependencies]
pyo3 = { version = "0.27.0", features = ["generate-import-lib"] }
pyo3 = { version = "0.28.2", features = ["generate-import-lib"] }
```

It uses an external [`python3-dll-a`](https://docs.rs/python3-dll-a/latest/python3_dll_a/) crate to
Expand Down
2 changes: 1 addition & 1 deletion guide/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ crate-type = ["cdylib"]
rand = "0.9.0"

[dependencies.pyo3]
version = "0.27.0"
version = "0.28.2"
# "abi3-py38" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.8
features = ["abi3-py38"]
```
Expand Down
51 changes: 50 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

import nox

import urllib.request
import re

PYODIDE_VERSION = os.getenv("PYODIDE_VERSION", "0.29.0")
GITHUB_ACTIONS = os.getenv("GITHUB_ACTIONS")
GITHUB_ENV = os.getenv("GITHUB_ENV")
Expand All @@ -26,12 +29,58 @@ def append_to_github_env(name: str, value: str):
f.write(f"{name}={value}\n")


def get_latest_pyo3_version():
url = "https://crates.io/api/v1/crates/pyo3"
with urllib.request.urlopen(urllib.request.Request(url, headers={"User-Agent": "maturin-nox-update"})) as response:
data = json.loads(response.read().decode())
return data["crate"]["max_stable_version"]


@nox.session(name="update-pyo3", python=False)
def update_pyo3(session: nox.Session):
# TODO: support updating major and minor versions by editing Cargo.toml first
latest_version = get_latest_pyo3_version()
session.log(f"Latest pyo3 version: {latest_version}")

crates = ["pyo3", "pyo3-ffi", "pyo3-build-config"]
# Update test crates and root Cargo.toml
cargo_tomls = [p for p in Path(".").glob("**/Cargo.toml") if "pyo3-no-extension-module" not in str(p)]
# Update templates
templates = list(Path("src/templates").glob("*.j2"))

for path in cargo_tomls + templates:
content = path.read_text()
changed = False
for crate in crates:
# Replace crate = "version"
new_content = re.sub(
rf'^(\s*{crate}\s*=\s*)"[0-9.]+"',
rf'\1"{latest_version}"',
content,
flags=re.MULTILINE,
)
if new_content != content:
content = new_content
changed = True
# Replace crate = { version = "version"
new_content = re.sub(
rf'^(\s*{crate}\s*=\s*\{{.*?version\s*=\s*)"[0-9.]+"',
rf'\1"{latest_version}"',
content,
flags=re.MULTILINE,
)
if new_content != content:
content = new_content
changed = True

if changed:
session.log(f"Updating {path}")
path.write_text(content)

test_crate_dir = Path("./test-crates").resolve()
crates_to_update = ["pyo3", "pyo3-ffi", "python3-dll-a"]
for root, _, files in os.walk(test_crate_dir):
if "pyo3-no-extension-module" in root:
continue
if "Cargo.lock" in files:
cargo_lock_path = Path(root) / "Cargo.lock"
with open(cargo_lock_path, "r") as lock_file:
Expand Down
4 changes: 2 additions & 2 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ mod tests {

let bridge = BridgeModel::PyO3(PyO3 {
crate_name: PyO3Crate::PyO3,
version: semver::Version::new(0, 27, 1),
version: semver::Version::new(0, 28, 2),
abi3: Some(Abi3Version::Version(3, 7)),
metadata: Some(PyO3Metadata {
cpython: PyO3VersionMetadata {
min_minor: 7,
max_minor: 14,
max_minor: 15,
},
pypy: PyO3VersionMetadata {
min_minor: 11,
Expand Down
2 changes: 1 addition & 1 deletion src/templates/Cargo.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crate-type = ["cdylib"]

[dependencies]
{% if bindings == "pyo3" -%}
pyo3 = "0.27.0"
pyo3 = "0.28.2"
{% elif bindings == "uniffi" -%}
uniffi = "0.28.0"

Expand Down
58 changes: 14 additions & 44 deletions test-crates/lib_with_disallowed_lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test-crates/lib_with_disallowed_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ crate-type = ["cdylib"]

[dependencies]
libz-sys = { version = "1.1.2", default-features = false }
pyo3 = "0.27.0"
pyo3 = "0.28.2"
2 changes: 1 addition & 1 deletion test-crates/lib_with_path_dep/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ edition = "2021"
crate-type = ["cdylib"]

[dependencies]
pyo3 = "0.27.0"
pyo3 = "0.28.2"
some_path_dep = { path = "../some_path_dep" }
Loading
Loading