Skip to content

fix: do not split main.py on 'def main' #5895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pyranota
Copy link
Contributor

@pyranota pyranota commented Jun 6, 2025

doesn't work well in edge cases:

@schedule(
    bla=True
)
def main(x: str):
    return x
error_message = """
Please ensure you have defined main(username, password) correctly.
The function def main( should be at the end.
"""

def main(x: str):
    return x

Important

Remove splitting on 'def main(' in parse_code_for_imports to handle edge cases with decorators and multiline strings.

  • Behavior:
    • Removes splitting of code on 'def main(' in parse_code_for_imports in lib.rs.
    • Handles code as a whole to avoid issues with decorators and multiline strings.
  • Misc:
    • Minor formatting change in parse_python_imports_inner.

This description was created by Ellipsis for 8431e75. You can customize this summary. It will automatically update as commits are pushed.

doesn't work well in edge cases:

```
@schedule(
    bla=True
)
def main(x: str):
    return x
```

```
error_message = """
Please ensure you have defined main(username, password) correctly.
The function def main( should be at the end.
"""

def main(x: str):
    return x
```
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 8431e75 in 1 minute and 11 seconds. Click for details.
  • Reviewed 32 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. backend/parsers/windmill-parser-py-imports/src/lib.rs:28
  • Draft comment:
    Removed constant DEF_MAIN and the splitting on it in parse_code_for_imports. This resolves the edge case where a decorated or multiple-appearance of 'def main' would cause incorrect truncation.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. backend/parsers/windmill-parser-py-imports/src/lib.rs:378
  • Draft comment:
    Indentation adjustment for map_err(to_anyhow) appears to be solely formatting. Confirm consistency with project style guidelines.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None

Workflow ID: wflow_BZjNNGAAisVdryhI

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8431e75
Status: ✅  Deploy successful!
Preview URL: https://f471fd6d.windmill.pages.dev
Branch Preview URL: https://fix-dont-split-python-on-def.windmill.pages.dev

View logs

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