Replies: 1 comment
-
I believe that the This PR has an updated compatibility table about mixing legacy and new-style namespaces (all installed in the same virtual env): pypa/sample-namespace-packages#22. I am not sure about the consequences of nixpkgs approach. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
The legacy namespaces code path produces this file, which it seems like the modern PEP 420 code path does not. I also saw some attempts in the commit history of enabling it only for old Python versions that were backed out. The motivation behind my question is that there is a subtle bug (?) in nixpkgs that seems related to this file, and I'm wondering if it's safe for us to delete it.
Details of the Bug (?)
In nixpkgs, a package is installed into a path that looks like
/nix/store/...-{package}-{version}/lib/python310/site-packages
. Unlike in a virtualenv, these paths are disjoint from each other. When we create a binary for a Python application, we take these paths of the dependencies of the application and one-by-one callsite.addsitedir
on them to add them tosys.path
and run the .pth files.Let's say our namespace package is
a.b
. When*-nspkg.pth
executes, it might create a module spec fora
if one does not exist and add a path pointing to/nix/store/...-a-{version}/lib/python310/site-packages/a
. On the other hand, if there is a namespace packagea.c
that does not use the legacy path and does not come with a .pth file, its path/nix/store/...-c-{version}/lib/python310/site-packages/a
is not added.In some cases (I think when _last_parent_path of _NamespacePath is cached), it becomes impossible to import
a.c
.Reproduction
env1
and installsphinxcontrib-applehelp==1.0.4
in it (this does not use the legacy path).env2
and installsphinxcontrib-serializinghtml==1.1.5
in it (this does use the legacy path).env3
.env3
:env3/bin/python
.Beta Was this translation helpful? Give feedback.
All reactions