Hi,

Am 26.01.26 um 22:21 schrieb Reza Housseini:

I want to start again the discussion of converting propagated-inputs of
Python packages to normal inputs.
I really like this idea.

Anyhow, what is then still be missing is: How to differentiate between packages needed at run-time (and which need to to into the profile/path, and packages needed at build-time only.

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.

I recommend to refrain from modifying the existing PathFinder. Your needs could easily be addresses be adding a custom Finder to sys.meta_path - and this is what sys.meta_path is deigned for.

Anyhow, it might not be necessary to use this. We might get along by adding normal .pth files to each package. When adding all indirect dependencies to this file, a wrapper-script could add the package's site-python directory to PYTHONPATH and we are done (untested). For a profile we would need to either merge all .pth files (as it is done AFAIK with font-config) or simply put all of these into the profiles's site-python directory.

--
Regards
Hartmut Goebel

| Hartmut Goebel          | [email protected]               |
| www.crazy-compilers.com | compilers which you thought are impossible |


Reply via email to