Skip to content

Conversation

antonio-rojas
Copy link
Contributor

Matches python behavior, and fixes another regression with respect to the bash script

Fixes #40908

⌛ Dependencies

#40872

Co-authored-by: Tobias Diez <[email protected]>
Copy link

github-actions bot commented Sep 29, 2025

Documentation preview for this PR (built with commit 4170f19; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Copy link
Contributor

@tobiasdiez tobiasdiez left a comment

Choose a reason for hiding this comment

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

I'm a bit uncomfortable with putting the sys.path manipulation in the run commands. For example, they would be invoked by pytest as well, changing how other tests afterwards are run.

What are your thoughts on putting this line in cli.__main__ instead?

@antonio-rojas
Copy link
Contributor Author

What are your thoughts on putting this line in cli.__main__ instead?

That would only work when running python -m sage.cli, but not when running the sage executable, which doesn't go through __main__. What about main() in __init__.py?

@tobiasdiez
Copy link
Contributor

Would

[project.scripts]
sage = "sage.cli.__main__:main"

in pyproject.toml work?

@antonio-rojas
Copy link
Contributor Author

Would

[project.scripts]
sage = "sage.cli.__main__:main"

in pyproject.toml work?

Yes, it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

importing Python modules from current directory no longer possible in scripts
3 participants