On 16 mai 14:42, François Vanderkelen wrote: > Hi Sylvain, > > First of all thanks for the quick answer. I tried to create a dummy project > (the real one is confidential and not mine to give to the community) and it > helped me narrow down my two issues. > > The ImportError: No module named project is linked to the relative import, > and I could not reproduce the error in a dummy project. I finally found it, > it has to do with my namespaces packages. > > What I mean by namespaces is in my python library I dispose of several > packages like this : > > company.mongodb > company.redis > company.hbase > > And also : > > company.project.core > company.project.app.dashboard > company.project.app.security > > Where company and project are all the same things, this allows me and my > team to easily identify each package and what it is supposed to do. We try > to foster the open-source spirit in my company, hence the company top-level > namespace. It is still internal but at least we share it across all teams :) > > Going back to the issue, if one package of the namespace is installed, then > apparently pylint is looking directly inside the python path and can't find > my package since it is not yet installed. I have the same issue with the > "python setup.py develop" command, so I guess I am doing namespacing wrong, > or it is not well defined in python ? > > The only thing I do is adding > *_import__('pkg_resources').declare_namespace(__name__) > *in the __init__.py of the namespace package. > > If I run pylint in another environment without any packages installed, it > works like a charm (except I have a bunch of violations for missing > imports). > > Do you want me to open an issue on bitbucket explaining all that or do you > think I am doing something I am not supposed to do ?
I think what you're doing is right. The crash has already been supported: https://bitbucket.org/logilab/pylint/issue/203/importing-namespace-packages-crashes It seems to me that the namespace package issue is related to recent version of setuptools and has also been reported but can't find it right away. -- Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42) Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services CubicWeb, the semantic web framework: http://www.cubicweb.org _______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality