Repository Analysis

PyO3/pyo3

Rust bindings for the Python interpreter

5.0 Low AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of PyO3/pyo3, a Rust project with 15,909 GitHub stars. SynthScan v2.0 examined 143,982 lines of code across 676 source files, recording 714 pattern matches distributed across 15 syntactic categories. The overall adjusted score of 5.0 places this repository in the Low AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

5.0
Adjusted Score
5.0
Raw Score
100%
Time Factor
2026-07-13
Last Push
15.9K
Stars
Rust
Language
144.0K
Lines of Code
676
Files
714
Pattern Hits
2026-07-14
Scan Date
0.01
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 5MEDIUM 8LOW 701

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 714 distinct pattern matches across 15 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Over-Commented Block607 hits · 570 pts
SeverityFileLineSnippetContext
LOWtypos.toml1[files]COMMENT
LOWtypos.toml21# | ^^^COMMENT
LOWtypos.toml41# error: `placehold` should be `placeholder`COMMENT
LOWtypos.toml61# |COMMENT
LOWguide/src/class.md241 ) -> PyResult<()> {COMMENT
LOWguide/src/class.md261# });COMMENT
LOWguide/src/class.md501 Ok(Py::new(py, sub)?.into_any())COMMENT
LOWguide/src/class.md841- The return type must be `PyResult<T>` or `T` for some `T` that implements `IntoPyObject`.COMMENT
LOWguide/src/class.md1081 #[classmethod]COMMENT
LOWguide/src/class.md1101# let doc: String = class.getattr("__doc__")?.extract()?;COMMENT
LOWguide/src/class.md1121# let sig: String = inspectCOMMENT
LOWguide/src/class.md1141# let method = class.getattr("my_static_method")?;COMMENT
LOWguide/src/parallelism.md41```COMMENT
LOWguide/src/parallelism.md61```COMMENT
LOWguide/src/function.md121 #[pyfunction]COMMENT
LOWguide/src/function.md141 # let catch_warnings = warningsCOMMENT
LOWguide/src/function.md161 # assert_eq!(COMMENT
LOWguide/src/migration.md501# use pyo3::sync::GILOnceCell;COMMENT
LOWguide/src/migration.md1861// generate exactly the same value.COMMENT
LOWguide/src/trait-bounds.md181# #[pyclass]COMMENT
LOWguide/src/trait-bounds.md201# .call_method("get_results", (), None)COMMENT
LOWguide/src/trait-bounds.md341# use pyo3::types::PyList;COMMENT
LOWguide/src/trait-bounds.md361 .unwrap()COMMENT
LOWguide/src/trait-bounds.md381# .unwrap();COMMENT
LOWguide/src/trait-bounds.md421 py_result.extract()COMMENT
LOWguide/src/conversions/traits.md1# Conversion traitsCOMMENT
LOWguide/src/conversions/traits.md41COMMENT
LOWguide/src/conversions/traits.md81# let dict = PyDict::new(py);COMMENT
LOWguide/src/conversions/traits.md101 string_attr: String,COMMENT
LOWguide/src/conversions/traits.md141 bar: String,COMMENT
LOWguide/src/conversions/traits.md161Tuple structs are also supported but do not allow customizing the extraction.COMMENT
LOWguide/src/conversions/traits.md221 inner: String,COMMENT
LOWguide/src/conversions/traits.md281# let rust_thing: RustyEnum<'_> = thing.extract()?;COMMENT
LOWguide/src/conversions/traits.md301# );COMMENT
LOWguide/src/conversions/traits.md321# match rust_thing {COMMENT
LOWguide/src/conversions/traits.md341# let rust_thing: RustyEnum<'_> = instance.extract()?;COMMENT
LOWguide/src/conversions/traits.md361# )?;COMMENT
LOWguide/src/conversions/traits.md381# b"text",COMMENT
LOWguide/src/conversions/traits.md401enum RustyEnum {COMMENT
LOWguide/src/conversions/traits.md421# }COMMENT
LOWguide/src/conversions/traits.md501# // Filled caseCOMMENT
LOWguide/src/function/signature.md141COMMENT
LOWguide/src/function/signature.md201# let fun = pyo3::wrap_pyfunction!(add, py)?;COMMENT
LOWguide/src/function/signature.md241}COMMENT
LOWguide/src/function/error-handling.md161}COMMENT
LOWguide/src/class/numeric.md341# n = Number(ord(x)) + ((n << five) - n)COMMENT
LOWguide/src/class/numeric.md361# assert Number(13) < Number(20)COMMENT
LOWguide/src/class/numeric.md381# passCOMMENT
LOWguide/src/class/object.md41## String representationsCOMMENT
LOWguide/src/class/object.md281# let y = &Bound::new(py, Number(4))?;COMMENT
LOWpyo3-ffi/src/moduleobject.rs41 pub fn PyModule_GetDict(arg1: *mut PyObject) -> *mut PyObject;COMMENT
LOWpyo3-ffi/src/methodobject.rs141/// otherwise the behavior is undefined.COMMENT
LOWpyo3-ffi/src/lib.rs1#![no_std]COMMENT
LOWpyo3-ffi/src/lib.rs21//! - The vast majority can only be used safely while the thread is attached to the Python interpreter.COMMENT
LOWpyo3-ffi/src/lib.rs41//! PyO3 uses `rustc`'s `--cfg` flags to enable or disable code used for different Python versions.COMMENT
LOWpyo3-ffi/src/lib.rs61//! To use these attributes, add [`pyo3-build-config`] as a build dependency inCOMMENT
LOWpyo3-ffi/src/lib.rs81//! - CPython 3.9 or greaterCOMMENT
LOWpyo3-ffi/src/lib.rs101//! # Downstream Rust code (including code in `bin/`, `examples/`, and `tests/`) will not be ableCOMMENT
LOWpyo3-ffi/src/lib.rs121//! **`build.rs`**COMMENT
LOWpyo3-ffi/src/lib.rs141//! m_base: PyModuleDef_HEAD_INIT,COMMENT
547 more matches not shown…
Hyper-Verbose Identifiers53 hits · 54 pts
SeverityFileLineSnippetContext
LOWnoxfile.py67def _parse_supported_interpreter_version(CODE
LOWnoxfile.py81def _supported_interpreter_versions(CODE
LOWnoxfile.py287def _clippy_additional_workspaces(session: nox.Session) -> bool:CODE
LOWnoxfile.py576def test_cross_compilation_windows(session: nox.Session):CODE
LOWnoxfile.py1239def set_msrv_package_versions(session: nox.Session):STRING
LOWnoxfile.py1533def _iter_extern_libpython_blocks(source: str) -> Iterator[str]:CODE
LOWnoxfile.py1558def _cfg_attr_is_non_cpython_only(attr: str) -> bool:CODE
LOWnoxfile.py1941def _run_cargo_set_package_version(CODE
LOWexamples/word-count/tests/test_word_count.py35def test_word_count_rust_parallel(benchmark, contents):STRING
LOWexamples/word-count/tests/test_word_count.py40def test_word_count_rust_sequential(benchmark, contents):STRING
LOWexamples/word-count/tests/test_word_count.py45def test_word_count_python_sequential(benchmark, contents):STRING
LOWexamples/word-count/tests/test_word_count.py50def run_rust_sequential_twice(STRING
LOWexamples/word-count/tests/test_word_count.py60def test_word_count_rust_sequential_twice_with_threads(benchmark, contents):STRING
LOWpytests/tests/test_sequence.py10def test_vec_from_list_pystring():CODE
LOWpytests/tests/test_sequence.py30def test_rust_array_from_array():CODE
LOWpytests/tests/test_misc.py23def test_multiple_imports_same_interpreter_ok():CODE
LOWpytests/tests/test_misc.py41def test_import_in_subinterpreter_forbidden():CODE
LOWpytests/tests/test_misc.py67def test_type_fully_qualified_name_includes_module():CODE
LOWpytests/tests/test_finalization.py27def test_hammer_attaching_in_thread():CODE
LOWpytests/tests/test_finalization.py35def test_detach_during_finalization():CODE
LOWpytests/tests/test_enums.py5def test_complex_enum_variant_constructors():CODE
LOWpytests/tests/test_enums.py39def test_complex_enum_variant_subclasses(variant: enums.ComplexEnum):CODE
LOWpytests/tests/test_enums.py43def test_complex_enum_field_getters():CODE
LOWpytests/tests/test_enums.py74def test_complex_enum_desugared_match(variant: enums.ComplexEnum):CODE
LOWpytests/tests/test_enums.py105def test_complex_enum_pyfunction_in_out_desugared_match(variant: enums.ComplexEnum):CODE
LOWpytests/tests/test_enums.py126def test_tuple_enum_variant_constructors():CODE
LOWpytests/tests/test_enums.py142def test_tuple_enum_variant_subclasses(variant: enums.TupleEnum):CODE
LOWpytests/tests/test_enums.py153def test_tuple_enum_field_getters():CODE
LOWpytests/tests/test_enums.py160def test_tuple_enum_index_getter():CODE
LOWpytests/tests/test_enums.py170def test_mixed_complex_enum_pyfunction_instance_nothing(CODE
LOWpytests/tests/test_enums.py183def test_mixed_complex_enum_pyfunction_instance_empty(variant: enums.MixedComplexEnum):CODE
LOWpytests/tests/test_datetime.py159def test_invalid_time_fails_overflow(args):CODE
LOWpytests/tests/test_datetime.py229def test_invalid_datetime_fails():CODE
LOWpytests/tests/test_datetime.py241def test_datetime_from_timestamp(dt):CODE
LOWpytests/tests/test_datetime.py259def test_datetime_from_timestamp_tzinfo():CODE
LOWpytests/tests/test_datetime.py325def test_tz_class_introspection():CODE
LOWpytests/tests/test_enums_match.py16def test_complex_enum_match_statement(variant: enums.ComplexEnum):CODE
LOWpytests/tests/test_enums_match.py44def test_complex_enum_pyfunction_in_out(variant: enums.ComplexEnum):CODE
LOWpytests/tests/test_enums_match.py68def test_complex_enum_partial_match(variant: enums.ComplexEnum):CODE
LOWpytests/tests/test_enums_match.py83def test_tuple_enum_match_statement(variant: enums.TupleEnum):CODE
LOWpytests/tests/test_enums_match.py103def test_simple_tuple_enum_match_statement(variant: enums.SimpleTupleEnum):CODE
LOWpytests/tests/test_enums_match.py119def test_tuple_enum_match_match_args(variant: enums.TupleEnum):CODE
LOWpytests/tests/test_enums_match.py136def test_tuple_enum_partial_match(variant: enums.TupleEnum):CODE
LOWpytests/tests/test_enums_match.py151def test_mixed_complex_enum_match_statement(variant: enums.MixedComplexEnum):CODE
LOWpytests/tests/test_pyclasses.py131def test_no_constructor_defined_propagates_cause(cls: Type, exc_message: str):CODE
LOWpytests/tests/test_pyfunctions.py66def test_simple_args_kwargs_py(benchmark):CODE
LOWpytests/tests/test_pyfunctions.py70def test_simple_args_kwargs_rs(benchmark):CODE
LOWpytests/tests/test_pyfunctions.py120def many_keyword_arguments_py(CODE
LOWpytests/tests/test_pyfunctions.py141def call_with_many_keyword_arguments(f) -> Any:CODE
LOWpytests/tests/test_pyfunctions.py160def test_many_keyword_arguments_py(benchmark):CODE
LOWpytests/tests/test_pyfunctions.py164def test_many_keyword_arguments_rs(benchmark):CODE
LOWpytests/tests/test_objstore.py7def test_objstore_doesnot_leak_memory():CODE
LOWpytests/tests/test_path.py27def test_take_invalid_pathlike():CODE
Cross-Language Confusion5 hits · 32 pts
SeverityFileLineSnippetContext
HIGHexamples/plugin/python_plugin/gadget_init_plugin.py8 g.push(1)CODE
HIGHexamples/plugin/python_plugin/gadget_init_plugin.py9 g.push(2)CODE
HIGHexamples/plugin/python_plugin/gadget_init_plugin.py10 g.push(3)CODE
HIGHexamples/plugin/plugin_api/tests/test_Gadget.py22 gadget.push(42)CODE
HIGHpytests/tests/test_objstore.py23 store.push(message)CODE
Excessive Try-Catch Wrapping18 hits · 25 pts
SeverityFileLineSnippetContext
LOWnoxfile.py294 except Exception:CODE
LOWnoxfile.py303 except Exception:CODE
LOWnoxfile.py359 except Exception:CODE
LOWnoxfile.py413 except Exception:CODE
LOWnoxfile.py1035 except Exception:CODE
LOWguide/src/migration.md1713 except Exception as e:CODE
LOWguide/src/debugging.md315 except Exception:CODE
LOWguide/src/debugging.md322 except Exception as e:CODE
MEDIUMguide/src/debugging.md323 print(f"Error updating launch.json: {e}")CODE
LOWtests/test_inheritance.rs168except Exception as e:CODE
LOWpytests/tests/test_datetime.py98 except Exception:CODE
LOWpytests/tests/test_datetime.py104 except Exception as pdt_fail:CODE
LOWpytests/tests/test_datetime.py244 except Exception:CODE
LOWpytests/tests/test_datetime.py250 except Exception as pdt_fail:CODE
MEDIUMpytests/tests/test_datetime.py95def test_date_from_timestamp(d):CODE
MEDIUMpytests/tests/test_datetime.py241def test_datetime_from_timestamp(dt):CODE
LOWpytests/tests/test_pyclasses.py136 except Exception:CODE
LOWsrc/types/traceback.rs158except Exception as e:CODE
Decorative Section Separators4 hits · 12 pts
SeverityFileLineSnippetContext
MEDIUMguide/glossary_linker.py66# ---------------------------------------------------------------------------COMMENT
MEDIUMguide/glossary_linker.py68# ---------------------------------------------------------------------------COMMENT
MEDIUMguide/glossary_linker.py183# ---------------------------------------------------------------------------COMMENT
MEDIUMguide/glossary_linker.py185# ---------------------------------------------------------------------------COMMENT
Deep Nesting8 hits · 8 pts
SeverityFileLineSnippetContext
LOWnoxfile.py744CODE
LOWnoxfile.py912CODE
LOWnoxfile.py1239CODE
LOWnoxfile.py1504CODE
LOWnoxfile.py1533CODE
LOWguide/glossary_linker.py84CODE
LOWpytests/tests/test_enums.py74CODE
LOWpytests/tests/test_enums.py105CODE
Unused Imports8 hits · 8 pts
SeverityFileLineSnippetContext
LOWexamples/plugin/plugin_api/tests/test_import.py2CODE
LOWexamples/maturin-starter/maturin_starter/__init__.py2CODE
LOWexamples/maturin-starter/maturin_starter/__init__.py6CODE
LOWexamples/word-count/word_count/__init__.py1CODE
LOWexamples/word-count/word_count/__init__.py1CODE
LOWexamples/word-count/word_count/__init__.py1CODE
LOW…tools-rust-starter/setuptools_rust_starter/__init__.py2CODE
LOW…tools-rust-starter/setuptools_rust_starter/__init__.py6CODE
TODO Padding3 hits · 4 pts
SeverityFileLineSnippetContext
LOWpyo3-macros-backend/src/py_expr.rs157 _ => PyConstant::Ellipsis, // TODO: implement ByteStr and CStrCODE
LOWpyo3-macros-backend/src/frompyobject.rs475 // TODO: implement using a Protocol?COMMENT
LOWpyo3-macros-backend/src/intopyobject.rs378 // TODO: implement using a Protocol?COMMENT
Self-Referential Comments1 hit · 3 pts
SeverityFileLineSnippetContext
MEDIUMpytests/tests/test_enums_match.py1# This file is only collected when Python >= 3.10, because it tests match syntax.COMMENT
Modern Structural Boilerplate2 hits · 2 pts
SeverityFileLineSnippetContext
LOWnoxfile.py199def set_coverage_env(session: nox.Session) -> None:CODE
LOWexamples/word-count/word_count/__init__.py3__all__ = [CODE
Redundant / Tautological Comments1 hit · 2 pts
SeverityFileLineSnippetContext
LOW.github/workflows/ci.yml864 # Check if all needs were successful or skipped.COMMENT
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippetContext
LOWsrc/pyclass.rs66 /// Usage example:COMMENT
AI Slop Vocabulary1 hit · 2 pts
SeverityFileLineSnippetContext
LOWsrc/pycell/impl_.rs268 // For `#[pyclass]` types which inherit from PyAny, we can just call tp_freeCOMMENT
Fake / Example Data1 hit · 1 pts
SeverityFileLineSnippetContext
LOWguide/src/python-from-rust/calling-existing-code.md335 let house = house_class.call1(("123 Main Street",)).unwrap();CODE
AI Structural Patterns1 hit · 1 pts
SeverityFileLineSnippetContext
LOWpytests/tests/test_pyfunctions.py120CODE