Skip to content

Add Python Rust native extension detectors - #120

Merged
andrew merged 1 commit into
mainfrom
add-python-rust-detectors
Jul 31, 2026
Merged

Add Python Rust native extension detectors#120
andrew merged 1 commit into
mainfrom
add-python-rust-detectors

Conversation

@andrew

@andrew andrew commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Adds Maturin and setuptools-rust native extension definitions for Python projects. Detection covers parsed dependencies and their pyproject.toml or setup.py configuration, with fixtures for positive signals and prose-only near misses.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds knowledge-base definitions and fixtures/tests so the detector can recognize Python projects that build Rust native extensions via Maturin or setuptools-rust.

Changes:

  • Added KB tool definitions for maturin and setuptools-rust under the native_extension category.
  • Added two Python+Rust fixture projects (pyproject + Cargo) to exercise positive detection paths.
  • Extended detect/detect_test.go with project-level, signal-level, and near-miss tests for these detectors.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
testdata/setuptools-rust-project/src/lib.rs Minimal Rust source file for setuptools-rust fixture.
testdata/setuptools-rust-project/pyproject.toml setuptools-rust pyproject configuration used as a positive detection fixture.
testdata/setuptools-rust-project/Cargo.toml Cargo manifest for setuptools-rust fixture (cdylib).
testdata/maturin-project/src/lib.rs Minimal Rust source file for maturin fixture.
testdata/maturin-project/pyproject.toml maturin pyproject configuration used as a positive detection fixture.
testdata/maturin-project/Cargo.toml Cargo manifest for maturin fixture (cdylib).
knowledge/python/setuptools-rust.toml New KB definition and detection signals for setuptools-rust native extensions.
knowledge/python/maturin.toml New KB definition and detection signals for maturin native extensions.
detect/detect_test.go Adds tests covering detection + near-miss behavior; adds a confidence-checking assertion helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

[package]
name = "maturin-project"
version = "0.1.0"
edition = "2024"
[package]
name = "setuptools-rust-project"
version = "0.1.0"
edition = "2024"
Comment thread detect/detect_test.go
Comment on lines +1452 to +1463
t.Helper()
for _, tool := range r.Tools[category] {
if tool.Name != name {
continue
}
if tool.Confidence != confidence {
t.Errorf("%s confidence = %q, want %q", name, tool.Confidence, confidence)
}
return
}
t.Errorf("expected %s in %s category", name, category)
}
@andrew
andrew merged commit 01ef7c6 into main Jul 31, 2026
9 checks passed
@andrew
andrew deleted the add-python-rust-detectors branch July 31, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants