Hi all.

"Python devirtualizer" is a preliminary implementation which manages
shared packages so that only one copy of each package version is
required.  It installs into a virtualenv, then migrates the contents
out into the normal OS environment, and while so doing, replaces what
would be duplicate files with soft links to a single copy.  It is
downloadable from here:

https://sourceforge.net/projects/python-devirtualizer/

It is linux (or other POSIX like system, __maybe__ Mac)  specific.  No
way it will run on Windows at this point because the main script is
bash and the paths assume POSIX path syntax.  (Might work in Mingw64
though.)

Anyway,

pdvctrl install packageA
pdvctrl migrate packageA /wherever/packageA
pdvctrl install packageB
pdvctrl migrate packageB /wherever/packageB

will result in a single copy of the shared dependencies on this
system, with both packageA and packageB hooked to them with soft
links.  The import does not go awry because from within each package's
site-packages directory there are only links to the files it needs, so
it never sees any conflicting package versions.

There is also:

pdvctrl preinstall packageC
pdvctrl install packageC
pdvctrl migrate packageC /wherever/packageC

which first uses johnnydep to look up dependencies already on the
system and links those in directly before going on to install any
pieces not so installed.  Unfortunately the johnnydep runs with
"preinstall" have so far been significantly slower than just doing a
normal install and letting the migrate throw out the extra copy.  On
the other hand, the one package I have encountered which has
conflicting requirements (scanpy-scripts) fails in a more
comprehensible manner with "preinstall" than with "install".

Migrate "wraps" the files in the package's "bin" directory, if any, so
that they may be invoked solely by PATH like a regular program.  This
uses libSDL2 to get the absolute path of the wrapper program, and it
defines PYTHONPATH before execve() to the actual target.  So no
messing about with PYTHONPATH in the user's shell or in scripts.  So
far I have not run into a problem with the wrappers, which essentially
just inject a PYTHONPATH into the environment when the program is run.
Well, one package (busco) had a file with no terminal EOL, which
resulted in its last line being dropped while it was being wrapped,
but that case is now handled.  I do expect though at some point to
encounter a package which has several files in its bin, and
first_program will contain some variant of:

python3 /wherever/bin/second_program

The wrapper will break those, since the wrapper is a regular binary
and not a python script.

Regards,

David Mathog


On Mon, Jun 29, 2020 at 1:43 PM John Thorvald Wodder II
<jwod...@gmail.com> wrote:
>
> On 2020 Jun 29, at 16:09, David Mathog <dmat...@gmail.com> wrote:
> >
> > In neither case does the egg-info file reference the corresponding
> > directory, but at least the directory in both has the expected package
> > name (other than case).  In the examples you cited at the top, were
> > any of those "different name" cases from packages with a "file"
> > egg-info?
>
> The projects I examined were all in wheel form and thus had *.dist-info 
> directories instead of *.egg-info.  I know very little about how eggs work, 
> other than that they're deprecated and should be avoided in favor of wheels.
>
> -- John Wodder
> --
> Distutils-SIG mailing list -- distutils-sig@python.org
> To unsubscribe send an email to distutils-sig-le...@python.org
> https://mail.python.org/mailman3/lists/distutils-sig.python.org/
> Message archived at 
> https://mail.python.org/archives/list/distutils-sig@python.org/message/DMRPHSWPXPEWJOHFZVBKTJMH34KABHTM/
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/archives/list/distutils-sig@python.org/message/WIWLAD3537K7DYNUBZVIMPE7SFEV6E5L/

Reply via email to