Repository Analysis

PyO3/pyo3

Rust bindings for the Python interpreter

5.0 Low AI signal View on GitHub
5.0
Adjusted Score
5.0
Raw Score
100%
Time Factor
2026-05-29
Last Push
15,738
Stars
Rust
Language
140,626
Lines of Code
742
Files
688
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 5MEDIUM 8LOW 675

Pattern Findings

688 matches across 12 categories. Click a row to expand file-level details.

Over-Commented Block588 hits · 556 pts
SeverityFileLineSnippet
LOWguide/src/class.md241 ) -> PyResult<()> {
LOWguide/src/class.md261# });
LOWguide/src/class.md501 if val % 2 == 0 {
LOWguide/src/class.md841- For details on `parameter-list`, see the documentation of `Method arguments` section.
LOWguide/src/class.md1081 // similarly for classmethod arguments, use $cls
LOWguide/src/class.md1101# if cfg!(not(Py_LIMITED_API)) || py.version_info() >= (3, 10) {
LOWguide/src/class.md1121#
LOWguide/src/class.md1141# {
LOWguide/src/parallelism.md41```
LOWguide/src/parallelism.md61```
LOWguide/src/function.md121 #[pyfunction]
LOWguide/src/function.md141 # let catch_warnings = warnings
LOWguide/src/function.md161 # assert_eq!(
LOWguide/src/migration.md721```rust,ignore
LOWguide/src/trait-bounds.md181# #[pyclass]
LOWguide/src/trait-bounds.md201# .call_method("get_results", (), None)
LOWguide/src/trait-bounds.md341# use pyo3::types::PyList;
LOWguide/src/trait-bounds.md361 .unwrap()
LOWguide/src/trait-bounds.md381# .unwrap();
LOWguide/src/trait-bounds.md421 py_result.extract()
LOWguide/src/conversions/traits.md1# Conversion traits
LOWguide/src/conversions/traits.md41
LOWguide/src/conversions/traits.md81# let dict = PyDict::new(py);
LOWguide/src/conversions/traits.md101 string_attr: String,
LOWguide/src/conversions/traits.md141 bar: String,
LOWguide/src/conversions/traits.md161Tuple structs are also supported but do not allow customizing the extraction.
LOWguide/src/conversions/traits.md221 inner: String,
LOWguide/src/conversions/traits.md281# let rust_thing: RustyEnum<'_> = thing.extract()?;
LOWguide/src/conversions/traits.md301# );
LOWguide/src/conversions/traits.md321# match rust_thing {
LOWguide/src/conversions/traits.md341# let rust_thing: RustyEnum<'_> = instance.extract()?;
LOWguide/src/conversions/traits.md361# )?;
LOWguide/src/conversions/traits.md381# b"text",
LOWguide/src/conversions/traits.md401enum RustyEnum {
LOWguide/src/conversions/traits.md421# }
LOWguide/src/conversions/traits.md501# // Filled case
LOWguide/src/function/signature.md141
LOWguide/src/function/signature.md201# let fun = pyo3::wrap_pyfunction!(add, py)?;
LOWguide/src/function/signature.md241}
LOWguide/src/function/error-handling.md161}
LOWguide/src/class/numeric.md341# n = Number(ord(x)) + ((n << five) - n)
LOWguide/src/class/numeric.md361# assert Number(13) < Number(20)
LOWguide/src/class/numeric.md381# pass
LOWguide/src/class/object.md41## String representations
LOWguide/src/class/object.md281# let y = &Bound::new(py, Number(4))?;
LOWpyo3-ffi/src/methodobject.rs141 }
LOWpyo3-ffi/src/methodobject.rs161
LOWpyo3-ffi/src/lib.rs1#![no_std]
LOWpyo3-ffi/src/lib.rs21//! - The vast majority can only be used safely while the thread is attached to the Python interpreter.
LOWpyo3-ffi/src/lib.rs41//! PyO3 uses `rustc`'s `--cfg` flags to enable or disable code used for different Python versions.
LOWpyo3-ffi/src/lib.rs61//! To use these attributes, add [`pyo3-build-config`] as a build dependency in
LOWpyo3-ffi/src/lib.rs81//! - CPython 3.8 or greater
LOWpyo3-ffi/src/lib.rs101//! # Downstream Rust code (including code in `bin/`, `examples/`, and `tests/`) will not be able
LOWpyo3-ffi/src/lib.rs121//! **`build.rs`**
LOWpyo3-ffi/src/lib.rs141//! m_base: PyModuleDef_HEAD_INIT,
LOWpyo3-ffi/src/lib.rs161//! // A zeroed PyMethodDef to mark the end of the array.
LOWpyo3-ffi/src/lib.rs181//! slot: 0,
LOWpyo3-ffi/src/lib.rs201//! // The module initialization function
LOWpyo3-ffi/src/lib.rs221//! "sum_as_string expected an int for positional argument {}\0",
LOWpyo3-ffi/src/lib.rs241//! Some(i)
528 more matches not shown…
Hyper-Verbose Identifiers52 hits · 53 pts
SeverityFileLineSnippet
LOWnoxfile.py66def _parse_supported_interpreter_version(
LOWnoxfile.py80def _supported_interpreter_versions(
LOWnoxfile.py251def _clippy_additional_workspaces(session: nox.Session) -> bool:
LOWnoxfile.py469def test_cross_compilation_windows(session: nox.Session):
LOWnoxfile.py1132def set_msrv_package_versions(session: nox.Session):
LOWnoxfile.py1367def _iter_extern_libpython_blocks(source: str) -> Iterator[str]:
LOWnoxfile.py1392def _cfg_attr_is_non_cpython_only(attr: str) -> bool:
LOWnoxfile.py1712def _run_cargo_set_package_version(
LOWexamples/word-count/tests/test_word_count.py35def test_word_count_rust_parallel(benchmark, contents):
LOWexamples/word-count/tests/test_word_count.py40def test_word_count_rust_sequential(benchmark, contents):
LOWexamples/word-count/tests/test_word_count.py45def test_word_count_python_sequential(benchmark, contents):
LOWexamples/word-count/tests/test_word_count.py50def run_rust_sequential_twice(
LOWexamples/word-count/tests/test_word_count.py60def test_word_count_rust_sequential_twice_with_threads(benchmark, contents):
LOWpytests/tests/test_sequence.py10def test_vec_from_list_pystring():
LOWpytests/tests/test_sequence.py30def test_rust_array_from_array():
LOWpytests/tests/test_misc.py23def test_multiple_imports_same_interpreter_ok():
LOWpytests/tests/test_misc.py41def test_import_in_subinterpreter_forbidden():
LOWpytests/tests/test_misc.py67def test_type_fully_qualified_name_includes_module():
LOWpytests/tests/test_hammer_attaching_in_thread.py27def test_hammer_attaching_in_thread():
LOWpytests/tests/test_enums.py5def test_complex_enum_variant_constructors():
LOWpytests/tests/test_enums.py39def test_complex_enum_variant_subclasses(variant: enums.ComplexEnum):
LOWpytests/tests/test_enums.py43def test_complex_enum_field_getters():
LOWpytests/tests/test_enums.py74def test_complex_enum_desugared_match(variant: enums.ComplexEnum):
LOWpytests/tests/test_enums.py105def test_complex_enum_pyfunction_in_out_desugared_match(variant: enums.ComplexEnum):
LOWpytests/tests/test_enums.py126def test_tuple_enum_variant_constructors():
LOWpytests/tests/test_enums.py142def test_tuple_enum_variant_subclasses(variant: enums.TupleEnum):
LOWpytests/tests/test_enums.py153def test_tuple_enum_field_getters():
LOWpytests/tests/test_enums.py160def test_tuple_enum_index_getter():
LOWpytests/tests/test_enums.py170def test_mixed_complex_enum_pyfunction_instance_nothing(
LOWpytests/tests/test_enums.py183def test_mixed_complex_enum_pyfunction_instance_empty(variant: enums.MixedComplexEnum):
LOWpytests/tests/test_datetime.py159def test_invalid_time_fails_overflow(args):
LOWpytests/tests/test_datetime.py229def test_invalid_datetime_fails():
LOWpytests/tests/test_datetime.py241def test_datetime_from_timestamp(dt):
LOWpytests/tests/test_datetime.py259def test_datetime_from_timestamp_tzinfo():
LOWpytests/tests/test_datetime.py325def test_tz_class_introspection():
LOWpytests/tests/test_enums_match.py16def test_complex_enum_match_statement(variant: enums.ComplexEnum):
LOWpytests/tests/test_enums_match.py44def test_complex_enum_pyfunction_in_out(variant: enums.ComplexEnum):
LOWpytests/tests/test_enums_match.py68def test_complex_enum_partial_match(variant: enums.ComplexEnum):
LOWpytests/tests/test_enums_match.py83def test_tuple_enum_match_statement(variant: enums.TupleEnum):
LOWpytests/tests/test_enums_match.py103def test_simple_tuple_enum_match_statement(variant: enums.SimpleTupleEnum):
LOWpytests/tests/test_enums_match.py119def test_tuple_enum_match_match_args(variant: enums.TupleEnum):
LOWpytests/tests/test_enums_match.py136def test_tuple_enum_partial_match(variant: enums.TupleEnum):
LOWpytests/tests/test_enums_match.py151def test_mixed_complex_enum_match_statement(variant: enums.MixedComplexEnum):
LOWpytests/tests/test_pyclasses.py131def test_no_constructor_defined_propagates_cause(cls: Type, exc_message: str):
LOWpytests/tests/test_pyfunctions.py66def test_simple_args_kwargs_py(benchmark):
LOWpytests/tests/test_pyfunctions.py70def test_simple_args_kwargs_rs(benchmark):
LOWpytests/tests/test_pyfunctions.py120def many_keyword_arguments_py(
LOWpytests/tests/test_pyfunctions.py141def call_with_many_keyword_arguments(f) -> Any:
LOWpytests/tests/test_pyfunctions.py160def test_many_keyword_arguments_py(benchmark):
LOWpytests/tests/test_pyfunctions.py164def test_many_keyword_arguments_rs(benchmark):
LOWpytests/tests/test_objstore.py7def test_objstore_doesnot_leak_memory():
LOWpytests/tests/test_path.py27def test_take_invalid_pathlike():
Cross-Language Confusion5 hits · 32 pts
SeverityFileLineSnippet
HIGHexamples/plugin/python_plugin/gadget_init_plugin.py8 g.push(1)
HIGHexamples/plugin/python_plugin/gadget_init_plugin.py9 g.push(2)
HIGHexamples/plugin/python_plugin/gadget_init_plugin.py10 g.push(3)
HIGHexamples/plugin/plugin_api/tests/test_Gadget.py22 gadget.push(42)
HIGHpytests/tests/test_objstore.py23 store.push(message)
Excessive Try-Catch Wrapping18 hits · 25 pts
SeverityFileLineSnippet
LOWnoxfile.py258 except Exception:
LOWnoxfile.py267 except Exception:
LOWnoxfile.py321 except Exception:
LOWnoxfile.py375 except Exception:
LOWnoxfile.py932 except Exception:
LOWguide/src/migration.md1626 except Exception as e:
LOWguide/src/debugging.md315 except Exception:
LOWguide/src/debugging.md322 except Exception as e:
MEDIUMguide/src/debugging.md323 print(f"Error updating launch.json: {e}")
LOWtests/test_inheritance.rs168except Exception as e:
LOWpytests/tests/test_datetime.py98 except Exception:
LOWpytests/tests/test_datetime.py104 except Exception as pdt_fail:
LOWpytests/tests/test_datetime.py244 except Exception:
LOWpytests/tests/test_datetime.py250 except Exception as pdt_fail:
MEDIUMpytests/tests/test_datetime.py95def test_date_from_timestamp(d):
MEDIUMpytests/tests/test_datetime.py241def test_datetime_from_timestamp(dt):
LOWpytests/tests/test_pyclasses.py136 except Exception:
LOWsrc/types/traceback.rs157except Exception as e:
Decorative Section Separators4 hits · 12 pts
SeverityFileLineSnippet
MEDIUMguide/glossary_linker.py66# ---------------------------------------------------------------------------
MEDIUMguide/glossary_linker.py68# ---------------------------------------------------------------------------
MEDIUMguide/glossary_linker.py183# ---------------------------------------------------------------------------
MEDIUMguide/glossary_linker.py185# ---------------------------------------------------------------------------
Deep Nesting8 hits · 8 pts
SeverityFileLineSnippet
LOWnoxfile.py641
LOWnoxfile.py809
LOWnoxfile.py1132
LOWnoxfile.py1338
LOWnoxfile.py1367
LOWguide/glossary_linker.py84
LOWpytests/tests/test_enums.py74
LOWpytests/tests/test_enums.py105
Unused Imports8 hits · 8 pts
SeverityFileLineSnippet
LOWexamples/plugin/plugin_api/tests/test_import.py2
LOWexamples/maturin-starter/maturin_starter/__init__.py2
LOWexamples/maturin-starter/maturin_starter/__init__.py6
LOWexamples/word-count/word_count/__init__.py1
LOWexamples/word-count/word_count/__init__.py1
LOWexamples/word-count/word_count/__init__.py1
LOW…tools-rust-starter/setuptools_rust_starter/__init__.py2
LOW…tools-rust-starter/setuptools_rust_starter/__init__.py6
Self-Referential Comments1 hit · 3 pts
SeverityFileLineSnippet
MEDIUMpytests/tests/test_enums_match.py1# This file is only collected when Python >= 3.10, because it tests match syntax.
Redundant / Tautological Comments1 hit · 2 pts
SeverityFileLineSnippet
LOW.github/workflows/ci.yml897 # Check if all needs were successful or skipped.
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippet
LOWsrc/pyclass.rs65 /// Usage example:
AI Slop Vocabulary1 hit · 2 pts
SeverityFileLineSnippet
LOWsrc/pycell/impl_.rs268 // For `#[pyclass]` types which inherit from PyAny, we can just call tp_free
Fake / Example Data1 hit · 1 pts
SeverityFileLineSnippet
LOWguide/src/python-from-rust/calling-existing-code.md332 let house = house_class.call1(("123 Main Street",)).unwrap();