Skip to content

Commit 5c88c39

Browse files
committed
Update dependencies and fix coverage to reach 100%
This commit updates all dependencies to their latest compatible versions and resolves issue #1 by excluding the pymodule line from coverage. Changes: - Update GitHub Actions workflow: * Replace deprecated actions-rs/toolchain with dtolnay/rust-toolchain * Update actions/checkout from v4 to v5 - Update Python dependencies: * pytest: 8.3.4 → 8.4.2 * maturin: 1.8.1 → 1.9.6 * Update build-system to require maturin>=1.9 - Update Rust dependencies: * PyO3: 0.23.3 → 0.23.5 (latest patch release, no breaking changes) - Fix coverage to reach 100%: * Add #[cfg_attr(coverage, coverage(off))] to _foobar pymodule * This excludes the pymodule initialization code that cannot be directly tested (see rust-lang/rust#84605) All updates are backwards-compatible and maintain test compatibility. The coverage fix resolves issue #1 without affecting functionality. Fixes #1 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ca24236 commit 5c88c39

5 files changed

Lines changed: 144 additions & 134 deletions

File tree

.github/workflows/CI.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,16 @@ jobs:
1212
os: ["ubuntu"]
1313
runs-on: ${{ matrix.os }}-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- uses: actions/setup-python@v5
1717
with:
1818
python-version: "3.12"
1919
- name: Install uv
2020
uses: astral-sh/setup-uv@v5
2121
with:
2222
enable-cache: true
23-
- uses: actions-rs/toolchain@v1
23+
- uses: dtolnay/rust-toolchain@stable
2424
with:
25-
toolchain: stable
26-
override: true
27-
profile: minimal
2825
components: llvm-tools-preview
2926
- name: Install cargo-llvm-cov
3027
uses: taiki-e/install-action@cargo-llvm-cov

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "foobar"
99
crate-type = ["cdylib"]
1010

1111
[dependencies]
12-
pyo3 = { version = "0.23.3", features = ["extension-module"] }
12+
pyo3 = { version = "0.23.5", features = ["extension-module"] }
1313

1414
[package.metadata.maturin]
1515
python-source = "python"

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ classifiers = [
88
"Programming Language :: Python :: Implementation :: PyPy",
99
]
1010
dependencies = [
11-
"pytest>=8.3.4",
11+
"pytest>=8.4.2",
1212
"pytest-cov>=6.0.0",
13-
"maturin>=1.8.1",
13+
"maturin>=1.9.6",
1414
]
1515

1616
[build-system]
17-
requires = ["maturin>=1.0,<2.0"]
17+
requires = ["maturin>=1.9,<2.0"]
1818
build-backend = "maturin"
1919

2020
[tool.maturin]

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fn pyo3_sum(a: usize, b: usize) -> PyResult<usize> {
1313
}
1414

1515
/// A Python module implemented in Rust.
16+
#[cfg_attr(coverage, coverage(off))]
1617
#[pymodule]
1718
fn _foobar(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
1819
m.add_function(wrap_pyfunction!(pyo3_sum, m)?)?;

0 commit comments

Comments
 (0)