[egenix-users] PyRun and PEX

M.-A. Lemburg mal at egenix.com
Sat May 23 23:48:16 CEST 2015

On 23.05.2015 11:57, Jürgen Hermann wrote:
> Hi, I tried (with success) to concatenate PyRun and a PEX to get a single distribution artifact for
> one-command projects (i.e. tools and services). The only wart is that one still needs to pass the
> "script name" to PyRun, else it starts the REPL.
> What do you think about a startup check to see if the PyRun executable is also a ZIP file, and then
> behave as-if sys.argv[0] was also passed as the first parameter?

We are currently investigating on how to achieve exactly that :-)

There are two things we'd like to add:

1. a way to combine PyRun with a ZIP file which contains Python
   code (this can be done by simply concatenating PyRun with the
   ZIP file and adding sys.executable to sys.path)

2. adding support to compile in other Python packages into a
   custom PyRun binary (this is somewhat more complicated, but
   still well within range)

For both features, we'd like to auto-import a module from the
Python package when PyRun starts in this mode.

I guess we could easily do this by trying to import a special
module pyrun_startup.py in this mode. The module could then
be provided by the package and then do whatever is needed
to run the package.

Another option would be to compile in the package name
and then run "-m package" when PyRun is started in the combined

> [PEX = https://github.com/pantsbuild/pex]

BTW: I don't think you really need PEX in such a setup. The
package put into a ZIP file and PyRun should be enough.

Marc-Andre Lemburg

Professional Python Services directly from the Source
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the egenix-users mailing list