setuptoos introduce the notion of 'namespace' package allowing to have sub-parts of a same package splitted into several eggs (eg what's used to build proper eggs for logilab'subpackages...) this should be understood by pylint/astng? | |
| priority | important |
|---|---|
| type | enhancement |
| appeared in | <not specified> |
| done in | 0.24.0 |
| load | 2.000 |
| load left | 2.000 |
| closed by | <not specified> |


#8774 iterator / generator / next method
Comments
-
2009/03/30 15:24, written by anon
| reply to this comment
-
2009/03/30 15:29, written by sthenault
| reply to this comment
-
2010/01/06 11:46, written by kevingill
| reply to this comment
-
2011/01/21 14:04, written by anon
| reply to this comment
-
2011/01/22 16:13, written by dsully
| reply to this comment
-
2011/06/14 05:37, written by anon
| reply to this comment
-
2011/11/03 11:53, written by anon
| reply to this comment
-
2012/04/26 17:53, written by jd
| reply to this comment
(add comment)The minimal sample below creates this output ("source lint_ns.sh"), note that the code itself works (prints the paste module's repr), but pylint can't see said module:
<module 'paste.script.templates' from '~/tmp/lint_ns/lib/python2.5/site-packages/PasteScript-1.7.3-py2.5.egg/paste/script/templates.pyc'>
pylint 0.18.0,
astng 0.19.0, common 0.39.0
Python 2.5.2 (r252:60911, Nov 14 2008, 19:46:32)
[GCC 4.3.2]
************* Module paste.lint_ns
C: 1: Missing docstring
E: 1: No name 'script' in module 'paste'
F: 1: Unable to import 'paste.script' (No module named script)
I could not reproduce the "TypeError: '_Yes' object is unindexable" I get with a more complex project, let's hope that disappears when all modules can be found.
==> lint_ns.sh <==
# must be sourced!
if test ! -d bin; then
virtualenv2.5 --no-site-packages .
. bin/activate
PYTHONPATH=. bin/python ./setup.py develop -U
fi
bin/python -m paste.lint_ns
bin/pylint --version
bin/pylint -rn paste
==> setup.py <==
from setuptools import setup
setup(
name = "lint_ns",
version = "0.1",
packages = ["paste.lint_ns"],
namespace_packages = ["paste"],
install_requires = [
"setuptools==0.6c9",
"PasteScript>=1.6.2",
"pylint==0.18.0",
#"logilab.pylintinstaller==0.1.1",
],
)
==> paste/__init__.py <==
"""Namespace package."""
__import__('pkg_resources').declare_namespace(__name__)
==> paste/lint_ns/__init__.py <==
from paste.script import templates
if __name__ == "__main__":
print repr(templates)
huum that's the one I was mainly interested in :(
I experienced this problem using the zope system. Zope uses large numbers or namespace eggs.
I work around it by modifying _module_file in modutils.py
before the line :
while modpath:insert:
try: _, mp_filename, mp_desc = find_module(os.sep.join(modpath), path) except ImportError: if checkeggs: return _search_zip(modpath, pic)[:2] raise mtype = mp_desc[2] return mtype, mp_filenameThis returns the correct name for imports from namespace eggs. It may mess up .zip eggs. It lowers the quality of the import error message.
Has there been any progress or workaround for this issue?
Also looking for an update here.
It looks like the code from kevingill above has been added to modutils.py already running logilab_common 0.53.0, but it doesn't fix the E0611 errors from Pylint.
Thanks
I have a few namespaced modules as well. as it stands i cannot use pylint because of the 300+ false positives it gives due to this error. Any updates?
I have a similar problem with pkgutil.extend_path. I added code to reproduce it to GitHub
This is preliminary because it only supports top-level namespace packages, but generalizing won't be too hard.
In logilab.common.modutils, import pkg_resources. Then in _module_file() insert the following lines just after while modpath:
With this I don't errors related to namespace packages anymore.