[Refactor] Comprehensive Type Hinting and PEP 561 Compliance
Summary
Add type hints to the entire codebase and include a py.typed file to make OracleTrace PEP 561 compliant.
Problem
The current codebase lacks full type annotations. This results in poor autocompletion and lack of static analysis support (like mypy or pyright) for developers using OracleTrace as a library or contributing to the core.
Proposed Solution
- Annotate all function signatures and variable declarations in
tracer.py, cli.py, and analysis.py.
- Add
mypy to the dev dependencies and CI pipeline.
- Include an empty
py.typed file in the package root to signal type-checker support.
Use Case
A developer importing oracletrace into their own performance suite will get accurate IDE suggestions and type safety during development.
Example
# Before
def trace_function(func, args):
...
# After
def trace_function(func: Callable[..., Any], args: tuple[Any, ...]) -> TraceResult:
...
Alternatives Considered
- Leaving types as implicit (not recommended for modern Python libraries).
Additional Context
Given the recent growth in contributors, this will significantly reduce "TypeErrors" in Pull Requests and improve code documentation.
Checklist
[Refactor] Comprehensive Type Hinting and PEP 561 Compliance
Summary
Add type hints to the entire codebase and include a
py.typedfile to make OracleTrace PEP 561 compliant.Problem
The current codebase lacks full type annotations. This results in poor autocompletion and lack of static analysis support (like
mypyorpyright) for developers using OracleTrace as a library or contributing to the core.Proposed Solution
tracer.py,cli.py, andanalysis.py.mypyto the dev dependencies and CI pipeline.py.typedfile in the package root to signal type-checker support.Use Case
A developer importing
oracletraceinto their own performance suite will get accurate IDE suggestions and type safety during development.Example
Alternatives Considered
Additional Context
Given the recent growth in contributors, this will significantly reduce "TypeErrors" in Pull Requests and improve code documentation.
Checklist