Skip to content
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

Add bin/python that mimics Python CLI #562

Closed
wants to merge 1 commit into from
Closed

Conversation

tkf
Copy link
Member

@tkf tkf commented Sep 12, 2018

This PR implements the tricky part (= libjulia initialization) of PyJulia "inside-out." By that I just mean to provide a simple Julia script (= bin/python) that drops into Python interpreter via PyCall. Inside this Python interpreter, setting up PyJulia is "free" and don't care if the Python executable is statically linked or not because it does not use the Python executable.

Now I can do

$ bin/python -c 'from julia import Base; Base.banner()'
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.0 (2018-08-08)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

even with Python from conda (whose sys.executable is statically linked to libpython).

@tkf tkf changed the title Add bin/python to mimic Python CLI Add bin/python that mimics Python CLI Sep 12, 2018

It tries to mimic a subset of Python CLI:
https://docs.python.org/3/using/cmdline.html
'''
Copy link
Member

Choose a reason for hiding this comment

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

Can't this be done in Julia?

@stevengj
Copy link
Member

I'm unclear on how you plan to use this in pyjulia — can you clarify?

If this is mainly intended for use in pyjulia, why does it need to be in PyCall.jl?

@tkf
Copy link
Member Author

tkf commented Sep 12, 2018

If this is mainly intended for use in pyjulia, why does it need to be in PyCall.jl?

Ah, yes, that's a good point. Historically, I started writing this patch in the form that provides PyJulia-like Python package that does not require PyJulia so it made sense to have it in PyCall. But then I totally agree that it should be in PyJulia.

@tkf tkf closed this Sep 12, 2018
@tkf tkf deleted the bin-python branch November 4, 2018 13:39
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