-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Execute pex archive at runtime with -m parameter #547
Comments
Providing a module as entry point that does the redirection (like runpy) actually works. Nevertheless shouldn't this be something implemented by default ?
|
@fhoering maybe - it's slightly tricky. So clearly, if there is no entrypoint defined for the pex at build time, having pex look for Do you have any idea for principles we could abide by to resolve this tension? |
I agree that having it parsed all the time and therefore users can't use the python interpreter options (-m -c, ..) anymore seems too intrusive. Having it only set when no entry point is specified seems acceptable to me. When no entry point is specified it behaves like the python interpreter. Easy to explain as well. My use case is that I want to use pex to ship code to the pyspark executors. I started fixing pyspark code (fhoering/spark@23447d5 (pythonexec can be provided, so it would be mypackpackage.pex) but finally I think this should be included in the pex package. So I will provide a custom entry point using runpy that redirects to the according module. |
This emulates the behavior of the python interpreter as we already do for `-` and <file>. Fixes pex-tool#547
This emulates the behavior of the python interpreter as we already do for `-` and <file>. Fixes #547
We would like to create a pex without a fixed entry point and provide different entry points at runtime.
The doc indicates that this can be achieved by tuning the environment variable PEX_MODULE
https://pex.readthedocs.io/en/stable/api/index.html#module-pex.variables
This indeed works but is a bit counter intuitive.
It would be nice to provide the entry point with the -m argument similar to how the python interpreter works but this doesn't work
./mypexfile.pex -m mymodule arg0 arg1 arg2
Is this something that can be implemented or it there a technical restriction not to to this ? In theory as we already propagate the arguments in the main file we could also remove the beginning and redirect to the right module ?
The text was updated successfully, but these errors were encountered: