Skip to content

[RFC] Module scripts #649

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

Closed
wants to merge 27 commits into from
Closed

[RFC] Module scripts #649

wants to merge 27 commits into from

Conversation

klamike
Copy link

@klamike klamike commented Jul 22, 2025

This PR adds two module scripts:

  • python -m juliacall / python -m juliacall.repl to launch a REPL (with a custom banner 😄)
  • python -m juliacall.init to (lazily) download Julia and optionally show juliapkg env info.

The idea is these are nice for debugging -- calling python -m juliacall with the same exact environment as python juliacall_script.py, you know you are running exactly the same julia and project. The juliacall.init is nice as a quick sanity check, and in distributed settings like discourse post.

Happy to make any changes!

Here's what the REPL looks like:
Screenshot 2025-07-22 at 7 36 02 PM

@cjdoris
Copy link
Collaborator

cjdoris commented Aug 5, 2025

Hello, thanks for the PR. If I'm honest I don't think JuliaCall would benefit from a CLI.

Can you explain why being able to launch a Julia REPL like this is useful? I think a better alternative would be to add a CLI to JuliaPkg to run Julia directly, like python -m juliapkg run-julia args....

I do see the utility of the init CLI but again I think it would be better in JuliaPkg like python -m juliapkg resolve.

In conclusion, I'd totally be up for a PR to add a CLI to JuliaPkg with the above commands (and others like add, rm and status).

@klamike
Copy link
Author

klamike commented Aug 5, 2025

Thanks for your perspective and response to my request for comments! I agree it makes more sense to put these in juliapkg, especially what is currently "init". I can make an RFC PR for that in the next few days. One argument for keeping it here is that it may be more discoverable (many codes using juliacall will not have any import juliapkg, so users may not be aware that it is itself a Python package)

I can totally see why the REPL seems a bit too much. In particular makes it possible to modify the environment directly, ie without going through pyjuliapkg (since you can ]add), which might be problematic. My thinking behind it was that some users of juliacall don't have julia in their path, but may want to launch a REPL to do some light debugging/interactive development. This feature would let them do so and not have to worry about version/environment mismatches.

@cjdoris
Copy link
Collaborator

cjdoris commented Aug 5, 2025

On the discoverability side, juliapkg is in the docs for juliacall, which should suffice. I'm always happy to take PRs to improve the docs.

I'm happy to have the REPL stuff but over in juliacall like I said, which would directly launch Julia as a subprocess, instead of starting a REPL from within Julia.

If you do make a PR on juliapkg, please use click to create the CLI, using click's subcommands instead of separate modules.

I'll close this PR. Feel free to open an issue on juliapkg if you want to discuss further.

@cjdoris cjdoris closed this Aug 5, 2025
@cjdoris
Copy link
Collaborator

cjdoris commented Aug 5, 2025

Just created JuliaPy/pyjuliapkg#63

@klamike klamike deleted the mk/dundermain branch August 5, 2025 21:11
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