You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pylint does not respect namespace pacakge. after debugging I found it's because is_namespace function defined in astroid.interpreter._import.util.py returns False if the submodule search location is in STD_AND_EXT_LIB_DIRS.
iffound_specandfound_spec.submodule_search_locations:
# But immediately return False if we can detect we are in stdlib# or external lib (e.g site-packages)ifany(
any(location.startswith(lib_dir) forlib_dirinSTD_AND_EXT_LIB_DIRS)
forlocationinfound_spec.submodule_search_locations
):
returnFalse
this is not a valid assumption. PEP 420 does not say this.
We are working on a big project as many teams. Our project lives in a namespace, say myproj. Different groups work on subproject, such as myproj.simulation and myproj.plot and myproj.calculation. These 3 packages are 3 different git repo and can be pip installed separately but they all goes to site-packages/myproj folder as site-packages/myproj/simulation, site-pacakges/myproj/plot etc. the myproj itself is a namespace package.
We have this need and I believe this is compatible with PEP420, but not with astroid.
I suggest remove line 96-102 of astroid/interpreter/_import/util.py.
The text was updated successfully, but these errors were encountered:
We can't just do a straight revert of #1756 without having another solution in hand for not recausing pylint-dev/pylint#7365.
jacobtylerwalls
changed the title
PEP 420 namespace package not respected by is_namespace
Namespace package not detected if installed in site-packages
Nov 17, 2024
pylint does not respect namespace pacakge. after debugging I found it's because
is_namespace
function defined inastroid.interpreter._import.util.py
returnsFalse
if thesubmodule search location
is inSTD_AND_EXT_LIB_DIRS
.this is not a valid assumption. PEP 420 does not say this.
We are working on a big project as many teams. Our project lives in a namespace, say
myproj
. Different groups work on subproject, such asmyproj.simulation
andmyproj.plot
andmyproj.calculation
. These 3 packages are 3 different git repo and can bepip
installed separately but they all goes tosite-packages/myproj
folder assite-packages/myproj/simulation
,site-pacakges/myproj/plot
etc. themyproj
itself is a namespace package.We have this need and I believe this is compatible with PEP420, but not with astroid.
I suggest remove line 96-102 of
astroid/interpreter/_import/util.py
.The text was updated successfully, but these errors were encountered: