Skip to content

Add support for runpy.run_module and runpy.run_path tracing#17

Merged
jaredpalmer merged 2 commits intomainfrom
claude/add-edge-case-tests-GRDhU
Dec 30, 2025
Merged

Add support for runpy.run_module and runpy.run_path tracing#17
jaredpalmer merged 2 commits intomainfrom
claude/add-edge-case-tests-GRDhU

Conversation

@jaredpalmer
Copy link
Owner

This adds static analysis support for runpy module functions:

  • runpy.run_module('module') - traces module imports
  • runpy.run_path('path.py') - traces file path imports
  • Supports aliased imports (import runpy as rp)
  • Supports direct imports (from runpy import run_module)
  • Handles keyword arguments (mod_name=, path_name=)
  • Reports non-static expressions as warnings

Implementation includes:

  • Python AST parser updates in parse_imports.py
  • TypeScript regex fallback parser updates
  • trace.ts updates to resolve run_path file paths
  • DynamicImportInfo type extended with 'runpy' type and 'path' field
  • README updated to document runpy as handled
  • Comprehensive tests and fixtures for all variants

This adds static analysis support for runpy module functions:
- runpy.run_module('module') - traces module imports
- runpy.run_path('path.py') - traces file path imports
- Supports aliased imports (import runpy as rp)
- Supports direct imports (from runpy import run_module)
- Handles keyword arguments (mod_name=, path_name=)
- Reports non-static expressions as warnings

Implementation includes:
- Python AST parser updates in parse_imports.py
- TypeScript regex fallback parser updates
- trace.ts updates to resolve run_path file paths
- DynamicImportInfo type extended with 'runpy' type and 'path' field
- README updated to document runpy as handled
- Comprehensive tests and fixtures for all variants
@jaredpalmer jaredpalmer merged commit 1d8ad81 into main Dec 30, 2025
6 checks passed
@jaredpalmer jaredpalmer deleted the claude/add-edge-case-tests-GRDhU branch December 30, 2025 18:24
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