Skip to content

[Refactor] Comprehensive Type Hinting and PEP 561 Compliance #36

@KaykCaputo

Description

@KaykCaputo

[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

  • I searched existing issues before opening this request
  • I described the problem and why this feature is useful
  • I provided enough detail for implementation discussion

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions