Reza Housseini <[email protected]> writes: > Hi Guixers > > I want to start again the discussion of converting propagated-inputs of > Python packages to normal inputs. I remembered that there was a > discussion once on the mailing list but I could not find it anymore. > > The general idea to make propagated inputs, normal inputs is the > following: Every Python package hard codes it's inputs dependency paths > in a file in the site-packages directory (could also be in METADATA or > any other similar file). We add an additional finder to the import > machinery, either to sys.meta_path or sys.path_hooks or we modify the > existing PathFinder. The new or modified finder has one addition: if an > import happens from a package residing inside the guix store, it first > checks if the file or location of the hard coded dependecies are present > and loads the module from there before processing with the standard > import process. >
I would just change the last part: if an import happens from a package residing inside the guix store, it first checks if the file or location of the hard coded dependencies are present and adds them to the sys.modules cache. > I think the actual difficult part is to single out imports coming from > files inside the store and than finding the package root to lookup the > hardcoded dependency paths and to make this process somewhat fast > (although once the module is loaded, we can rely on the caching of > sys.modules). The hooking into the import needs to be patched for each > Python version we support (probably somewhere here [0]) but it may not > be that immersive. > > What do you think? This needs probably a GCD if we ever want to go this > path, but I am not sure if this suggestion is completely wrong or maybe > undesired or was already suggested and discarded. > > Best, > Reza > > [0] > https://github.com/python/cpython/blob/main/Lib/importlib/_bootstrap_external.py Hi Reza, One of the downsides is that guix python libraries would only work with the guix version of the python interpreter, right? If you make it a GCD, then maybe you can have it be a cross-interpreter solution? Possibly, you could make a library to help bring the functionality to other interpreters (and maybe even upstream?). Have a nice day, Noé
signature.asc
Description: PGP signature
