Skip to content

Commit d2951ed

Browse files
authored
Bump Rust 1.95, PyO3 0.28 (free-threaded), and Rust deps (#102)
1 parent e88185d commit d2951ed

10 files changed

Lines changed: 32 additions & 20 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313
env:
1414
UV_FROZEN: true
1515
UV_PYTHON: 3.14
16-
RUST_VERSION: "1.90.0"
16+
RUST_VERSION: "1.95.0"
1717

1818
jobs:
1919
benchmark:

.github/workflows/codspeed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313
env:
1414
UV_FROZEN: true
1515
UV_PYTHON: 3.14
16-
RUST_VERSION: "1.90.0"
16+
RUST_VERSION: "1.95.0"
1717

1818
jobs:
1919
benchmarks:

.github/workflows/lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ permissions:
77

88
env:
99
RUSTFLAGS: "-Dwarnings" # treat warnings as errors
10+
RUST_VERSION: "1.95.0"
1011

1112
jobs:
1213
lint:
@@ -16,6 +17,12 @@ jobs:
1617
- name: Checkout repository.
1718
uses: actions/checkout@v6
1819

20+
- name: Install rust.
21+
uses: dtolnay/rust-toolchain@master
22+
with:
23+
toolchain: ${{ env.RUST_VERSION }}
24+
components: clippy, rustfmt
25+
1926
- name: Run Clippy.
2027
run: cargo clippy --all-targets --all-features
2128

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
contents: read
1313

1414
env:
15-
RUST_VERSION: "1.90.0"
15+
RUST_VERSION: "1.95.0"
1616

1717
jobs:
1818
build:

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ name = "libipld"
1313
crate-type = ["rlib", "cdylib"]
1414

1515
[dependencies]
16-
pyo3 = { version = "0.27.1", features = ["generate-import-lib", "anyhow"] }
17-
python3-dll-a = "0.2.14"
18-
anyhow = "1.0.100"
19-
cid = "0.11.1"
20-
cbor4ii = { version = "1.2.1" }
16+
pyo3 = { version = "0.28.3", features = ["generate-import-lib", "anyhow"] }
17+
python3-dll-a = "0.2.15"
18+
anyhow = "1.0.102"
19+
cid = "0.11.3"
20+
cbor4ii = { version = "1.2.2" }
2121

2222
[workspace]
2323
members = [ "profiling" ]

profiling/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ structopt = "0.3.26"
1111
clap = "4.5.29"
1212

1313
[dependencies.pyo3]
14-
version = "0.27.1"
14+
version = "0.28.3"

profiling/src/profiles/decode_car.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ pub fn exec(iterations: u64) {
66
let bench_file_name = "benchmarks/repo.car";
77

88
let car_bytes = fs::read(bench_file_name)
9-
.expect(&format!("Could not open bench file '{}'", bench_file_name));
9+
.unwrap_or_else(|_| panic!("Could not open bench file '{}'", bench_file_name));
1010

11-
pyo3::prepare_freethreaded_python();
11+
Python::initialize();
12+
13+
Python::attach(|gil| {
14+
unsafe { pyo3::ffi::Py_SetRecursionLimit(10_000) };
15+
let _ = gil;
16+
});
1217

1318
for _ in 0..iterations {
14-
Python::with_gil(|gil| {
19+
Python::attach(|gil| {
1520
println!("{}", libipld::decode_car(gil, &car_bytes).is_ok());
1621
});
1722
}

profiling/src/profiles/decode_dag_cbor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ pub fn exec(iterations: u64) {
66
let bench_file_name = "benchmarks/decode.dagcbor";
77

88
let dag_cbor_bytes = fs::read(bench_file_name)
9-
.expect(&format!("Could not open bench file '{}'", bench_file_name));
9+
.unwrap_or_else(|_| panic!("Could not open bench file '{}'", bench_file_name));
1010

11-
pyo3::prepare_freethreaded_python();
11+
Python::initialize();
1212

1313
for _ in 0..iterations {
14-
Python::with_gil(|gil| {
14+
Python::attach(|gil| {
1515
println!("{}", libipld::decode_dag_cbor(gil, &dag_cbor_bytes).is_ok());
1616
});
1717
}

profiling/src/profiles/encode_dag_cbor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ pub fn exec(iterations: u64) {
77
let bench_file_name = "benchmarks/encode.json";
88

99
let json_data = fs::read_to_string(bench_file_name)
10-
.expect(&format!("Could not open bench file '{}'", bench_file_name));
10+
.unwrap_or_else(|_| panic!("Could not open bench file '{}'", bench_file_name));
1111
let json_str = json_data.as_str();
1212

13-
pyo3::prepare_freethreaded_python();
13+
Python::initialize();
1414

1515
for _ in 0..iterations {
16-
Python::with_gil(|gil| {
16+
Python::attach(|gil| {
1717
println!(
1818
"{}",
1919
libipld::encode_dag_cbor(gil, &PyString::new(gil, json_str)).is_ok()

pytests/test_decode_car.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_decode_car_invalid_header_type() -> None:
4242
header_obj = libipld.encode_dag_cbor('strInsteadOfObj')
4343
libipld.decode_car(header_len + header_obj)
4444

45-
assert "cannot be cast as 'dict'" in str(exc_info.value)
45+
assert "is not an instance of 'dict'" in str(exc_info.value)
4646

4747

4848
def test_decode_car_invalid_header_version_key() -> None:
@@ -78,7 +78,7 @@ def test_decode_car_invalid_header_roots_value_type() -> None:
7878
header_obj = libipld.encode_dag_cbor({'version': 1, 'roots': 123})
7979
libipld.decode_car(header_len + header_obj)
8080

81-
assert "cannot be cast as 'list'" in str(exc_info.value)
81+
assert "is not an instance of 'list'" in str(exc_info.value)
8282

8383

8484
def test_decode_car_invalid_header_roots_value_empty_list() -> None:

0 commit comments

Comments
 (0)