Skip to content

Introduce SourceManager and parser-independent PyHIR - #3

Merged
cedricroulof merged 5 commits into
mainfrom
feat/source-manager-pyhir
Sep 2, 2026
Merged

cedricroulof merged 5 commits into
mainfrom
feat/source-manager-pyhir

Conversation

@cedricroulof

Copy link
Copy Markdown
Contributor

Summary

  • record the target extensible analysis-engine architecture and migration boundaries
  • add typed SourceManager, SourceId, SourceSpan, and BOM-safe file loading
  • add immutable parser-independent PyHIR nodes and a stdlib AST adapter
  • route imports and PyIR lowering through PyHIR while preserving emitted IR
  • enforce strict MyPy, Ruff, and pytest checks in CI

Validation

  • python -m mypy
  • python -m pytest (36 passed)
  • python -m ruff check .
  • CLI smoke tests for local variables and canonical symbols

This PR intentionally does not add CFG, SSA, Tree-sitter, or the plugin runtime. Those remain later incremental phases described in docs/architecture.md.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b5ebeb8f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

arguments.posonlyargs or arguments.kwonlyargs or arguments.vararg or arguments.kwarg
)
if has_advanced_arguments or arguments.defaults or arguments.kw_defaults:
self.fail(arguments, "only required positional arguments are supported")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Report default-argument errors at the function span

When a function with a default argument starts after line 1, this reports the error as 1:1 because ast.arguments has no lineno or col_offset, causing span() to use its fallbacks. For example, a def f(x=1) on line 4 produces x.py:1:1, contrary to the source-located diagnostic promised for unsupported syntax; pass the function node or the relevant default/argument node to fail() instead.

Useful? React with 👍 / 👎.

@cedricroulof
cedricroulof merged commit 2606dda into main Sep 2, 2026
6 checks passed
SizzleUnrlsd pushed a commit that referenced this pull request Sep 3, 2026
Introduce SourceManager and parser-independent PyHIR
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.

1 participant