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 .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
env:
UV_FROZEN: true
UV_PYTHON: 3.14
RUST_VERSION: "1.90.0"
RUST_VERSION: "1.95.0"

jobs:
benchmark:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
env:
UV_FROZEN: true
UV_PYTHON: 3.14
RUST_VERSION: "1.90.0"
RUST_VERSION: "1.95.0"

jobs:
benchmarks:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ permissions:

env:
RUSTFLAGS: "-Dwarnings" # treat warnings as errors
RUST_VERSION: "1.95.0"

jobs:
lint:
Expand All @@ -16,6 +17,12 @@ jobs:
- name: Checkout repository.
uses: actions/checkout@v6

- name: Install rust.
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_VERSION }}
components: clippy, rustfmt

- name: Run Clippy.
run: cargo clippy --all-targets --all-features

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
contents: read

env:
RUST_VERSION: "1.90.0"
RUST_VERSION: "1.95.0"

jobs:
build:
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ name = "libipld"
crate-type = ["rlib", "cdylib"]

[dependencies]
pyo3 = { version = "0.27.1", features = ["generate-import-lib", "anyhow"] }
python3-dll-a = "0.2.14"
anyhow = "1.0.100"
cid = "0.11.1"
cbor4ii = { version = "1.2.1" }
pyo3 = { version = "0.28.3", features = ["generate-import-lib", "anyhow"] }
python3-dll-a = "0.2.15"
anyhow = "1.0.102"
cid = "0.11.3"
cbor4ii = { version = "1.2.2" }

[workspace]
members = [ "profiling" ]
Expand Down
2 changes: 1 addition & 1 deletion profiling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ structopt = "0.3.26"
clap = "4.5.29"

[dependencies.pyo3]
version = "0.27.1"
version = "0.28.3"
11 changes: 8 additions & 3 deletions profiling/src/profiles/decode_car.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ pub fn exec(iterations: u64) {
let bench_file_name = "benchmarks/repo.car";

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

pyo3::prepare_freethreaded_python();
Python::initialize();

Python::attach(|gil| {
unsafe { pyo3::ffi::Py_SetRecursionLimit(10_000) };
let _ = gil;
});

for _ in 0..iterations {
Python::with_gil(|gil| {
Python::attach(|gil| {
println!("{}", libipld::decode_car(gil, &car_bytes).is_ok());
});
}
Expand Down
6 changes: 3 additions & 3 deletions profiling/src/profiles/decode_dag_cbor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ pub fn exec(iterations: u64) {
let bench_file_name = "benchmarks/decode.dagcbor";

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

pyo3::prepare_freethreaded_python();
Python::initialize();

for _ in 0..iterations {
Python::with_gil(|gil| {
Python::attach(|gil| {
println!("{}", libipld::decode_dag_cbor(gil, &dag_cbor_bytes).is_ok());
});
}
Expand Down
6 changes: 3 additions & 3 deletions profiling/src/profiles/encode_dag_cbor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ pub fn exec(iterations: u64) {
let bench_file_name = "benchmarks/encode.json";

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

pyo3::prepare_freethreaded_python();
Python::initialize();

for _ in 0..iterations {
Python::with_gil(|gil| {
Python::attach(|gil| {
println!(
"{}",
libipld::encode_dag_cbor(gil, &PyString::new(gil, json_str)).is_ok()
Expand Down
4 changes: 2 additions & 2 deletions pytests/test_decode_car.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_decode_car_invalid_header_type() -> None:
header_obj = libipld.encode_dag_cbor('strInsteadOfObj')
libipld.decode_car(header_len + header_obj)

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


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

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


def test_decode_car_invalid_header_roots_value_empty_list() -> None:
Expand Down
Loading