* python importers as an alternative to propagated-inputs
@ 2024-01-08 5:55 Justin Veilleux
2024-01-08 15:39 ` Ricardo Wurmus
0 siblings, 1 reply; 2+ messages in thread
From: Justin Veilleux @ 2024-01-08 5:55 UTC (permalink / raw)
To: guix-devel
Hi everyone. I was thinking about the propagated-inputs field in package
definitions. As I understand it, it is useful as a way to replace RPATHs
in packages that aren't compiled or don't support them.
I was reading the documentation on
https://docs.python.org/3/reference/import.html. It looks like we can
define custom objects to do module resolution, possibly bypassing
PYTHON_PATH lookup. I think it would be possible to write a very simple
importer object that looks up module paths from an environment variable
that looks like this:
PYTHON_GUIX_MODULE_PATH=numpy=/gnu/store/...,pandas=/gnu/store/...
This would make propagated-inputs for python libraries and programs
unnecessary.
Does someone know if this has been tried before? What potential problems
would I encounter if I tried to implement this?
Cheers.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: python importers as an alternative to propagated-inputs
2024-01-08 5:55 python importers as an alternative to propagated-inputs Justin Veilleux
@ 2024-01-08 15:39 ` Ricardo Wurmus
0 siblings, 0 replies; 2+ messages in thread
From: Ricardo Wurmus @ 2024-01-08 15:39 UTC (permalink / raw)
To: Justin Veilleux; +Cc: guix-devel
Justin Veilleux <terramorpha@cock.li> writes:
> Hi everyone. I was thinking about the propagated-inputs field in package
> definitions. As I understand it, it is useful as a way to replace RPATHs
> in packages that aren't compiled or don't support them.
>
> I was reading the documentation on
> https://docs.python.org/3/reference/import.html. It looks like we can
> define custom objects to do module resolution, possibly bypassing
> PYTHON_PATH lookup. I think it would be possible to write a very simple
> importer object that looks up module paths from an environment variable
> that looks like this:
>
> PYTHON_GUIX_MODULE_PATH=numpy=/gnu/store/...,pandas=/gnu/store/...
How would these compose? “pandas” has dependencies, too. Where would
those be read from? How can be guaranteed that these are compatible
with what we had at compile time?
> Does someone know if this has been tried before? What potential problems
> would I encounter if I tried to implement this?
In 2018 we discussed the problems of PYTHONPATH extensively. Hartmut
Goebel provided a three part analysis of the problem and potential
fixes.
The discussion didn’t lead to a generic solution, but it provided the
minimal reasons to replace our use of PYTHONPATH with GUIX_PYTHONPATH,
which we enable with a generated “sitecustomize.py” file — see (gnu
packages python) for details.
It would be great if we could do without GUIX_PYTHONPATH, which forces
us to harmonize *all* Python packages whenever we upgrade any of them.
Something that doesn’t require a global search path at all would be
ideal. Perhaps the venv feature is how we can get there. I recommend
reading the “PYTHONPATH issue analysis” messages for ideas and a list of
open questions.
--
Ricardo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-08 15:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08 5:55 python importers as an alternative to propagated-inputs Justin Veilleux
2024-01-08 15:39 ` Ricardo Wurmus
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).