Skip to content

Run Black formatter and move import-based examples to syntax_demos#75

Merged
InauguralPhysicist merged 5 commits intomainfrom
copilot/run-black-formatter
Nov 23, 2025
Merged

Run Black formatter and move import-based examples to syntax_demos#75
InauguralPhysicist merged 5 commits intomainfrom
copilot/run-black-formatter

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 23, 2025

Applied Black formatter to enforce consistent Python code style across the repository and reorganized example files with unsupported features.

Changes

Black Formatting

  • Formatted src/eigenscript/compiler/codegen/llvm_backend.py:
    • Added trailing commas in CompilerError constructor calls
    • Collapsed multi-line TypeError message to single line

Black configuration already present in pyproject.toml (line-length=88, Python 3.10+). All 67 Python files now pass black --check.

Example File Organization

  • Moved robot_arm.eigs and robot_simple.eigs from examples/ to examples/syntax_demos/
  • These files contain import statements which aren't fully supported in the runtime yet
  • Files in syntax_demos/ are excluded from automated testing by test_examples.py
  • All 30 remaining example tests now pass

Testing

  • ✅ Black formatting verified with black --check .
  • ✅ All example tests pass: pytest tests/test_examples.py (32/32 tests)
  • ✅ No security issues detected
Original prompt

run black formatter please


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 23, 2025 15:12
Co-authored-by: InauguralPhysicist <217690737+InauguralPhysicist@users.noreply.github.com>
Co-authored-by: InauguralPhysicist <217690737+InauguralPhysicist@users.noreply.github.com>
Copilot AI changed the title [WIP] Add black formatter to the project Run Black formatter on codebase Nov 23, 2025
@InauguralPhysicist
Copy link
Copy Markdown
Owner

@copilot The failing job in your workflow is due to errors in two example files:

  1. robot_arm.eigs

    • Error: Syntax Error at line 23, column 42.
    • Message: "Expected INDENT, got NEWLINE"
    • Solution:
      • Inspect line 23 of the file and ensure that the syntax after column 42 is properly indented.
      • EigenScript expects an indented block at that position, likely after a control statement like if, for, or function definition.
      • Example fix:
        if some_condition:
            # <-- Ensure the next line is indented, not starting at the same column as the `if`
            do_something()
        
      • Review and correct indentation, especially just before and on line 23.
  2. robot_simple.eigs

    • Error: Runtime Error: Unknown AST node type: Import
    • Solution:
      • The error indicates Import statements are present but not supported by EigenScript.
      • Remove or comment out any import ... lines from the file.
      • If you need dependencies, see if EigenScript offers supported alternatives for including code or modules.

After making these changes, re-run your workflow to verify the fixes.

Direct links for review (using your workflow's ref):

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 23, 2025

@copilot The failing job in your workflow is due to errors in two example files:

  1. robot_arm.eigs...

These test failures are not related to my Black formatting changes. I only modified src/eigenscript/compiler/codegen/llvm_backend.py with cosmetic formatting (trailing commas).

The robot_arm.eigs and robot_simple.eigs files contain import statements which aren't fully supported in the runtime yet. According to the repository's pattern, these files should be moved to examples/syntax_demos/ to avoid being tested by test_examples.py.

Should I move these files to syntax_demos/ or would you prefer to handle this separately from the Black formatting PR?

Co-authored-by: InauguralPhysicist <217690737+InauguralPhysicist@users.noreply.github.com>
@InauguralPhysicist
Copy link
Copy Markdown
Owner

@copilot Yes

Co-authored-by: InauguralPhysicist <217690737+InauguralPhysicist@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Nov 23, 2025

@copilot Yes

Moved both files to examples/syntax_demos/ in commit 0fe7ba7. All example tests now pass (30 examples tested, excluding syntax_demos).

Copilot AI changed the title Run Black formatter on codebase Run Black formatter and move import-based examples to syntax_demos Nov 23, 2025
@InauguralPhysicist InauguralPhysicist marked this pull request as ready for review November 23, 2025 15:31
@InauguralPhysicist InauguralPhysicist merged commit bb5b68b into main Nov 23, 2025
10 checks passed
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