From vanderkelen.francois at gmail.com Tue Jul 1 11:22:11 2014 From: vanderkelen.francois at gmail.com (=?UTF-8?Q?Fran=C3=A7ois_Vanderkelen?=) Date: Tue, 1 Jul 2014 11:22:11 +0200 Subject: [code-quality] Namespaced packages and relative imports In-Reply-To: References: <20140516120249.GR2881@logilab.fr> <20140516130154.GV2881@logilab.fr> Message-ID: Hi Sylvain, experts. I tried to work a little more on this and I found out why it "worked" with setuptools 0.9.8. Turns out it did not, it is just when you start with a clean environement (not containing any of your namespaced packages) pylint is running properly and flagging every import of related namespace packages as missing. Although the good part is that it is matching properly relatives import, you cannot have multiple dependencies to packages from the same namespace. I am pretty sure that namespace usage is "erratic" in python since even Setuptools does not seem to respect PEP420, but I am not sure the fact the Pylint block on this comes from setuptools. I think is is worth fixing but I am not sure where to start :) 2014-05-16 15:57 GMT+02:00 Fran?ois Vanderkelen < vanderkelen.francois at gmail.com>: > I tried multiple things, first even if I install the package before > running pylint it won't work except on one of my machines. > > So I tried to narrow it down with setuptools : > > Working with 0.9.8 > Not working with 2.2 (ImportError) > Not working with 3.6 (ImportError) > > I guess setuptools changed something concerning namespaces packages, bug > or not this is another story. I'll keep looking. > > Thanks a lot Sylvain > > > 2014-05-16 15:01 GMT+02:00 Sylvain Th?nault : > > 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 >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stilley2 at jhmi.edu Tue Jul 1 20:33:25 2014 From: stilley2 at jhmi.edu (Steven Tilley II) Date: Tue, 1 Jul 2014 14:33:25 -0400 Subject: [code-quality] flake8 not showing pyflakes errors Message-ID: <20140701183325.GB12387@Tilley_IdeaPad.ebalto.jhmi.edu> Flake8 devs, I have been having a problem with flake8 not finding pyflakes errors on windows. I was wondering how I can go about debugging this issue. Thanks Steve From florent.xicluna at gmail.com Tue Jul 1 21:58:39 2014 From: florent.xicluna at gmail.com (Florent) Date: Tue, 1 Jul 2014 21:58:39 +0200 Subject: [code-quality] flake8 not showing pyflakes errors In-Reply-To: <20140701183325.GB12387@Tilley_IdeaPad.ebalto.jhmi.edu> References: <20140701183325.GB12387@Tilley_IdeaPad.ebalto.jhmi.edu> Message-ID: Hello, Some hints to help you: you can list the dependencies and their versions flake8 --version you can try forcing the detection with flake8 --select E,F,W your_project_dir Or try also with Pyflakes directly ... pyflakes your_project_dir This is a good start. -- Florent 2014-07-01 20:33 GMT+02:00 Steven Tilley II : > Flake8 devs, > I have been having a problem with flake8 not finding pyflakes errors on > windows. I was wondering how I can go about debugging this issue. > Thanks > Steve > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality From graffatcolmingov at gmail.com Tue Jul 1 21:59:13 2014 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Tue, 1 Jul 2014 14:59:13 -0500 Subject: [code-quality] flake8 not showing pyflakes errors In-Reply-To: <20140701183325.GB12387@Tilley_IdeaPad.ebalto.jhmi.edu> References: <20140701183325.GB12387@Tilley_IdeaPad.ebalto.jhmi.edu> Message-ID: Do you see output when you run `pyflakes path/to/files`? On Tue, Jul 1, 2014 at 1:33 PM, Steven Tilley II wrote: > Flake8 devs, > I have been having a problem with flake8 not finding pyflakes errors on > windows. I was wondering how I can go about debugging this issue. > Thanks > Steve > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality From florent.xicluna at gmail.com Tue Jul 1 22:43:02 2014 From: florent.xicluna at gmail.com (Florent) Date: Tue, 1 Jul 2014 22:43:02 +0200 Subject: [code-quality] flake8 not showing pyflakes errors In-Reply-To: <20140701203320.GC12387@Tilley_IdeaPad.ebalto.jhmi.edu> References: <20140701183325.GB12387@Tilley_IdeaPad.ebalto.jhmi.edu> <20140701203320.GC12387@Tilley_IdeaPad.ebalto.jhmi.edu> Message-ID: I'm not a Windows user, however I think you can try to understand what happens with these questions. - is there 2 versions of Python (eg: python2 and python3) - where are flake8.exe and pyflakes.exe located? - if you run the python interpreter and "import pyflakes" and "import flake8", does it works? - how did you install flake8 and pyflakes? - did you check if pip and setuptools are up-to-date (pip install -U pip setuptools) Finally, you could try removing both and re-installing flake8 only (pip install flake8). -- Florent 2014-07-01 22:33 GMT+02:00 Steven Tilley II : > Florent and Ian, > Thanks for the quick reply. > flake8 --version doesn't show pyflakes, so I guess it isn't getting detected. > However, I can call pyflakes directly from the command line and it will detect > errors. > Thanks again, > Steve >> Hello, >> >> Some hints to help you: >> >> you can list the dependencies and their versions >> >> flake8 --version >> >> you can try forcing the detection with >> >> flake8 --select E,F,W your_project_dir >> >> Or try also with Pyflakes directly ... >> >> pyflakes your_project_dir >> >> >> This is a good start. >> >> -- >> Florent >> >> >> >> 2014-07-01 20:33 GMT+02:00 Steven Tilley II : >> > Flake8 devs, >> > I have been having a problem with flake8 not finding pyflakes errors on >> > windows. I was wondering how I can go about debugging this issue. >> > Thanks >> > Steve >> > _______________________________________________ >> > code-quality mailing list >> > code-quality at python.org >> > https://mail.python.org/mailman/listinfo/code-quality From stilley2 at jhmi.edu Tue Jul 1 22:33:20 2014 From: stilley2 at jhmi.edu (Steven Tilley II) Date: Tue, 1 Jul 2014 16:33:20 -0400 Subject: [code-quality] flake8 not showing pyflakes errors In-Reply-To: References: <20140701183325.GB12387@Tilley_IdeaPad.ebalto.jhmi.edu> Message-ID: <20140701203320.GC12387@Tilley_IdeaPad.ebalto.jhmi.edu> Florent and Ian, Thanks for the quick reply. flake8 --version doesn't show pyflakes, so I guess it isn't getting detected. However, I can call pyflakes directly from the command line and it will detect errors. Thanks again, Steve > Hello, > > Some hints to help you: > > you can list the dependencies and their versions > > flake8 --version > > you can try forcing the detection with > > flake8 --select E,F,W your_project_dir > > Or try also with Pyflakes directly ... > > pyflakes your_project_dir > > > This is a good start. > > -- > Florent > > > > 2014-07-01 20:33 GMT+02:00 Steven Tilley II : > > Flake8 devs, > > I have been having a problem with flake8 not finding pyflakes errors on > > windows. I was wondering how I can go about debugging this issue. > > Thanks > > Steve > > _______________________________________________ > > code-quality mailing list > > code-quality at python.org > > https://mail.python.org/mailman/listinfo/code-quality From stilley2 at jhmi.edu Wed Jul 2 15:33:08 2014 From: stilley2 at jhmi.edu (Steven Tilley) Date: Wed, 2 Jul 2014 13:33:08 +0000 Subject: [code-quality] flake8 not showing pyflakes errors In-Reply-To: References: <20140701183325.GB12387@Tilley_IdeaPad.ebalto.jhmi.edu> <20140701203320.GC12387@Tilley_IdeaPad.ebalto.jhmi.edu>, Message-ID: <1404307987572.32454@jhmi.edu> I got it working. I uninstalled using conda and reinstalled using pip. I'm still not sure if the problem was just a botched install or if there is something strange with the conda package, but at least it's working. Thanks for all your help everyone! Best Steve ________________________________________ From: Florent Sent: Tuesday, July 1, 2014 4:43 PM To: Steven Tilley Cc: code-quality at python.org Subject: Re: [code-quality] flake8 not showing pyflakes errors I'm not a Windows user, however I think you can try to understand what happens with these questions. - is there 2 versions of Python (eg: python2 and python3) - where are flake8.exe and pyflakes.exe located? - if you run the python interpreter and "import pyflakes" and "import flake8", does it works? - how did you install flake8 and pyflakes? - did you check if pip and setuptools are up-to-date (pip install -U pip setuptools) Finally, you could try removing both and re-installing flake8 only (pip install flake8). -- Florent 2014-07-01 22:33 GMT+02:00 Steven Tilley II : > Florent and Ian, > Thanks for the quick reply. > flake8 --version doesn't show pyflakes, so I guess it isn't getting detected. > However, I can call pyflakes directly from the command line and it will detect > errors. > Thanks again, > Steve >> Hello, >> >> Some hints to help you: >> >> you can list the dependencies and their versions >> >> flake8 --version >> >> you can try forcing the detection with >> >> flake8 --select E,F,W your_project_dir >> >> Or try also with Pyflakes directly ... >> >> pyflakes your_project_dir >> >> >> This is a good start. >> >> -- >> Florent >> >> >> >> 2014-07-01 20:33 GMT+02:00 Steven Tilley II : >> > Flake8 devs, >> > I have been having a problem with flake8 not finding pyflakes errors on >> > windows. I was wondering how I can go about debugging this issue. >> > Thanks >> > Steve >> > _______________________________________________ >> > code-quality mailing list >> > code-quality at python.org >> > https://mail.python.org/mailman/listinfo/code-quality From graffatcolmingov at gmail.com Wed Jul 2 16:44:14 2014 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Wed, 2 Jul 2014 09:44:14 -0500 Subject: [code-quality] flake8 not showing pyflakes errors In-Reply-To: <1404307987572.32454@jhmi.edu> References: <20140701183325.GB12387@Tilley_IdeaPad.ebalto.jhmi.edu> <20140701203320.GC12387@Tilley_IdeaPad.ebalto.jhmi.edu> <1404307987572.32454@jhmi.edu> Message-ID: Hm, I wonder if conda respects the entry_points registered in flake8's entry_points for PyFlakes (https://bitbucket.org/tarek/flake8/src/91696afa10b21297a7889af3b383921890d118bb/setup.py?at=default#cl-48). I will try to investigate that this weekend. On Wed, Jul 2, 2014 at 8:33 AM, Steven Tilley wrote: > I got it working. I uninstalled using conda and reinstalled using pip. I'm still not sure if the problem was just a botched install or if there is something strange with the conda package, but at least it's working. Thanks for all your help everyone! > Best > Steve > ________________________________________ > From: Florent > Sent: Tuesday, July 1, 2014 4:43 PM > To: Steven Tilley > Cc: code-quality at python.org > Subject: Re: [code-quality] flake8 not showing pyflakes errors > > I'm not a Windows user, however I think you can try to understand what > happens with these questions. > > - is there 2 versions of Python (eg: python2 and python3) > - where are flake8.exe and pyflakes.exe located? > - if you run the python interpreter and "import pyflakes" and "import > flake8", does it works? > - how did you install flake8 and pyflakes? > - did you check if pip and setuptools are up-to-date (pip install -U > pip setuptools) > > Finally, you could try removing both and re-installing flake8 only > (pip install flake8). > > > -- > Florent > > > 2014-07-01 22:33 GMT+02:00 Steven Tilley II : >> Florent and Ian, >> Thanks for the quick reply. >> flake8 --version doesn't show pyflakes, so I guess it isn't getting detected. >> However, I can call pyflakes directly from the command line and it will detect >> errors. >> Thanks again, >> Steve >>> Hello, >>> >>> Some hints to help you: >>> >>> you can list the dependencies and their versions >>> >>> flake8 --version >>> >>> you can try forcing the detection with >>> >>> flake8 --select E,F,W your_project_dir >>> >>> Or try also with Pyflakes directly ... >>> >>> pyflakes your_project_dir >>> >>> >>> This is a good start. >>> >>> -- >>> Florent >>> >>> >>> >>> 2014-07-01 20:33 GMT+02:00 Steven Tilley II : >>> > Flake8 devs, >>> > I have been having a problem with flake8 not finding pyflakes errors on >>> > windows. I was wondering how I can go about debugging this issue. >>> > Thanks >>> > Steve >>> > _______________________________________________ >>> > code-quality mailing list >>> > code-quality at python.org >>> > https://mail.python.org/mailman/listinfo/code-quality > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality From rogerb at rogerbinns.com Tue Jul 8 22:34:08 2014 From: rogerb at rogerbinns.com (Roger Binns) Date: Tue, 08 Jul 2014 13:34:08 -0700 Subject: [code-quality] Minor ignore config issue Message-ID: <53BC55C0.7060100@rogerbinns.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 In my config file I had this: ignore = E226, E225 The E225 bit didn't work. I worked out that the space after the comma was causing the problem. Can I recommend that strip is run on each part after splitting on the comma? Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlO8VcAACgkQmOOfHg372QSmRQCeJF8u9qC9FcDioDDIJbwR6xMn KC8AniRQ2K4O09UavNqB5JkZCKzBGXcy =x7hJ -----END PGP SIGNATURE----- From feng.liang at tektronix.com Fri Jul 11 01:30:08 2014 From: feng.liang at tektronix.com (Liang, Feng) Date: Thu, 10 Jul 2014 23:30:08 +0000 Subject: [code-quality] =?windows-1252?q?flake8_offers_an_extra_option=3A_?= =?windows-1252?q?=96max-complexity=2C_which_will_emit_a_warning_if_the_Mc?= =?windows-1252?q?Cabe_complexity_of_a_function_is_higher_than_the_value?= =?windows-1252?q?=2E_By_default_it=92s_deactivated?= Message-ID: Hello, I like to keep this feature turned off, but somehow it?s on and I don?t know when, where or how I turned it on. I don?t have any config file at all. Can you shed some light here how to turn it off? Thank you, Feng -------------- next part -------------- An HTML attachment was scrubbed... URL: From florent.xicluna at gmail.com Fri Jul 11 09:48:24 2014 From: florent.xicluna at gmail.com (Florent) Date: Fri, 11 Jul 2014 09:48:24 +0200 Subject: [code-quality] =?utf-8?q?flake8_offers_an_extra_option=3A_?= =?utf-8?q?=E2=80=93max-complexity=2C_which_will_emit_a_warning_if_?= =?utf-8?q?the_McCabe_complexity_of_a_function_is_higher_than_the_v?= =?utf-8?q?alue=2E_By_default_it=E2=80=99s_deactivated?= In-Reply-To: References: Message-ID: Hello Feng, you can list the configuration location(s) from you project directory with : flake8 -v missing_file Then you search a "setup.cfg" or "tox.ini" in the directory. http://flake8.readthedocs.org/en/latest/config.html Best regards, -- Florent 2014-07-11 1:30 GMT+02:00 Liang, Feng : > Hello, > > I like to keep this feature turned off, but somehow it?s on and I don?t know > when, where or how I turned it on. I don?t have any config file at all. > > Can you shed some light here how to turn it off? > > Thank you, > > Feng > > > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality > From sylvain.thenault at logilab.fr Fri Jul 11 11:59:52 2014 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Fri, 11 Jul 2014 11:59:52 +0200 Subject: [code-quality] Europython 14 Message-ID: <20140711095952.GF3410@logilab.fr> Hi there, a quick email to let you know that Torsten, Claudiu and I, the main pylint developpers, will met together during EP14 in Berlin in the next few weeks. It may be a good opportunity to talk with other people developping other tools for python or interested by code quality in general. So, let me know! cheers -- 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 From andrey.vlasovskikh at gmail.com Fri Jul 11 18:02:32 2014 From: andrey.vlasovskikh at gmail.com (Andrey Vlasovskikh) Date: Fri, 11 Jul 2014 20:02:32 +0400 Subject: [code-quality] Europython 14 In-Reply-To: <20140711095952.GF3410@logilab.fr> References: <20140711095952.GF3410@logilab.fr> Message-ID: Hi, Our PyCharm team will be there too. It would be nice to meet you. -- Andrey Vlasovskikh Senior Software Developer JetBrains http://www.jetbrains.com/ "Develop with pleasure!" From carl at carlcrowder.com Mon Jul 14 11:52:04 2014 From: carl at carlcrowder.com (Carl Crowder) Date: Mon, 14 Jul 2014 11:52:04 +0200 Subject: [code-quality] Europython 14 In-Reply-To: References: <20140711095952.GF3410@logilab.fr> Message-ID: Hi, I will be there, and would love to meet up with you all. I'll be doing a talk on 'Automated Code Reviews', which is largely based on the lessons learned from creating https://landscape.io, which builds on the amazing work you guys have done with pylint! Carl On 11 July 2014 18:02, Andrey Vlasovskikh wrote: > Hi, > > Our PyCharm team will be there too. It would be nice to meet you. > > -- > Andrey Vlasovskikh > Senior Software Developer > JetBrains > http://www.jetbrains.com/ > "Develop with pleasure!" > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality From tincho at tincho.org Tue Jul 15 00:34:40 2014 From: tincho at tincho.org (=?windows-1252?Q?Mart=EDn_Ferrari?=) Date: Mon, 14 Jul 2014 23:34:40 +0100 Subject: [code-quality] Unable to import error from pylint Message-ID: <53C45B00.6020505@tincho.org> Hi! This is probably a FAQ, but I cannot find it anywhere in the docs. I get a F0401 (Unable to import) when importing a flask external module, which involves a trick on __init__ on the parent package to locate the actual module, which has a different name (flask.ext.httpauth is in fact flask_httpauth, with no package name). I understand that pylint avoids executing code on imports, so that explains this message. The question would be: is there a way to fix this situation without ignoring everything that uses that module? Adding an 'import flask.ext.httpauth' in the init-hook does not seem to solve it. Thanks! -- Mart??n Ferrari (Tincho) From graffatcolmingov at gmail.com Tue Jul 15 01:32:13 2014 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Mon, 14 Jul 2014 18:32:13 -0500 Subject: [code-quality] Unable to import error from pylint In-Reply-To: <53C45B00.6020505@tincho.org> References: <53C45B00.6020505@tincho.org> Message-ID: On Mon, Jul 14, 2014 at 5:34 PM, Mart?n Ferrari wrote: > > Hi! > > This is probably a FAQ, but I cannot find it anywhere in the docs. > > I get a F0401 (Unable to import) when importing a flask external module, > which involves a trick on __init__ on the parent package to locate the > actual module, which has a different name (flask.ext.httpauth is in fact > flask_httpauth, with no package name). > > I understand that pylint avoids executing code on imports, so that > explains this message. > > The question would be: is there a way to fix this situation without > ignoring everything that uses that module? Adding an 'import > flask.ext.httpauth' in the init-hook does not seem to solve it. > > Thanks! > > -- > Mart??n Ferrari (Tincho) > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality Hi there, This might be of interest to you: http://stackoverflow.com/questions/16061514/pylint-pylint-unable-to-import-flask-ext-wtf Alternatively, there is no good way for you to do this (that I'm aware of) other than ignoring things that use flask.ext.* Cheers, Ian From sylvain.thenault at logilab.fr Thu Jul 17 17:15:50 2014 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Thu, 17 Jul 2014 17:15:50 +0200 Subject: [code-quality] Europython 14 In-Reply-To: References: <20140711095952.GF3410@logilab.fr> Message-ID: <20140717151550.GK3401@logilab.fr> That would be great to see you both. I don't know yet where we'll meet, but we will probably drop an email on the list to let you know. Cheers > Hi, > > I will be there, and would love to meet up with you all. I'll be doing > a talk on 'Automated Code Reviews', which is largely based on the > lessons learned from creating https://landscape.io, which builds on > the amazing work you guys have done with pylint! > > Carl > > On 11 July 2014 18:02, Andrey Vlasovskikh wrote: > > Hi, > > > > Our PyCharm team will be there too. It would be nice to meet you. > > > > -- > > Andrey Vlasovskikh > > Senior Software Developer > > JetBrains > > http://www.jetbrains.com/ > > "Develop with pleasure!" > > _______________________________________________ > > code-quality mailing list > > code-quality at python.org > > https://mail.python.org/mailman/listinfo/code-quality > -- 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 From sylvain.thenault at logilab.fr Thu Jul 17 18:09:40 2014 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Thu, 17 Jul 2014 18:09:40 +0200 Subject: [code-quality] Namespaced packages and relative imports In-Reply-To: References: <20140516120249.GR2881@logilab.fr> <20140516130154.GV2881@logilab.fr> Message-ID: <20140717160940.GU3401@logilab.fr> Hi Fran?ois, by chance, would you be in EuroPython next week ? I intend to work on this namespace package problem there. Cheers On 01 juillet 11:22, Fran?ois Vanderkelen wrote: > Hi Sylvain, experts. > > I tried to work a little more on this and I found out why it "worked" with > setuptools 0.9.8. > > Turns out it did not, it is just when you start with a clean environement > (not containing any of your namespaced packages) pylint is running properly > and flagging every import of related namespace packages as missing. > > Although the good part is that it is matching properly relatives import, > you cannot have multiple dependencies to packages from the same namespace. > > I am pretty sure that namespace usage is "erratic" in python since even > Setuptools does not seem to respect PEP420, but I am not sure the fact the > Pylint block on this comes from setuptools. > > I think is is worth fixing but I am not sure where to start :) > > > 2014-05-16 15:57 GMT+02:00 Fran?ois Vanderkelen < > vanderkelen.francois at gmail.com>: > > > I tried multiple things, first even if I install the package before > > running pylint it won't work except on one of my machines. > > > > So I tried to narrow it down with setuptools : > > > > Working with 0.9.8 > > Not working with 2.2 (ImportError) > > Not working with 3.6 (ImportError) > > > > I guess setuptools changed something concerning namespaces packages, bug > > or not this is another story. I'll keep looking. > > > > Thanks a lot Sylvain > > > > > > 2014-05-16 15:01 GMT+02:00 Sylvain Th?nault : > > > > 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 > >> > > > > -- 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 From vanderkelen.francois at gmail.com Thu Jul 17 18:56:47 2014 From: vanderkelen.francois at gmail.com (=?UTF-8?Q?Fran=C3=A7ois_Vanderkelen?=) Date: Thu, 17 Jul 2014 18:56:47 +0200 Subject: [code-quality] Namespaced packages and relative imports In-Reply-To: <20140717160940.GU3401@logilab.fr> References: <20140516120249.GR2881@logilab.fr> <20140516130154.GV2881@logilab.fr> <20140717160940.GU3401@logilab.fr> Message-ID: Hi Sylvain, Unfortunately I won't be able to attend the EuroPython next week. But please keep me in the loop, I will try to make as much time as I can if you need me to do some test or provide you with anything. Cheers 2014-07-17 18:09 GMT+02:00 Sylvain Th?nault : > Hi Fran?ois, > > by chance, would you be in EuroPython next week ? I intend to work on this > namespace package problem there. > > Cheers > > On 01 juillet 11:22, Fran?ois Vanderkelen wrote: > > Hi Sylvain, experts. > > > > I tried to work a little more on this and I found out why it "worked" > with > > setuptools 0.9.8. > > > > Turns out it did not, it is just when you start with a clean environement > > (not containing any of your namespaced packages) pylint is running > properly > > and flagging every import of related namespace packages as missing. > > > > Although the good part is that it is matching properly relatives import, > > you cannot have multiple dependencies to packages from the same > namespace. > > > > I am pretty sure that namespace usage is "erratic" in python since even > > Setuptools does not seem to respect PEP420, but I am not sure the fact > the > > Pylint block on this comes from setuptools. > > > > I think is is worth fixing but I am not sure where to start :) > > > > > > 2014-05-16 15:57 GMT+02:00 Fran?ois Vanderkelen < > > vanderkelen.francois at gmail.com>: > > > > > I tried multiple things, first even if I install the package before > > > running pylint it won't work except on one of my machines. > > > > > > So I tried to narrow it down with setuptools : > > > > > > Working with 0.9.8 > > > Not working with 2.2 (ImportError) > > > Not working with 3.6 (ImportError) > > > > > > I guess setuptools changed something concerning namespaces packages, > bug > > > or not this is another story. I'll keep looking. > > > > > > Thanks a lot Sylvain > > > > > > > > > 2014-05-16 15:01 GMT+02:00 Sylvain Th?nault < > sylvain.thenault at logilab.fr>: > > > > > > 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 > > >> > > > > > > > > -- > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tmarek at google.com Mon Jul 21 14:10:47 2014 From: tmarek at google.com (Torsten Marek) Date: Mon, 21 Jul 2014 14:10:47 +0200 Subject: [code-quality] Europython 14 In-Reply-To: <20140717151550.GK3401@logilab.fr> References: <20140711095952.GF3410@logilab.fr> <20140717151550.GK3401@logilab.fr> Message-ID: Hi, we'll have a PyLint sprint in room C04 at EuroPython starting Wednesday, so if you just want to meet up with us, drop by in that room. Maybe we could also have a BoF session about static Python analysis? // Torsten On Thu, Jul 17, 2014 at 5:15 PM, Sylvain Th?nault < sylvain.thenault at logilab.fr> wrote: > That would be great to see you both. I don't know yet where we'll meet, > but we > will probably drop an email on the list to let you know. > > Cheers > > > Hi, > > > > I will be there, and would love to meet up with you all. I'll be doing > > a talk on 'Automated Code Reviews', which is largely based on the > > lessons learned from creating https://landscape.io, which builds on > > the amazing work you guys have done with pylint! > > > > Carl > > > > On 11 July 2014 18:02, Andrey Vlasovskikh > wrote: > > > Hi, > > > > > > Our PyCharm team will be there too. It would be nice to meet you. > > > > > > -- > > > Andrey Vlasovskikh > > > Senior Software Developer > > > JetBrains > > > http://www.jetbrains.com/ > > > "Develop with pleasure!" > > > _______________________________________________ > > > code-quality mailing list > > > code-quality at python.org > > > https://mail.python.org/mailman/listinfo/code-quality > > > > -- > 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 at python.org > https://mail.python.org/mailman/listinfo/code-quality > -- Site Reliability Engineer ? Google ? ? ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From graffatcolmingov at gmail.com Mon Jul 21 14:26:56 2014 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Mon, 21 Jul 2014 07:26:56 -0500 Subject: [code-quality] Europython 14 In-Reply-To: References: <20140711095952.GF3410@logilab.fr> <20140717151550.GK3401@logilab.fr> Message-ID: This makes me regret all the more that I'm not at EuroPython. Have fun y'all! On Mon, Jul 21, 2014 at 7:10 AM, Torsten Marek wrote: > Hi, > > we'll have a PyLint sprint in room C04 at EuroPython starting Wednesday, so > if you just want to meet up with us, drop by in that room. Maybe we could > also have a BoF session about static Python analysis? > > // Torsten > > > On Thu, Jul 17, 2014 at 5:15 PM, Sylvain Th?nault > wrote: >> >> That would be great to see you both. I don't know yet where we'll meet, >> but we >> will probably drop an email on the list to let you know. >> >> Cheers >> >> > Hi, >> > >> > I will be there, and would love to meet up with you all. I'll be doing >> > a talk on 'Automated Code Reviews', which is largely based on the >> > lessons learned from creating https://landscape.io, which builds on >> > the amazing work you guys have done with pylint! >> > >> > Carl >> > >> > On 11 July 2014 18:02, Andrey Vlasovskikh >> > wrote: >> > > Hi, >> > > >> > > Our PyCharm team will be there too. It would be nice to meet you. >> > > >> > > -- >> > > Andrey Vlasovskikh >> > > Senior Software Developer >> > > JetBrains >> > > http://www.jetbrains.com/ >> > > "Develop with pleasure!" >> > > _______________________________________________ >> > > code-quality mailing list >> > > code-quality at python.org >> > > https://mail.python.org/mailman/listinfo/code-quality >> > >> >> -- >> 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 at python.org >> https://mail.python.org/mailman/listinfo/code-quality > > > > > -- > Site Reliability Engineer ? Google ? ? ? > > > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality > From Bruno.Daniel at blue-yonder.com Thu Jul 24 10:55:58 2014 From: Bruno.Daniel at blue-yonder.com (Daniel, Bruno) Date: Thu, 24 Jul 2014 08:55:58 +0000 Subject: [code-quality] Contribution: Checking function, method, and constructor parameter documentation Message-ID: <2AECE7393BD56548A551D05DC07650882C6BE501@london.phi-tps.local> Dear pylint developers, We use pylint extensively in our company -- thanks this great tool! -- and wrote some plugins ourselves to aid us in our daily work. One of these plugins is a Sphinx parameter documentation checker that helps us to identify missing parameter or parameter type documentation in functions, methods and class constructors (__init__ methods). The checker class also identifies naming inconsistencies between each function or method signature and the corresponding docstring. By convention, we use Sphinx syntax for the parameter documentation (see below for examples) and we document class constructor parameters in the class docstring. We want to offer this code to you as a optional standard pylint checker. Would such an addition to pylint be welcome? To illustrate, here are our unit tests which include several examples: -snip----- test_pylint_plugin.py ---------------------------------------------- """Unittest for our pylint plugin.""" from __future__ import division, print_function import unittest from astroid import test_utils from pylint.testutils import CheckerTestCase, Message, set_config from nbpy_devel.pylint_plugin import SphinxDocChecker, NbpyChecker class SpinxDocCheckerTest(CheckerTestCase): """Tests for pylint_plugin.SphinxDocChecker""" CHECKER_CLASS = SphinxDocChecker def test_missing_func_params_in_docstring(self): """Example of a function with missing parameter documentation in the docstring """ node = test_utils.extract_node(""" def function_foo(x, y): '''docstring ... missing parameter documentation''' pass """) with self.assertAddsMessages( Message( msg_id='W9003', node=node, args=('x, y',)), Message( msg_id='W9004', node=node, args=('x, y',))): self.checker.visit_function(node) def test_missing_method_params_in_docstring(self): """Example of a class method with missing parameter documentation in the docstring """ node = test_utils.extract_node(""" class Foo(object): def method_foo(self, x, y): '''docstring ... missing parameter documentation''' pass """) method_node = node.body[0] with self.assertAddsMessages( Message( msg_id='W9003', node=method_node, args=('x, y',)), Message( msg_id='W9004', node=method_node, args=('x, y',))): self.checker.visit(node) def test_existing_func_params_in_docstring(self): """Example of a function with correctly documented parameters and return values """ node = test_utils.extract_node(""" def function_foo(xarg, yarg): '''function foo ... :param xarg: bla xarg :type xarg: int :param yarg: bla yarg :type yarg: float :return: sum :rtype: float ''' return xarg + yarg """) with self.assertNoMessages(): self.checker.visit_function(node) def test_wrong_name_of_func_params_in_docstring(self): """Example of functions with inconsistent parameter names in the signature and in the documentation """ node = test_utils.extract_node(""" def function_foo(xarg, yarg): '''function foo ... :param xarg1: bla xarg :type xarg: int :param yarg: bla yarg :type yarg1: float ''' return xarg + yarg """) with self.assertAddsMessages( Message( msg_id='W9003', node=node, args=('xarg, xarg1',)), Message( msg_id='W9004', node=node, args=('yarg, yarg1',))): self.checker.visit_function(node) node = test_utils.extract_node(""" def function_foo(xarg, yarg): '''function foo ... :param yarg1: bla yarg :type yarg1: float For the other parameters, see bla. ''' return xarg + yarg """) with self.assertAddsMessages( Message( msg_id='W9003', node=node, args=('yarg1',)), Message( msg_id='W9004', node=node, args=('yarg1',))): self.checker.visit_function(node) def test_see_sentence_for_func_params_in_docstring(self): """Example for the usage of "For the other parameters, see" to avoid too many repetitions, e.g. in functions or methods adhering to a given interface """ node = test_utils.extract_node(""" def function_foo(xarg, yarg): '''function foo ... :param yarg: bla yarg :type yarg: float For the other parameters, see :func:`bla` ''' return xarg + yarg """) with self.assertNoMessages(): self.checker.visit_function(node) def test_constr_params_in_class(self): """Example of a class with missing constructor parameter documentation Everything is completely analogous to functions. """ node = test_utils.extract_node(""" class ClassFoo(object): '''docstring foo missing constructor parameter documentation''' def __init__(self, x, y): pass """) with self.assertAddsMessages( Message( msg_id='W9003', node=node, args=('x, y',)), Message( msg_id='W9004', node=node, args=('x, y',))): self.checker.visit_class(node) if __name__ == '__main__': unittest.main() ----------------------------------------------------------------------------- Kind regards Bruno Daniel ---- Dr. Bruno Daniel Research and Development bruno.daniel at blue-yonder.com www.blue-yonder.com From dougal at dougalmatthews.com Thu Jul 24 15:15:46 2014 From: dougal at dougalmatthews.com (Dougal Matthews) Date: Thu, 24 Jul 2014 06:15:46 -0700 (PDT) Subject: [code-quality] Contribution: Checking function, method, and constructor parameter documentation In-Reply-To: <2AECE7393BD56548A551D05DC07650882C6BE501@london.phi-tps.local> References: <2AECE7393BD56548A551D05DC07650882C6BE501@london.phi-tps.local> Message-ID: <1406207744243.cb32239c@Nodemailer> This is great, and something I am also writing. Are you able to share the full code? It would be best to demonstrate it as an extension either way. On Thu, Jul 24, 2014 at 10:55 AM, Daniel, Bruno wrote: > Dear pylint developers, > We use pylint extensively in our company -- thanks this great tool! -- and > wrote some plugins ourselves to aid us in our daily work. One of these plugins > is a Sphinx parameter documentation checker that helps us to identify missing > parameter or parameter type documentation in functions, methods and class > constructors (__init__ methods). > The checker class also identifies naming inconsistencies between each function > or method signature and the corresponding docstring. > By convention, we use Sphinx syntax for the parameter documentation (see below > for examples) and we document class constructor parameters in the class > docstring. > We want to offer this code to you as a optional standard pylint checker. Would > such an addition to pylint be welcome? > To illustrate, here are our unit tests which include several examples: > -snip----- test_pylint_plugin.py ---------------------------------------------- > """Unittest for our pylint plugin.""" > from __future__ import division, print_function > import unittest > from astroid import test_utils > from pylint.testutils import CheckerTestCase, Message, set_config > from nbpy_devel.pylint_plugin import SphinxDocChecker, NbpyChecker > class SpinxDocCheckerTest(CheckerTestCase): > """Tests for pylint_plugin.SphinxDocChecker""" > CHECKER_CLASS = SphinxDocChecker > def test_missing_func_params_in_docstring(self): > """Example of a function with missing parameter documentation in the > docstring > """ > node = test_utils.extract_node(""" > def function_foo(x, y): > '''docstring ... > missing parameter documentation''' > pass > """) > with self.assertAddsMessages( > Message( > msg_id='W9003', > node=node, > args=('x, y',)), > Message( > msg_id='W9004', > node=node, > args=('x, y',))): > self.checker.visit_function(node) > def test_missing_method_params_in_docstring(self): > """Example of a class method with missing parameter documentation in the > docstring > """ > node = test_utils.extract_node(""" > class Foo(object): > def method_foo(self, x, y): > '''docstring ... > missing parameter documentation''' > pass > """) > method_node = node.body[0] > with self.assertAddsMessages( > Message( > msg_id='W9003', > node=method_node, > args=('x, y',)), > Message( > msg_id='W9004', > node=method_node, > args=('x, y',))): > self.checker.visit(node) > def test_existing_func_params_in_docstring(self): > """Example of a function with correctly documented parameters and return > values > """ > node = test_utils.extract_node(""" > def function_foo(xarg, yarg): > '''function foo ... > :param xarg: bla xarg > :type xarg: int > :param yarg: bla yarg > :type yarg: float > :return: sum > :rtype: float > ''' > return xarg + yarg > """) > with self.assertNoMessages(): > self.checker.visit_function(node) > def test_wrong_name_of_func_params_in_docstring(self): > """Example of functions with inconsistent parameter names in the > signature and in the documentation > """ > node = test_utils.extract_node(""" > def function_foo(xarg, yarg): > '''function foo ... > :param xarg1: bla xarg > :type xarg: int > :param yarg: bla yarg > :type yarg1: float > ''' > return xarg + yarg > """) > with self.assertAddsMessages( > Message( > msg_id='W9003', > node=node, > args=('xarg, xarg1',)), > Message( > msg_id='W9004', > node=node, > args=('yarg, yarg1',))): > self.checker.visit_function(node) > node = test_utils.extract_node(""" > def function_foo(xarg, yarg): > '''function foo ... > :param yarg1: bla yarg > :type yarg1: float > For the other parameters, see bla. > ''' > return xarg + yarg > """) > with self.assertAddsMessages( > Message( > msg_id='W9003', > node=node, > args=('yarg1',)), > Message( > msg_id='W9004', > node=node, > args=('yarg1',))): > self.checker.visit_function(node) > def test_see_sentence_for_func_params_in_docstring(self): > """Example for the usage of "For the other parameters, see" to avoid > too many repetitions, e.g. in functions or methods adhering to a given > interface > """ > node = test_utils.extract_node(""" > def function_foo(xarg, yarg): > '''function foo ... > :param yarg: bla yarg > :type yarg: float > For the other parameters, see :func:`bla` > ''' > return xarg + yarg > """) > with self.assertNoMessages(): > self.checker.visit_function(node) > def test_constr_params_in_class(self): > """Example of a class with missing constructor parameter documentation > Everything is completely analogous to functions. > """ > node = test_utils.extract_node(""" > class ClassFoo(object): > '''docstring foo > missing constructor parameter documentation''' > def __init__(self, x, y): > pass > """) > with self.assertAddsMessages( > Message( > msg_id='W9003', > node=node, > args=('x, y',)), > Message( > msg_id='W9004', > node=node, > args=('x, y',))): > self.checker.visit_class(node) > if __name__ == '__main__': > unittest.main() > ----------------------------------------------------------------------------- > Kind regards > Bruno Daniel > ---- > Dr. Bruno Daniel > Research and Development > bruno.daniel at blue-yonder.com > www.blue-yonder.com > _______________________________________________ > code-quality mailing list > code-quality at python.org > https://mail.python.org/mailman/listinfo/code-quality -------------- next part -------------- An HTML attachment was scrubbed... URL: From Bruno.Daniel at blue-yonder.com Thu Jul 24 16:42:26 2014 From: Bruno.Daniel at blue-yonder.com (Daniel, Bruno) Date: Thu, 24 Jul 2014 14:42:26 +0000 Subject: [code-quality] Contribution: Checking function, method, and constructor parameter documentation In-Reply-To: <1406207744243.cb32239c@Nodemailer> References: <2AECE7393BD56548A551D05DC07650882C6BE501@london.phi-tps.local>, <1406207744243.cb32239c@Nodemailer> Message-ID: <2AECE7393BD56548A551D05DC07650882C6BEA15@london.phi-tps.local> Dear Dougal Matthews, > Are you able to share the full code? It would be best to demonstrate it as an extension either way. Of course, here it is, but I can also make a kind of pull request if this is more convenient for you. Viele Gr??e Bruno Daniel Dr. Bruno Daniel Research and Development Blue Yonder GmbH Ohiostra?e 8 D-76149 Karlsruhe Tel +49 (0)721 383 117 80 Fax +49 (0)721 383 117 69 bruno.daniel at blue-yonder.com www.blue-yonder.com Registergericht Mannheim, HRA 701753 USt-IdNr. DE 259 967 448 Gesch?ftsf?hrer: Jochen Bossert, Uwe Weiss (CEO) ________________________________ From: Dougal Matthews [dougal at dougalmatthews.com] Sent: Thursday, July 24, 2014 3:15 PM To: Daniel, Bruno Cc: code-quality at python.org Subject: Re: [code-quality] Contribution: Checking function, method, and constructor parameter documentation This is great, and something I am also writing. Are you able to share the full code? It would be best to demonstrate it as an extension either way. On Thu, Jul 24, 2014 at 10:55 AM, Daniel, Bruno > wrote: Dear pylint developers, We use pylint extensively in our company -- thanks this great tool! -- and wrote some plugins ourselves to aid us in our daily work. One of these plugins is a Sphinx parameter documentation checker that helps us to identify missing parameter or parameter type documentation in functions, methods and class constructors (__init__ methods). The checker class also identifies naming inconsistencies between each function or method signature and the corresponding docstring. By convention, we use Sphinx syntax for the parameter documentation (see below for examples) and we document class constructor parameters in the class docstring. We want to offer this code to you as a optional standard pylint checker. Would such an addition to pylint be welcome? To illustrate, here are our unit tests which include several examples: -snip----- test_pylint_plugin.py ---------------------------------------------- """Unittest for our pylint plugin.""" from __future__ import division, print_function import unittest from astroid import test_utils from pylint.testutils import CheckerTestCase, Message, set_config from nbpy_devel.pylint_plugin import SphinxDocChecker, NbpyChecker class SpinxDocCheckerTest(CheckerTestCase): """Tests for pylint_plugin.SphinxDocChecker""" CHECKER_CLASS = SphinxDocChecker def test_missing_func_params_in_docstring(self): """Example of a function with missing parameter documentation in the docstring """ node = test_utils.extract_node(""" def function_foo(x, y): '''docstring ... missing parameter documentation''' pass """) with self.assertAddsMessages( Message( msg_id='W9003', node=node, args=('x, y',)), Message( msg_id='W9004', node=node, args=('x, y',))): self.checker.visit_function(node) def test_missing_method_params_in_docstring(self): """Example of a class method with missing parameter documentation in the docstring """ node = test_utils.extract_node(""" class Foo(object): def method_foo(self, x, y): '''docstring ... missing parameter documentation''' pass """) method_node = node.body[0] with self.assertAddsMessages( Message( msg_id='W9003', node=method_node, args=('x, y',)), Message( msg_id='W9004', node=method_node, args=('x, y',))): self.checker.visit(node) def test_existing_func_params_in_docstring(self): """Example of a function with correctly documented parameters and return values """ node = test_utils.extract_node(""" def function_foo(xarg, yarg): '''function foo ... :param xarg: bla xarg :type xarg: int :param yarg: bla yarg :type yarg: float :return: sum :rtype: float ''' return xarg + yarg """) with self.assertNoMessages(): self.checker.visit_function(node) def test_wrong_name_of_func_params_in_docstring(self): """Example of functions with inconsistent parameter names in the signature and in the documentation """ node = test_utils.extract_node(""" def function_foo(xarg, yarg): '''function foo ... :param xarg1: bla xarg :type xarg: int :param yarg: bla yarg :type yarg1: float ''' return xarg + yarg """) with self.assertAddsMessages( Message( msg_id='W9003', node=node, args=('xarg, xarg1',)), Message( msg_id='W9004', node=node, args=('yarg, yarg1',))): self.checker.visit_function(node) node = test_utils.extract_node(""" def function_foo(xarg, yarg): '''function foo ... :param yarg1: bla yarg :type yarg1: float For the other parameters, see bla. ''' return xarg + yarg """) with self.assertAddsMessages( Message( msg_id='W9003', node=node, args=('yarg1',)), Message( msg_id='W9004', node=node, args=('yarg1',))): self.checker.visit_function(node) def test_see_sentence_for_func_params_in_docstring(self): """Example for the usage of "For the other parameters, see" to avoid too many repetitions, e.g. in functions or methods adhering to a given interface """ node = test_utils.extract_node(""" def function_foo(xarg, yarg): '''function foo ... :param yarg: bla yarg :type yarg: float For the other parameters, see :func:`bla` ''' return xarg + yarg """) with self.assertNoMessages(): self.checker.visit_function(node) def test_constr_params_in_class(self): """Example of a class with missing constructor parameter documentation Everything is completely analogous to functions. """ node = test_utils.extract_node(""" class ClassFoo(object): '''docstring foo missing constructor parameter documentation''' def __init__(self, x, y): pass """) with self.assertAddsMessages( Message( msg_id='W9003', node=node, args=('x, y',)), Message( msg_id='W9004', node=node, args=('x, y',))): self.checker.visit_class(node) if __name__ == '__main__': unittest.main() ----------------------------------------------------------------------------- Kind regards Bruno Daniel ---- Dr. Bruno Daniel Research and Development bruno.daniel at blue-yonder.com www.blue-yonder.com _______________________________________________ code-quality mailing list code-quality at python.org https://mail.python.org/mailman/listinfo/code-quality -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test_pylint_plugin.py Type: text/x-python Size: 5372 bytes Desc: test_pylint_plugin.py URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pylint_plugin.py Type: text/x-python Size: 6883 bytes Desc: pylint_plugin.py URL: From shlomme at gmail.com Thu Jul 24 17:05:44 2014 From: shlomme at gmail.com (Torsten Marek) Date: Thu, 24 Jul 2014 17:05:44 +0200 Subject: [code-quality] Static Analysis Dinner on Friday @ EuroPython Message-ID: Hi all, we thought it'd be nice to go and have a dinner together with people interested in static analysis. My suggestion is to go to Pri Maria ( http://www.primaria.de/). Let's meet tomorrow at 6:30pm, at the bcc entrance. Getting to the restaurant will take about 30min. If you want to come, please drop me a line until tomorrow about noon so that I can reserve a table. Cheers, // Torsten -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvain.thenault at logilab.fr Fri Jul 25 09:13:32 2014 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Fri, 25 Jul 2014 09:13:32 +0200 Subject: [code-quality] Contribution: Checking function, method, and constructor parameter documentation In-Reply-To: <2AECE7393BD56548A551D05DC07650882C6BEA15@london.phi-tps.local> References: <2AECE7393BD56548A551D05DC07650882C6BE501@london.phi-tps.local> <1406207744243.cb32239c@Nodemailer> <2AECE7393BD56548A551D05DC07650882C6BEA15@london.phi-tps.local> Message-ID: <20140725071332.GA2977@logilab.fr> Hello guys, this sounds like a very nice and useful checker indeed. I know there are some others like this one around (eg django dedicated checker, i18n/gettext checker, probably more). Rather to include them all in the pylint source distribution, I think what's missing is some official page listing such plugins. Or we could indeed also ship pylint with an "extensions" directory containing such additional checkers. What would be your preferred way ? -- 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 From bcannon at gmail.com Fri Jul 25 20:35:59 2014 From: bcannon at gmail.com (Brett Cannon) Date: Fri, 25 Jul 2014 18:35:59 +0000 Subject: [code-quality] Custom pylint checkers for Python 2/3 compatibility Message-ID: The Python 2/3 checkers I emailed this list about back in June I think are now at a beta stage and can be viewed at https://github.com/brettcannon/caniusepython3/blob/pylint/caniusepython3/pylint_checker.py along with tests at https://github.com/brettcannon/caniusepython3/blob/pylint/caniusepython3/test/test_pylint_checker.py and a demo "bad" file and pylintrc file at https://github.com/brettcannon/caniusepython3/blob/pylint/bad.py and https://github.com/brettcannon/caniusepython3/blob/pylint/pylintrc, respectively. If anyone has any feedback on the way I implemented the checkers I would appreciate it since the public documentation on writing your own checkers is a bit thin to say the least =) . -------------- next part -------------- An HTML attachment was scrubbed... URL: From pcmanticore at gmail.com Sat Jul 26 00:14:21 2014 From: pcmanticore at gmail.com (Claudiu Popa) Date: Sat, 26 Jul 2014 00:14:21 +0200 Subject: [code-quality] Custom pylint checkers for Python 2/3 compatibility Message-ID: Hello Brett. At a quick glance, the patch looks really good, even with the scarce documentation that we have. :-) Maybe you can turn this into a pull request for Pylint, so that we may have in the near future a mode that only checks Python 2/3 compatibility? That way would be easier for review, too. Thank you. From bcannon at gmail.com Sat Jul 26 16:58:55 2014 From: bcannon at gmail.com (Brett Cannon) Date: Sat, 26 Jul 2014 14:58:55 +0000 Subject: [code-quality] Custom pylint checkers for Python 2/3 compatibility References: Message-ID: Sure. I will try to make time next week to make a pull request against Pylint with a checkers/python3.py or something. On Fri Jul 25 2014 at 6:14:21 PM Claudiu Popa wrote: > Hello Brett. > > At a quick glance, the patch looks really good, even with the scarce > documentation that we have. :-) > Maybe you can turn this into a pull request for Pylint, so that we may > have in the near future a mode that only checks Python 2/3 > compatibility? That way would be easier for review, too. > > Thank you. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pcmanticore at gmail.com Mon Jul 28 23:29:08 2014 From: pcmanticore at gmail.com (Claudiu Popa) Date: Tue, 29 Jul 2014 00:29:08 +0300 Subject: [code-quality] [ANN] Pylint 1.3 / Astroid 1.2 released. Message-ID: Hello! I'm happy to announce that Pylint 1.3 and Astroid 1.2 were released at the end of the last week. There has been a lot of enhancements and bug fixes since the latest release, so you're strongly encouraged to upgrade. More information about the changes in this release can be found here: http://www.logilab.org/blogentry/259107. Enjoy! From Bruno.Daniel at blue-yonder.com Wed Jul 30 19:03:52 2014 From: Bruno.Daniel at blue-yonder.com (Daniel, Bruno) Date: Wed, 30 Jul 2014 17:03:52 +0000 Subject: [code-quality] Contribution: Checking function, method, and constructor parameter documentation In-Reply-To: <20140725071332.GA2977@logilab.fr> References: <2AECE7393BD56548A551D05DC07650882C6BE501@london.phi-tps.local> <1406207744243.cb32239c@Nodemailer> <2AECE7393BD56548A551D05DC07650882C6BEA15@london.phi-tps.local>, <20140725071332.GA2977@logilab.fr> Message-ID: <2AECE7393BD56548A551D05DC07650882C6D35F3@london.phi-tps.local> Dear Sylvain Th?nault and Dougal Matthews, I just added a pull request for the discussed checker: https://bitbucket.org/logilab/pylint/pull-request/143/new-extensions-directory-new-optional/diff As you suggested, I created a new module for such optional checkers: pylint/extensions containing the following files (so far): __init__.py check_docs.py I put the test file for the new checker into the normal test directory: pylint/test/test_check_docs.py People can activate this new checker by adding the line load-plugins=pylint.extensions.check_docs to the MASTER section of their .pylintrc . I added more documentation (including this usage description) to the class docstring of the checker. Kind regards Bruno Daniel Dr. Bruno Daniel Research and Development Blue Yonder GmbH Ohiostra?e 8 D-76149 Karlsruhe Tel +49 (0)721 383 117 80 Fax +49 (0)721 383 117 69 bruno.daniel at blue-yonder.com www.blue-yonder.com Registergericht Mannheim, HRA 701753 USt-IdNr. DE 259 967 448 Gesch?ftsf?hrer: Jochen Bossert, Uwe Weiss (CEO) ________________________________________ From: sylvain.thenault at logilab.fr [sylvain.thenault at logilab.fr] Sent: Friday, July 25, 2014 9:13 AM To: Daniel, Bruno Cc: Dougal Matthews; code-quality at python.org Subject: Re: [code-quality] Contribution: Checking function, method, and constructor parameter documentation Hello guys, this sounds like a very nice and useful checker indeed. I know there are some others like this one around (eg django dedicated checker, i18n/gettext checker, probably more). Rather to include them all in the pylint source distribution, I think what's missing is some official page listing such plugins. Or we could indeed also ship pylint with an "extensions" directory containing such additional checkers. What would be your preferred way ? -- 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 From sylvain.thenault at logilab.fr Thu Jul 31 08:10:58 2014 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Thu, 31 Jul 2014 08:10:58 +0200 Subject: [code-quality] Contribution: Checking function, method, and constructor parameter documentation In-Reply-To: <2AECE7393BD56548A551D05DC07650882C6D35F3@london.phi-tps.local> References: <2AECE7393BD56548A551D05DC07650882C6BE501@london.phi-tps.local> <1406207744243.cb32239c@Nodemailer> <2AECE7393BD56548A551D05DC07650882C6BEA15@london.phi-tps.local> <20140725071332.GA2977@logilab.fr> <2AECE7393BD56548A551D05DC07650882C6D35F3@london.phi-tps.local> Message-ID: <20140731061058.GB2881@logilab.fr> Hello Daniel, On 30 juillet 17:03, Daniel, Bruno wrote: > Dear Sylvain Th?nault and Dougal Matthews, > > I just added a pull request for the discussed checker: > > https://bitbucket.org/logilab/pylint/pull-request/143/new-extensions-directory-new-optional/diff > > As you suggested, I created a new module for such optional checkers: > > pylint/extensions > > containing the following files (so far): > > __init__.py > check_docs.py > > I put the test file for the new checker into the normal test directory: > > pylint/test/test_check_docs.py > > People can activate this new checker by adding the line > > load-plugins=pylint.extensions.check_docs > > to the MASTER section of their .pylintrc . > > I added more documentation (including this usage description) to the class docstring > of the checker. great! One last thing: by adding your checker to pylint itself, we still hope that you'll maintain it :) That mainly means answering to issues regarding your checker that will ends up in pylint's tracker. You may still use pull requests for fixes/enhancements, and if at some point you feel like having write access to the repo would ease the job, ask us. -- 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 From Bruno.Daniel at blue-yonder.com Thu Jul 31 14:07:43 2014 From: Bruno.Daniel at blue-yonder.com (Daniel, Bruno) Date: Thu, 31 Jul 2014 12:07:43 +0000 Subject: [code-quality] Contribution: Checking function, method, and constructor parameter documentation In-Reply-To: <20140731061058.GB2881@logilab.fr> References: <2AECE7393BD56548A551D05DC07650882C6BE501@london.phi-tps.local> <1406207744243.cb32239c@Nodemailer> <2AECE7393BD56548A551D05DC07650882C6BEA15@london.phi-tps.local> <20140725071332.GA2977@logilab.fr> <2AECE7393BD56548A551D05DC07650882C6D35F3@london.phi-tps.local>, <20140731061058.GB2881@logilab.fr> Message-ID: <2AECE7393BD56548A551D05DC07650882C6F6459@london.phi-tps.local> Hello Sylvain, > great! One last thing: by adding your checker to pylint itself, we still hope > that you'll maintain it :) Thanks, I'd love to! I'm also going to fix all the issues mentioned by the reviewers of the pull request soon. Another question: We also use Cython code in our projects. It would be great to be able to check .pyx and .pxd files using pylint as well and maybe I could work on that. Has anyone else started working on this yet? Thanks again to be able to contribute! Kind regards Bruno Daniel Dr. Bruno Daniel Research and Development Blue Yonder GmbH Ohiostra?e 8 D-76149 Karlsruhe Tel +49 (0)721 383 117 80 Fax +49 (0)721 383 117 69 bruno.daniel at blue-yonder.com www.blue-yonder.com Registergericht Mannheim, HRA 701753 USt-IdNr. DE 259 967 448 Gesch?ftsf?hrer: Jochen Bossert, Uwe Weiss (CEO) ________________________________________ From: sylvain.thenault at logilab.fr [sylvain.thenault at logilab.fr] Sent: Thursday, July 31, 2014 8:10 AM To: Daniel, Bruno Cc: Dougal Matthews; code-quality at python.org Subject: Re: [code-quality] Contribution: Checking function, method, and constructor parameter documentation Hello Daniel, On 30 juillet 17:03, Daniel, Bruno wrote: > Dear Sylvain Th?nault and Dougal Matthews, > > I just added a pull request for the discussed checker: > > https://bitbucket.org/logilab/pylint/pull-request/143/new-extensions-directory-new-optional/diff > > As you suggested, I created a new module for such optional checkers: > > pylint/extensions > > containing the following files (so far): > > __init__.py > check_docs.py > > I put the test file for the new checker into the normal test directory: > > pylint/test/test_check_docs.py > > People can activate this new checker by adding the line > > load-plugins=pylint.extensions.check_docs > > to the MASTER section of their .pylintrc . > > I added more documentation (including this usage description) to the class docstring > of the checker. great! One last thing: by adding your checker to pylint itself, we still hope that you'll maintain it :) That mainly means answering to issues regarding your checker that will ends up in pylint's tracker. You may still use pull requests for fixes/enhancements, and if at some point you feel like having write access to the repo would ease the job, ask us. -- 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