From sylvain.thenault at logilab.fr Fri Aug 2 15:12:23 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Fri, 2 Aug 2013 15:12:23 +0200 Subject: [code-quality] Astroid 1.0 released Message-ID: <20130802131223.GB2580@logilab.fr> Hi there, waiting for to-be-released soon Pylint 1.0, I think it's worth mentionning here the release of the underlying astroid library: more info on http://www.logilab.org/blogentry/158911 I hope it may be of interest for people developping python code checkers than Pylint. I'll be there to discuss about that when I'll be back from vacation in a few weeks. ++ -- 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 noisecapella at gmail.com Sat Aug 3 17:45:31 2013 From: noisecapella at gmail.com (George Schneeloch) Date: Sat, 3 Aug 2013 11:45:31 -0400 Subject: [code-quality] Type hinting parameters of standard library functions Message-ID: I was thinking of working on a tool which interacts with Astroid's type inference capabilities. It would either get the type hints of parameters through function annotations or from @param tags in docstrings. This would help create warnings where the parameter or something which uses it is being used in an unexpected way, inconsistent with documentation. I was wondering if there is any machine-readable information about what types functions in the standard library expect? For example, PyCharm seems to know that os.path.split cannot return a tuple of three values, so x, y, z = os.path.split("a/path/here") causes the IDE warning "needs more values to unpack". When I jump to the documentation it's described like this: def split(p) Inferred type: (p: one of (str, unicode)) -> (one of (str, unicode, unknown),one of (str, unicode, unknown)) Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty. Did JetBrains (who make PyCharm) gather this information themselves, or is this kind of thing publicly available somewhere? Thanks for your help, -George -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrey.vlasovskikh at gmail.com Sat Aug 3 18:12:39 2013 From: andrey.vlasovskikh at gmail.com (Andrey Vlasovskikh) Date: Sat, 3 Aug 2013 20:12:39 +0400 Subject: [code-quality] Type hinting parameters of standard library functions In-Reply-To: References: Message-ID: Hi George, > def split(p) Inferred type: (p: one of (str, unicode)) -> (one of (str, unicode, unknown),one of (str, unicode, unknown)) > Split a pathname. Returns tuple "(head, tail)" where "tail" is > everything after the final slash. Either part may be empty. > > Did JetBrains (who make PyCharm) gather this information themselves, or is this kind of thing publicly available somewhere? I'm a developer of PyCharm. We've created a type database for some parts of the standard library manually based on the docs. As for now, its format is an implementation detail of PyCharm, but we have some plans making it available and extendable for other people and tools. We also interested in efforts regarding the standardization of type annotations. We'll announce our plans later on, stay tuned. -- Andrey Vlasovskikh Senior Software Developer JetBrains, Inc. http://www.jetbrains.com/ "Develop with pleasure!" From sylvain.thenault at logilab.fr Tue Aug 6 16:17:04 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 6 Aug 2013 16:17:04 +0200 Subject: [code-quality] Type hinting parameters of standard library functions In-Reply-To: References: Message-ID: <20130806141704.GF5676@logilab.fr> On 03 ao?t 20:12, Andrey Vlasovskikh wrote: > Hi George, > > > def split(p) Inferred type: (p: one of (str, unicode)) -> (one of (str, unicode, unknown),one of (str, unicode, unknown)) > > Split a pathname. Returns tuple "(head, tail)" where "tail" is > > everything after the final slash. Either part may be empty. > > > > Did JetBrains (who make PyCharm) gather this information themselves, or is this kind of thing publicly available somewhere? > > I'm a developer of PyCharm. We've created a type database for some parts of the standard library manually based on the docs. As for now, its format is an implementation detail of PyCharm, but we have some plans making it available and extendable for other people and tools. We also interested in efforts regarding the standardization of type annotations. We'll announce our plans later on, stay tuned. Sounds like such a library, as we're targeting with astroid, would be of interest for a lot of people and would allow great gain to python code-quality tool. Would you be interested in attempting to share efforts? Anyway I can't wait to read more on this. -- 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 Tue Aug 6 16:11:21 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 6 Aug 2013 16:11:21 +0200 Subject: [code-quality] Pylint 1.0 released Message-ID: <20130806141121.GA5676@logilab.fr> Hi there, at last, Pylint 1.0 is out! See http://www.logilab.org/blogentry/163292 for (much) more info and enjoy! And many thanks to every one who contributed to this release... -- 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 skip at pobox.com Tue Aug 6 16:59:37 2013 From: skip at pobox.com (Skip Montanaro) Date: Tue, 6 Aug 2013 09:59:37 -0500 Subject: [code-quality] Problems installing pylint 1.0 Message-ID: I'm trying to package up pylint 1.0 for our local installation. For the most part, the simple tar archive seems ideal, however the path components in the generated tar file have an unwanted prefix. Our Python installation is in /opt/TWWfsw/python27, so ./opt/TWWfsw/python27 appears as a prefix to all components of the tar file: % tar tfz dist/pylint-1.0.0.share.tar.gz | head ./ ./opt/ ./opt/TWWfsw/ ./opt/TWWfsw/python27/ ./opt/TWWfsw/python27/lib/ ./opt/TWWfsw/python27/lib/python2.7/ ./opt/TWWfsw/python27/lib/python2.7/site-packages/ ./opt/TWWfsw/python27/lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/ ./opt/TWWfsw/python27/lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/dependency_links.txt ./opt/TWWfsw/python27/lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/top_level.txt I would like that to be: % tar tfz dist/pylint-1.0.0.share.tar.gz | head ./ ./lib/ ./lib/python2.7/ ./lib/python2.7/site-packages/ ./lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/ ./lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/dependency_links.txt ./lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/top_level.txt How do I manage that? The bdist command doesn't accept a --prefix arg. Alternatively, I'd like the install command to work properly. It does the right thing path-wise, but only installs lib, not bin: % ls -l /var/tmp/pylint-1.0/ total 4 drwxrwxr-x 3 skipm snake 4096 Aug 6 09:44 lib Thx, Skip From skip at pobox.com Tue Aug 6 17:56:52 2013 From: skip at pobox.com (Skip Montanaro) Date: Tue, 6 Aug 2013 10:56:52 -0500 Subject: [code-quality] logilab-common 0.60 Message-ID: I figured out my pylint install woes (I really dislike distutils). Then I needed a newer version of astroid. Picked up the latest, which was also 1.0.0. That, alas, requires logilab-common >= 0.60.0, which has yet to be released. Even the latest mercurial stuff only provides 0.58.x. Where have I gone wrong? Thx, Skip From jim at zope.com Tue Aug 6 18:01:59 2013 From: jim at zope.com (Jim Fulton) Date: Tue, 6 Aug 2013 12:01:59 -0400 Subject: [code-quality] logilab-common 0.60 In-Reply-To: References: Message-ID: On Tue, Aug 6, 2013 at 11:56 AM, Skip Montanaro wrote: > I figured out my pylint install woes (I really dislike distutils). > Then I needed a newer version of astroid. Picked up the latest, which > was also 1.0.0. That, alas, requires logilab-common >= 0.60.0, which > has yet to be released. Even the latest mercurial stuff only provides > 0.58.x. Where have I gone wrong? FTR, this wasn't setuptools (distutils doesn't do requirements) fault. The astroid 1.0.0 release is apparently broken. You shouldn't use software with bugs. ;) Jim -- Jim Fulton http://www.linkedin.com/in/jimfulton From skip at pobox.com Tue Aug 6 18:17:51 2013 From: skip at pobox.com (Skip Montanaro) Date: Tue, 6 Aug 2013 11:17:51 -0500 Subject: [code-quality] logilab-common 0.60 In-Reply-To: References: Message-ID: > FTR, this wasn't setuptools (distutils doesn't do requirements) fault. > The astroid 1.0.0 release is apparently broken. You shouldn't use software > with bugs. ;) Thanks for the advice. :-) My original pylint install problems were due to hurdles placed there by distutils. Once I worked around them (with extraordinarily long command lines I can never remember and have to record in our local wiki for the next time I need them), that went fine. Unfortunately, astroid 1.0.0, as you indicated, has at least this dependency problem. S From andrey.vlasovskikh at gmail.com Fri Aug 9 11:24:37 2013 From: andrey.vlasovskikh at gmail.com (Andrey Vlasovskikh) Date: Fri, 9 Aug 2013 13:24:37 +0400 Subject: [code-quality] Type hinting parameters of standard library functions In-Reply-To: <20130806141704.GF5676@logilab.fr> References: <20130806141704.GF5676@logilab.fr> Message-ID: <74345D1D-F68A-49F9-805A-32CAE624C328@gmail.com> Sylvain, >> I'm a developer of PyCharm. We've created a type database for some parts of the standard library manually based on the docs. As for now, its format is an implementation detail of PyCharm, but we have some plans making it available and extendable for other people and tools. We also interested in efforts regarding the standardization of type annotations. We'll announce our plans later on, stay tuned. > > Sounds like such a library, as we're targeting with astroid, would be of > interest for a lot of people and would allow great gain to python code-quality > tool. Would you be interested in attempting to share efforts? Anyway I can't > wait to read more on this. I've seen your pylint-brain repo, where you use an imperative approach for creating static equivalents of dynamic objects. In PyCharm we also use a similar approach, but we are interested in a more declarative database of static skeletons of dynamic objects (Python code + type annotations) that could be useful for various tools. As I've mentioned above, we will publish more info and our ideas regarding possible collaboration on this subject later on. -- Andrey Vlasovskikh Senior Software Developer JetBrains, Inc. http://www.jetbrains.com/ "Develop with pleasure!" From 745189913 at qq.com Fri Aug 9 14:03:45 2013 From: 745189913 at qq.com (=?gb18030?B?uu7szMP3?=) Date: Fri, 9 Aug 2013 20:03:45 +0800 Subject: [code-quality] Something about Pylint Message-ID: Hello, I am a beginner to Pylint, My name is Hou Zhuoming. When I install the pylint 1.0.0 in python 3.3(OS:Windows7), there is a error happened. And then I read the source code of pylint 1.0.0. I found something is wrong in setup.py model. Line 138: call(['2to3','-wn',dest]): I think the problem is the system cannot find 2to3. But I can find a script named '2to3.py' in my python 3.3. So I change Line 138 to: call(['C:\\Python33\\Tools\\Scripts\\2to3.py', '-wn', dest], shell=sys.platform=='win32'). It works! I can install pylint 1.0.0 successfully after the change. My setup.py in pylint 1.0.0: I found the same problem in astroid-1.0.0 and logilab-common-0.60.0 too. I also can install these two packages with the same change. I am not sure it is a bug. Maybe, something is wrong when I am installing the pylint 1.0.0. (No problem in Linux) Another problem: when I successfully installed pylint 1.0.0, I want to run the pylint-gui.exe. I can see the GUI successfully. But when I want to test some python scripts, it works wrong.(The pylint.exe works normally) All these problems happen in python 3.3(Operating system is Windows 7). I need your help. Thank you. ------------------ School of Software,Sun Yat-sen University Zhuoming Hou(???) Email:745189913 at qq.com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 5514AF51 at 9D57B56D.A1DA0452.png Type: application/octet-stream Size: 71075 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 5507C272 at 9D57B56D.A1DA0452.png Type: application/octet-stream Size: 59598 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 580E6C53 at 9D57B56D.A1DA0452.png Type: application/octet-stream Size: 14152 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 7A4D6989 at 9D57B56D.A1DA0452.png Type: application/octet-stream Size: 11549 bytes Desc: not available URL: From graffatcolmingov at gmail.com Fri Aug 9 15:30:04 2013 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Fri, 9 Aug 2013 08:30:04 -0500 Subject: [code-quality] Something about Pylint In-Reply-To: References: Message-ID: This strongly seems like an issue where the authors of pylint/astroid did not explore installation on a non-*nix machine. It is tough to do so (speaking from experience) so I don't fault them, but the real solution is not just to use '2to3.py' because on *nix machines, that does not exist. On *nix machines it is installed as what is used in the script above. That said, the best solution seems to be a sort of "compatibility" layer upon installation where it looks to determine if it is on Windows and in that case uses '2to3.py' and otherwise uses '2to3'. If you submit a pull request to their repositories on BitBucket, I'm sure they would greatly appreciate it. On Fri, Aug 9, 2013 at 7:03 AM, ??? <745189913 at qq.com> wrote: > Hello, > I am a beginner to Pylint, My name is Hou Zhuoming. When I install the > pylint 1.0.0 in python 3.3(OS:Windows7), there is a error happened. > > > And then I read the source code of pylint 1.0.0. I found something is > wrong in setup.py model. > > > Line 138: call(['2to3','-wn',dest]): I think the problem is the system > cannot find 2to3. > But I can find a script named '2to3.py' in my python 3.3. So I change Line > 138 to: > call(['C:\\Python33\\Tools\\Scripts\\2to3.py', '-wn', dest], > shell=sys.platform=='win32'). > It works! I can install pylint 1.0.0 successfully after the change. > My setup.py in pylint 1.0.0: > > > I found the same problem in astroid-1.0.0 and logilab-common-0.60.0 too. I > also can install these two packages with the same change. > I am not sure it is a bug. Maybe, something is wrong when I am installing > the pylint 1.0.0. (No problem in Linux) > Another problem: when I successfully installed pylint 1.0.0, I want to run > the pylint-gui.exe. I can see the GUI successfully. But when I want to test > some python scripts, it works wrong.(The pylint.exe works normally) > > > All these problems happen in python 3.3(Operating system is Windows 7). > I need your help. > Thank you. > ------------------ > School of Software,Sun Yat-sen University > Zhuoming Hou(???) > Email:745189913 at qq.com > > > _______________________________________________ > code-quality mailing list > code-quality at python.org > http://mail.python.org/mailman/listinfo/code-quality > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 7A4D6989 at 9D57B56D.A1DA0452.png Type: application/octet-stream Size: 11549 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 5507C272 at 9D57B56D.A1DA0452.png Type: application/octet-stream Size: 59598 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 580E6C53 at 9D57B56D.A1DA0452.png Type: application/octet-stream Size: 14152 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 5514AF51 at 9D57B56D.A1DA0452.png Type: application/octet-stream Size: 71075 bytes Desc: not available URL: From skip at pobox.com Tue Aug 13 17:26:19 2013 From: skip at pobox.com (Skip Montanaro) Date: Tue, 13 Aug 2013 10:26:19 -0500 Subject: [code-quality] astroid and logilab-common still disagree about versions Message-ID: I reported a couple weeks ago about astroid demanding logilab-common >= 0.60, while the latest stable branch of logilab-common insists that the latest version is just 0.58.2. I trying "hg pull ; hg update" on both repos just now and find the situation hasn't changed. I am updated to the stable branch of logilab-common and the default branch of astroid. Am I supposed to be on the stable branch of astroid? That doesn't seem right, as its __pkginfo__ module says it's only version 0.24.3 So, I'm kind of stuck, looking for a "correct" solution here. I could, in theory, mangle my __pkginfo__ modules, but that just introduces a bad hack I have to remember later. Thx, Skip From skip at pobox.com Wed Aug 21 20:43:11 2013 From: skip at pobox.com (Skip Montanaro) Date: Wed, 21 Aug 2013 13:43:11 -0500 Subject: [code-quality] astroid and logilab-common still disagree about versions In-Reply-To: References: Message-ID: > I reported a couple weeks ago about astroid demanding logilab-common > >= 0.60, while the latest stable branch of logilab-common insists that > the latest version is just 0.58.2..... > > So, I'm kind of stuck, looking for a "correct" solution here. I finally just punted, and replaced (0, 58, 2) with (0, 60, 0) in __pkginfo__.py. This at least allows me to run pylint. Perhaps something subtle will break later on. Skip From julien.cristau at logilab.fr Thu Aug 22 09:21:01 2013 From: julien.cristau at logilab.fr (Julien Cristau) Date: Thu, 22 Aug 2013 09:21:01 +0200 Subject: [code-quality] astroid and logilab-common still disagree about versions In-Reply-To: References: Message-ID: <20130822072101.GA13384@crater1.logilab.fr> Hi Skip, On Tue, Aug 13, 2013 at 10:26:19 -0500, Skip Montanaro wrote: > I reported a couple weeks ago about astroid demanding logilab-common > >= 0.60, while the latest stable branch of logilab-common insists that > the latest version is just 0.58.2. I trying "hg pull ; hg update" on > both repos just now and find the situation hasn't changed. I am > updated to the stable branch of logilab-common and the default branch > of astroid. Am I supposed to be on the stable branch of astroid? > That doesn't seem right, as its __pkginfo__ module says it's only > version 0.24.3 > logilab-common 0.60 is on the 'default' branch in the hg repo. Cheers, Julien -- Julien Cristau Logilab http://www.logilab.fr/ Informatique scientifique & gestion de connaissances From tarek at ziade.org Sun Aug 25 09:43:20 2013 From: tarek at ziade.org (=?UTF-8?B?VGFyZWsgWmlhZMOp?=) Date: Sun, 25 Aug 2013 09:43:20 +0200 Subject: [code-quality] Flake8 News In-Reply-To: <5219B3FD.7050305@free.fr> References: <20130709063635.GA2420@logilab.fr> <51DD4499.3000208@free.fr> <1374056686.24279.140661256651193.2CB0AA0E@webmail.messagingengine.com> <5219B3FD.7050305@free.fr> Message-ID: <5219B598.4050307@ziade.org> Le 8/25/13 9:36 AM, afayolle a ?crit : > On mer. 17 juil. 2013 12:24:46 CEST, Tarek Ziad? wrote: >> Yeah that's an issue indeed. I would like to stick with a BSD-like licence > Well, changing the license of a piece of code such as Pylint may not be > that easy... There are several different contributors involved, and I'm > not certain where main contributors (Logilab / Sylvain) stand on this. > > -- > Alexandre > > maybe we could bind it through the command line to avoid the licence conflict ? From afayolle.ml at free.fr Sun Aug 25 09:36:29 2013 From: afayolle.ml at free.fr (afayolle) Date: Sun, 25 Aug 2013 09:36:29 +0200 Subject: [code-quality] Flake8 News In-Reply-To: <1374056686.24279.140661256651193.2CB0AA0E@webmail.messagingengine.com> References: <20130709063635.GA2420@logilab.fr> <51DD4499.3000208@free.fr> <1374056686.24279.140661256651193.2CB0AA0E@webmail.messagingengine.com> Message-ID: <5219B3FD.7050305@free.fr> On mer. 17 juil. 2013 12:24:46 CEST, Tarek Ziad? wrote: >Yeah that's an issue indeed. I would like to stick with a BSD-like licence Well, changing the license of a piece of code such as Pylint may not be that easy... There are several different contributors involved, and I'm not certain where main contributors (Logilab / Sylvain) stand on this. -- Alexandre From graffatcolmingov at gmail.com Sun Aug 25 16:32:17 2013 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Sun, 25 Aug 2013 09:32:17 -0500 Subject: [code-quality] Fwd: Flake8 News In-Reply-To: <51E3B1AF.6030906@free.fr> References: <20130709063635.GA2420@logilab.fr> <51DD4499.3000208@free.fr> <51E3B1AF.6030906@free.fr> Message-ID: Alexandre and I accidentally had this discussion off list. ---------- Forwarded message ---------- From: afayolle Date: Mon, Jul 15, 2013 at 3:24 AM Subject: Re: [code-quality] Flake8 News To: Ian Cordasco On mer. 10 juil. 2013 13:50:22 CEST, Ian Cordasco wrote: > On Jul 10, 2013 6:33 AM, "afayolle" > wrote: > > > > On 09/07/2013 08:36, Sylvain Th?nault wrote: > > > Hi Ian, > > > > > > On 04 juillet 11:42, Ian Cordasco wrote: > > >> First, is there any interest in developing a pylint plugin for > Flake8? > > >> If so, who's interested in working with me on it. (I doubt we will > > >> finish it today, but I'd at least like to start it.) > > > On my side, I can't commit to find time to work on this but I > would definitly > > > like to have pylint integrated there and I'm willing to help > anyone working on > > > it. That would probably be a good opportunity to find common stuff > done in pylint > > > and flake8: I'm pretty sure both project may learn from each other > on high-level > > > stuff such as message control, ast handling, analysis execution... > Pylint has been > > > there for a while and has imo (truly objectivly, of course ;) neat > features on > > > that side. > > > > > > Cheers, > > > > Be aware of the licensing issue, though : depending on the way flake8 > > works (subprocess or import), the GPL license of Pylint could be an > > issue if the flake8 authors want to stick to MIT. > > > > Alexandre > > _______________________________________________ > > code-quality mailing list > > code-quality at python.org > > http://mail.python.org/mailman/listinfo/code-quality > > Thanks for that reminder and insight Alexandre! I don't remember if > that's relevant to the general idea of how we will implement this. We > would technically be blindly importing a plugin written by someone who > would be providing us with our expected interface for using pylint. > The same works for one-off plugins that do not interface with a third > party tool. Would this still affect our licensing? > It all depends on the way the plugin works. I'm not a lawyer, so take what I say with the usual caution. Here's my understanding: case 1: the plugin uses the command line API of Pylint to run Pylint in a subprocess and parses Pylint's output to implement the Flake8 api. In that case, the plugin can be under any license (e.g. MIT) case2: the plugin imports bits of the pylint code, and uses Pylint's API to do the checking and get the results. In that case the plugin must be made available under the GPL. Since the MIT license is compatible with the GPL, both the plugin and flake8 can be distributed. Alexandre From sylvain.thenault at logilab.fr Mon Aug 26 10:50:46 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Mon, 26 Aug 2013 10:50:46 +0200 Subject: [code-quality] Problems installing pylint 1.0 In-Reply-To: References: Message-ID: <20130826085046.GA4346@logilab.fr> Hi Skip, I'm coming back from holidays today. Do you still have the problem described below? Anyway, it's not clear to me how it relates to pylint itself. On 06 ao?t 09:59, Skip Montanaro wrote: > I'm trying to package up pylint 1.0 for our local installation. For > the most part, the simple tar archive seems ideal, however the path > components in the generated tar file have an unwanted prefix. Our > Python installation is in /opt/TWWfsw/python27, so > ./opt/TWWfsw/python27 appears as a prefix to all components of the tar > file: > > % tar tfz dist/pylint-1.0.0.share.tar.gz | head > ./ > ./opt/ > ./opt/TWWfsw/ > ./opt/TWWfsw/python27/ > ./opt/TWWfsw/python27/lib/ > ./opt/TWWfsw/python27/lib/python2.7/ > ./opt/TWWfsw/python27/lib/python2.7/site-packages/ > ./opt/TWWfsw/python27/lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/ > ./opt/TWWfsw/python27/lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/dependency_links.txt > ./opt/TWWfsw/python27/lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/top_level.txt > > I would like that to be: > > % tar tfz dist/pylint-1.0.0.share.tar.gz | head > ./ > ./lib/ > ./lib/python2.7/ > ./lib/python2.7/site-packages/ > ./lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/ > ./lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/dependency_links.txt > ./lib/python2.7/site-packages/pylint-1.0.0-py2.7.egg-info/top_level.txt > > How do I manage that? The bdist command doesn't accept a --prefix arg. > > Alternatively, I'd like the install command to work properly. It does > the right thing path-wise, but only installs lib, not bin: > > % ls -l /var/tmp/pylint-1.0/ > total 4 > drwxrwxr-x 3 skipm snake 4096 Aug 6 09:44 lib > > Thx, > > Skip > _______________________________________________ > code-quality mailing list > code-quality at python.org > http://mail.python.org/mailman/listinfo/code-quality > c -- 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 Mon Aug 26 10:52:46 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Mon, 26 Aug 2013 10:52:46 +0200 Subject: [code-quality] logilab-common 0.60 In-Reply-To: References: Message-ID: <20130826085246.GB4346@logilab.fr> On 06 ao?t 11:17, Skip Montanaro wrote: > > FTR, this wasn't setuptools (distutils doesn't do requirements) fault. > > The astroid 1.0.0 release is apparently broken. You shouldn't use software > > with bugs. ;) > > Thanks for the advice. :-) My original pylint install problems were > due to hurdles placed there by distutils. Once I worked around them > (with extraordinarily long command lines I can never remember and have > to record in our local wiki for the next time I need them), that went > fine. Unfortunately, astroid 1.0.0, as you indicated, has at least > this dependency problem. This is solved right? logilab-common 0.60 was actually released but missing from pypi. -- 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 Mon Aug 26 14:50:57 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Mon, 26 Aug 2013 14:50:57 +0200 Subject: [code-quality] Flake8 News In-Reply-To: <5219B3FD.7050305@free.fr> References: <20130709063635.GA2420@logilab.fr> <51DD4499.3000208@free.fr> <1374056686.24279.140661256651193.2CB0AA0E@webmail.messagingengine.com> <5219B3FD.7050305@free.fr> Message-ID: <20130826125057.GF4346@logilab.fr> On 25 ao?t 09:36, afayolle wrote: > On mer. 17 juil. 2013 12:24:46 CEST, Tarek Ziad? wrote: > >Yeah that's an issue indeed. I would like to stick with a BSD-like licence > > Well, changing the license of a piece of code such as Pylint may not be > that easy... There are several different contributors involved, and I'm > not certain where main contributors (Logilab / Sylvain) stand on this. Logilab and I prefer to stick to the GPL mostly for philosophical reasons. If it stands to be a limitation to Pylint usage and development, we may change our mind. That being said, as pointed by Alexandre, there as been a lot of contributors to Pylint for the last 10 years, so even if we (Logilab) decided to change the license, it would take some time to do it properly by asking for approval from the main contributors (supposing they would agree on the licence change). -- 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 graffatcolmingov at gmail.com Mon Aug 26 15:26:28 2013 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Mon, 26 Aug 2013 08:26:28 -0500 Subject: [code-quality] Flake8 News In-Reply-To: <20130826125057.GF4346@logilab.fr> References: <20130709063635.GA2420@logilab.fr> <51DD4499.3000208@free.fr> <1374056686.24279.140661256651193.2CB0AA0E@webmail.messagingengine.com> <5219B3FD.7050305@free.fr> <20130826125057.GF4346@logilab.fr> Message-ID: On Mon, Aug 26, 2013 at 7:50 AM, Sylvain Th?nault wrote: > On 25 ao?t 09:36, afayolle wrote: >> On mer. 17 juil. 2013 12:24:46 CEST, Tarek Ziad? wrote: >> >Yeah that's an issue indeed. I would like to stick with a BSD-like licence >> >> Well, changing the license of a piece of code such as Pylint may not be >> that easy... There are several different contributors involved, and I'm >> not certain where main contributors (Logilab / Sylvain) stand on this. > > Logilab and I prefer to stick to the GPL mostly for philosophical reasons. If it > stands to be a limitation to Pylint usage and development, we may change our > mind. That being said, as pointed by Alexandre, there as been a lot of > contributors to Pylint for the last 10 years, so even if we (Logilab) decided to > change the license, it would take some time to do it properly by asking for > approval from the main contributors (supposing they would agree on the licence > change). I could be entirely wrong here but I think we would be "safe" if we were to keep this as a plugin. Consider the fact that the plugin registers itself with Flake8 upon installation and Flake8 blindly imports it at run-time. With that in mind, we're never explicitly doing anything like `from pylint import (...)` or `from flake8_pylint import (...)` so we're never using the API of either per se. Since we're never actually doing that, I think we're exempt from the GPL's restrictions. The plugin, however, would have to be licensed under the GPL (or another license in the GPL's family). Again, I could be completely wrong, so don't take the above blindly as truth. My memory could very well be faulty at this early of an hour. From skip at pobox.com Mon Aug 26 15:27:56 2013 From: skip at pobox.com (Skip Montanaro) Date: Mon, 26 Aug 2013 08:27:56 -0500 Subject: [code-quality] Problems installing pylint 1.0 In-Reply-To: <20130826085046.GA4346@logilab.fr> References: <20130826085046.GA4346@logilab.fr> Message-ID: > I'm coming back from holidays today. Do you still have the problem described > below? Anyway, it's not clear to me how it relates to pylint itself. I think I'm set. I don't recall now what the resolution was, but I got past that sticking point. Skip From tarek at ziade.org Mon Aug 26 15:29:12 2013 From: tarek at ziade.org (=?ISO-8859-1?Q?Tarek_Ziad=E9?=) Date: Mon, 26 Aug 2013 15:29:12 +0200 Subject: [code-quality] Flake8 News In-Reply-To: References: <20130709063635.GA2420@logilab.fr> <51DD4499.3000208@free.fr> <1374056686.24279.140661256651193.2CB0AA0E@webmail.messagingengine.com> <5219B3FD.7050305@free.fr> <20130826125057.GF4346@logilab.fr> Message-ID: <521B5828.8050202@ziade.org> Le 8/26/13 3:26 PM, Ian Cordasco a ?crit : > On Mon, Aug 26, 2013 at 7:50 AM, Sylvain Th?nault > wrote: >> On 25 ao?t 09:36, afayolle wrote: >>> On mer. 17 juil. 2013 12:24:46 CEST, Tarek Ziad? wrote: >>>> Yeah that's an issue indeed. I would like to stick with a BSD-like licence >>> Well, changing the license of a piece of code such as Pylint may not be >>> that easy... There are several different contributors involved, and I'm >>> not certain where main contributors (Logilab / Sylvain) stand on this. >> Logilab and I prefer to stick to the GPL mostly for philosophical reasons. If it >> stands to be a limitation to Pylint usage and development, we may change our >> mind. That being said, as pointed by Alexandre, there as been a lot of >> contributors to Pylint for the last 10 years, so even if we (Logilab) decided to >> change the license, it would take some time to do it properly by asking for >> approval from the main contributors (supposing they would agree on the licence >> change). > I could be entirely wrong here but I think we would be "safe" if we > were to keep this as a plugin. Consider the fact that the plugin > registers itself with Flake8 upon installation and Flake8 blindly > imports it at run-time. With that in mind, we're never explicitly > doing anything like `from pylint import (...)` or `from flake8_pylint > import (...)` so we're never using the API of either per se. Since > we're never actually doing that, I think we're exempt from the GPL's > restrictions. The plugin, however, would have to be licensed under the > GPL (or another license in the GPL's family). > > Again, I could be completely wrong, so don't take the above blindly as > truth. My memory could very well be faulty at this early of an hour. We can also ask the FSF what's the best practice here I guess. Plugins vs CLI calls sound like quite an edge case > _______________________________________________ > code-quality mailing list > code-quality at python.org > http://mail.python.org/mailman/listinfo/code-quality From skip at pobox.com Mon Aug 26 15:35:25 2013 From: skip at pobox.com (Skip Montanaro) Date: Mon, 26 Aug 2013 08:35:25 -0500 Subject: [code-quality] logilab-common 0.60 In-Reply-To: <20130826085246.GB4346@logilab.fr> References: <20130826085246.GB4346@logilab.fr> Message-ID: > This is solved right? logilab-common 0.60 was actually released but missing > from pypi. Not in my mind. I'm working from the Mercurial repository. The stable branch declares its version to be 0.58.2. The default branch declares 0.58.0. Here are my current revisions: % hg branches stable 1502:15635ec1a44c py3k 791:318b3b3a166a default 1484:cc988839a8e5 (inactive) "hg pull" changes nothing, so I presume I am up-to-date. I cloned from here: % hg paths default = https://bitbucket.org/logilab/logilab-common Skip From graffatcolmingov at gmail.com Mon Aug 26 15:36:47 2013 From: graffatcolmingov at gmail.com (Ian Cordasco) Date: Mon, 26 Aug 2013 08:36:47 -0500 Subject: [code-quality] Flake8 News In-Reply-To: <521B5828.8050202@ziade.org> References: <20130709063635.GA2420@logilab.fr> <51DD4499.3000208@free.fr> <1374056686.24279.140661256651193.2CB0AA0E@webmail.messagingengine.com> <5219B3FD.7050305@free.fr> <20130826125057.GF4346@logilab.fr> <521B5828.8050202@ziade.org> Message-ID: On Mon, Aug 26, 2013 at 8:29 AM, Tarek Ziad? wrote: > We can also ask the FSF what's the best practice here I guess. > > Plugins vs CLI calls sound like quite an edge case Last time I asked a question along these lines I got neither a friendly nor helpful response. Perhaps if you know someone, you could get a better answer. From sylvain.thenault at logilab.fr Tue Aug 27 11:32:26 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 27 Aug 2013 11:32:26 +0200 Subject: [code-quality] logilab-common 0.60 In-Reply-To: References: <20130826085246.GB4346@logilab.fr> Message-ID: <20130827093226.GG2361@logilab.fr> On 26 ao?t 08:35, Skip Montanaro wrote: > > This is solved right? logilab-common 0.60 was actually released but missing > > from pypi. > > Not in my mind. I'm working from the Mercurial repository. The > stable branch declares its version to be 0.58.2. The default branch > declares 0.58.0. Here are my current revisions: > > % hg branches > stable 1502:15635ec1a44c > py3k 791:318b3b3a166a > default 1484:cc988839a8e5 (inactive) > > "hg pull" changes nothing, so I presume I am up-to-date. I cloned from here: > > % hg paths > default = https://bitbucket.org/logilab/logilab-common Humm, it seems that we're missing auto-synchronisation to bitbucket. The "central" repository is http://hg.logilab.org/master/logilab/common. I've pushed to bitbucket though, until this is done automatically. -- 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 skip at pobox.com Tue Aug 27 13:45:28 2013 From: skip at pobox.com (Skip Montanaro) Date: Tue, 27 Aug 2013 06:45:28 -0500 Subject: [code-quality] logilab-common 0.60 In-Reply-To: <20130827093226.GG2361@logilab.fr> References: <20130826085246.GB4346@logilab.fr> <20130827093226.GG2361@logilab.fr> Message-ID: > > % hg paths > > default = https://bitbucket.org/logilab/logilab-common > > Humm, it seems that we're missing auto-synchronisation to bitbucket. The > "central" repository is http://hg.logilab.org/master/logilab/common. I've pushed > to bitbucket though, until this is done automatically. Thanks. Should I not have been using bitbucket as my source? Skip -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvain.thenault at logilab.fr Tue Aug 27 13:48:52 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 27 Aug 2013 13:48:52 +0200 Subject: [code-quality] logilab-common 0.60 In-Reply-To: References: <20130826085246.GB4346@logilab.fr> <20130827093226.GG2361@logilab.fr> Message-ID: <20130827114852.GM2361@logilab.fr> On 27 ao?t 06:45, Skip Montanaro wrote: > > > % hg paths > > > default = https://bitbucket.org/logilab/logilab-common > > > > Humm, it seems that we're missing auto-synchronisation to bitbucket. The > > "central" repository is http://hg.logilab.org/master/logilab/common. I've > pushed > > to bitbucket though, until this is done automatically. > > Thanks. Should I not have been using bitbucket as my source? bitbucket is fine. We shall fix synchronisation asap. -- 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 Tue Aug 27 16:20:12 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 27 Aug 2013 16:20:12 +0200 Subject: [code-quality] Something about Pylint In-Reply-To: References: Message-ID: <20130827142012.GP2361@logilab.fr> On 09 ao?t 08:30, Ian Cordasco wrote: > This strongly seems like an issue where the authors of pylint/astroid did > not explore installation on a non-*nix machine. It is tough to do so > (speaking from experience) so I don't fault them, but the real solution is > not just to use '2to3.py' because on *nix machines, that does not exist. On > *nix machines it is installed as what is used in the script above. That > said, the best solution seems to be a sort of "compatibility" layer upon > installation where it looks to determine if it is on Windows and in that > case uses '2to3.py' and otherwise uses '2to3'. If you submit a pull request > to their repositories on BitBucket, I'm sure they would greatly appreciate > it. Indeed. We're definitly Linux users at Logilab so testing with Windows platform is not our daily activity. We're neither daily py3k users so that doesn't help... So you're right that any help on the windows and py3k fronts are greatly appreciated. Anyway the setup.py in its current form has already been "fixed" by a Windows user, but not enough apparently ;). So I'm fine with the patch started provided it's modified to take your remark into account and that it's tested against other python version (eg 2.7?) under windows. -- 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 Tue Aug 27 16:22:13 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Tue, 27 Aug 2013 16:22:13 +0200 Subject: [code-quality] Something about Pylint In-Reply-To: References: Message-ID: <20130827142213.GQ2361@logilab.fr> On 09 ao?t 20:03, ??? wrote: > Hello, Hello, > I am a beginner to Pylint, My name is Hou Zhuoming. When I install the pylint 1.0.0 in python 3.3(OS:Windows7), there is a error happened. > > And then I read the source code of pylint 1.0.0. I found something is wrong in setup.py model. > I found the same problem in astroid-1.0.0 and logilab-common-0.60.0 too. I also can install these two packages with the same change. > I am not sure it is a bug. Maybe, something is wrong when I am installing the pylint 1.0.0. (No problem in Linux) See my answer to Ian on this topic. The best way to move on this is probably to create an issue on bitbucket and ideally to submit a pull request there. > Another problem: when I successfully installed pylint 1.0.0, I want to run the pylint-gui.exe. I can see the GUI successfully. But when I want to test some python scripts, it works wrong.(The pylint.exe works normally) Have you tried pylint-gui using another version of Python? -- 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 ben+python at benfinney.id.au Thu Aug 29 07:22:25 2013 From: ben+python at benfinney.id.au (Ben Finney) Date: Thu, 29 Aug 2013 15:22:25 +1000 Subject: [code-quality] Flake8 News References: <20130709063635.GA2420@logilab.fr> <51DD4499.3000208@free.fr> Message-ID: <7w1u5dax66.fsf@benfinney.id.au> afayolle writes: > Be aware of the licensing issue, though : depending on the way flake8 > works (subprocess or import), the GPL license of Pylint could be an > issue if the flake8 authors want to stick to MIT. What is the issue, exactly? As I understand it, a work licensed under GPL terms can be derived in part from work under different license terms, so long as that license does not impose any further restrictions. Redistribution of the derived work would need to satisfy simultaneously all the license terms of all the parts from which it derives. Is Flake8 distributed under license terms that impose restrictions additional to the GPL? If not, I don't know what the problem is. -- \ ???????? | `\ (The virtuous are not abandoned, they shall surely | _o__) have neighbours.) ???? Confucius, 551 BCE ? 479 BCE | Ben Finney From 745189913 at qq.com Tue Aug 27 17:38:33 2013 From: 745189913 at qq.com (=?gb18030?B?uu7szMP3?=) Date: Tue, 27 Aug 2013 23:38:33 +0800 Subject: [code-quality] =?gb18030?b?u9i4tKO6ICBTb21ldGhpbmcgYWJvdXQgUHls?= =?gb18030?q?int?= In-Reply-To: <20130827142012.GP2361@logilab.fr> References: <20130827142012.GP2361@logilab.fr> Message-ID: Thanks for your reply. I will try my best to help to improve pylint. ------------------ School of Software,Sun Yat-sen University Zhuoming Hou(???) Phone:+8613427532687 (612687) Email:745189913 at qq.com ------------------ ???? ------------------ ???: "Sylvain Th?nault"; ????: 2013?8?27?(???) ??10:20 ???: "Ian Cordasco"; ??: "???"<745189913 at qq.com>; "code-quality"; ??: Re: [code-quality] Something about Pylint On 09 ao?t 08:30, Ian Cordasco wrote: > This strongly seems like an issue where the authors of pylint/astroid did > not explore installation on a non-*nix machine. It is tough to do so > (speaking from experience) so I don't fault them, but the real solution is > not just to use '2to3.py' because on *nix machines, that does not exist. On > *nix machines it is installed as what is used in the script above. That > said, the best solution seems to be a sort of "compatibility" layer upon > installation where it looks to determine if it is on Windows and in that > case uses '2to3.py' and otherwise uses '2to3'. If you submit a pull request > to their repositories on BitBucket, I'm sure they would greatly appreciate > it. Indeed. We're definitly Linux users at Logilab so testing with Windows platform is not our daily activity. We're neither daily py3k users so that doesn't help... So you're right that any help on the windows and py3k fronts are greatly appreciated. Anyway the setup.py in its current form has already been "fixed" by a Windows user, but not enough apparently ;). So I'm fine with the patch started provided it's modified to take your remark into account and that it's tested against other python version (eg 2.7?) under windows. -- 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 745189913 at qq.com Tue Aug 27 17:40:00 2013 From: 745189913 at qq.com (=?gb18030?B?uu7szMP3?=) Date: Tue, 27 Aug 2013 23:40:00 +0800 Subject: [code-quality] =?gb18030?b?u9i4tKO6ICBTb21ldGhpbmcgYWJvdXQgUHls?= =?gb18030?q?int?= In-Reply-To: <20130827142213.GQ2361@logilab.fr> References: <20130827142213.GQ2361@logilab.fr> Message-ID: Yes. I have tried pyint-gui in python2.7 on widows 7. But it has the same problem. ------------------ School of Software,Sun Yat-sen University Zhuoming Hou(???) Phone:+8613427532687 (612687) Email:745189913 at qq.com ------------------ ???? ------------------ ???: "Sylvain Th?nault"; ????: 2013?8?27?(???) ??10:22 ???: "???"<745189913 at qq.com>; ??: "code-quality"; ??: Re: [code-quality] Something about Pylint On 09 ao?t 20:03, ??? wrote: > Hello, Hello, > I am a beginner to Pylint, My name is Hou Zhuoming. When I install the pylint 1.0.0 in python 3.3(OS:Windows7), there is a error happened. > > And then I read the source code of pylint 1.0.0. I found something is wrong in setup.py model. > I found the same problem in astroid-1.0.0 and logilab-common-0.60.0 too. I also can install these two packages with the same change. > I am not sure it is a bug. Maybe, something is wrong when I am installing the pylint 1.0.0. (No problem in Linux) See my answer to Ian on this topic. The best way to move on this is probably to create an issue on bitbucket and ideally to submit a pull request there. > Another problem: when I successfully installed pylint 1.0.0, I want to run the pylint-gui.exe. I can see the GUI successfully. But when I want to test some python scripts, it works wrong.(The pylint.exe works normally) Have you tried pylint-gui using another version of Python? -- 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 jonathan.eunice at gmail.com Thu Aug 29 19:41:13 2013 From: jonathan.eunice at gmail.com (Jonathan Eunice) Date: Thu, 29 Aug 2013 13:41:13 -0400 Subject: [code-quality] Extending pylint to deal with template variables? Message-ID: I originally asked the following question on Stack Overflow. It was suggested that this would be the better venue for discussion. -- I wrote the say module to make formatted printing simpler and more straightforward. E.g. say("{len(items)} retrieved; {n_errors} encountered") rather than: print("{0} retrieved; {1} encountered".format(len(items), n_errors)) That part is going great. But I like to run pylint to look for gotchas and mistakes. Unfortunately, many data values are constructed solely for their usefulness in output operations, and pylint cannot "see" that use in a say call (or any other templates output mechanism) constitutes a genuine use of the variable. Wave after wave of W0612 (unused-variable) warnings can result. It's possible to simply put in ignore comments, but that seems retrograde. I'd rather just extend pylint to understand that variables used in say() templates are, in fact, used. .../pylint/checkers/variables.py appears to be the place to add this check, but I'm unfamiliar with the codebase. Any hints or suggestions as to how to register variables used in format-style strings are, indeed, properly used? -- One SO commenter suggested that since pylint doesn't do much with strings, this may be a fair amount of work. But I already know how to parse format-style strings; I just use Python's own string.Formatter.parse. Creating an AST from the contents of the format braces and walking it to find what names are referenced--I've got that covered. What I most need is insight into how to communicate to pylint that it should consider the identifiers I've found to be used. I'd also seen at least one comment online suggesting that pylint doesn't really have an extensions/plugin mechanism. Is that true? Either way, what would be the best way to provide extended functionality atop pylint? Is the team receptive to code contributions? -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvain.thenault at logilab.fr Fri Aug 30 11:45:45 2013 From: sylvain.thenault at logilab.fr (Sylvain =?utf-8?B?VGjDqW5hdWx0?=) Date: Fri, 30 Aug 2013 11:45:45 +0200 Subject: [code-quality] Extending pylint to deal with template variables? In-Reply-To: References: Message-ID: <20130830094545.GE4720@logilab.fr> Hi Jonathan, On 29 ao?t 13:41, Jonathan Eunice wrote: > I originally asked the following question on Stack > Overflow. > It was suggested that this would be the better venue for discussion. I've seen this, even added some hint there. [snip] > One SO commenter suggested that since pylint doesn't do much with strings, > this may be a fair amount of work. But I already know how to parse > format-style strings; I just use Python's own string.Formatter.parse. > Creating an AST from the contents of the format braces and walking it to > find what names are referenced--I've got that covered. What I most need is > insight into how to communicate to pylint that it should consider the > identifiers I've found to be used. > > I'd also seen at least one comment online suggesting that pylint doesn't > really have an extensions/plugin mechanism. Is that true? Either way, what > would be the best way to provide extended functionality atop pylint? Is the > team receptive to code contributions? Pylint has some extensions/plugin mecanism and we're definitly receptive to code contribution. For instance, contribution avoiding false positive when variables are used in (new or old style) format strings w/ usage of locals() or other kind of magic will be greatly appreciated. In the case of your custom say() function, the "problem" is that you want to change the behaviour of some existing checker, while the bare plugins api is intended to provide new checkers (or other kind of objects used by pylint). So you're left with the following options: * monkey-patch the existing checker in a plugin module * provide a whole replacement for the variable checker, probably by inheriting from the original one. This will require a 'replace_checker' API in addition to the existing 'register_checker' method on the linter class. If you like this option, I may implement this method for you * modify the original variable checker so that one may specify that additional names have been consumed, then write a plugin that use the newly introduced API to handle 'say()' IMO the long term solution is the last option (even though having the 'replace_checker' method may be of interest anyway ;). BTW, a Pylint plugin is simply a python module with a function like def register(linter): ... function in it, that may then register custom checkers, reporters and so on (do some monkey-patch, call some variable checker module function, etc.). There is also some extensions points at the astroid (ie AST) level but I don't think it will help in your case. -- 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 skip at pobox.com Fri Aug 30 13:43:37 2013 From: skip at pobox.com (Skip Montanaro) Date: Fri, 30 Aug 2013 06:43:37 -0500 Subject: [code-quality] Extending pylint to deal with template variables? In-Reply-To: <20130830094545.GE4720@logilab.fr> References: <20130830094545.GE4720@logilab.fr> Message-ID: Note that this isn't peculiar to the say module. You can generate these false positives with dict format expansions in Python without using an external module. For instance: x = 4 print("%(x)s" % locals()) Pylint can't tell that x is used because it's use is buried in the format string. I have stumbled on this before and ignored it, but I think it would be a useful improvement. Skip