Fetchez le Python

February 20, 2008

Pylint installation made easier

Filed under: plone, python, quality, zope — Tarek Ziadé @ 5:12 pm
Tags:

EDIT: logilab.pylininstaller is now deprecated, since Logilab made Pylint easy_installable now.

So, just call : easy_install pylint.

I love Pylint.

Correctly configured, it is really useful to raise your code quality. But it can be really painful to install if you are not under a Debian-like or OpenSuse-like system, because of its dependencies that are not namespaced packages (logilab-common and logilab-astng).

In other words, don’t try to easy_install the packages that are on PyPI, it will not work.

That’s why I have created an egg, called logilab.pylintinstaller, that will let you install it as easy as:

$  easy_install logilab.pylintinstaller

It bundles all dependencies and grabs pylint 0.14, then installs everything.

Thanks to Sylvain Thénault from Logilab for his help on this.

26 Comments »

  1. Nice work!

    I noticed that installing the logilab.pylintinstaller egg within a buildout didn’t generate the scripts under the bin directory. I used the following section in my buildout to get the ‘pylint’ script.

    [pylint]
    recipe = zc.recipe.egg
    eggs = logilab.pylintinstaller pylint
    entry-points = pylint=pylint.lint:Run
    arguments = sys.argv[:1]

    Comment by Kai Lautaportti — February 20, 2008 @ 6:24 pm | Reply

  2. @Kai, thanks for this, pretty useful. You made a small typo btw, should be sys.argv[1:]

    Comment by Tarek Ziadé — February 20, 2008 @ 10:59 pm | Reply

  3. Not just Debian. You can have it running on OpenSuSE as well.

    Pylint is a package there that is easily installable with smart.

    Comment by Jorge — February 21, 2008 @ 1:58 am | Reply

  4. @Jorge: thanks for the info, corrected !

    Comment by Tarek Ziadé — February 21, 2008 @ 9:31 am | Reply

  5. I have trouble installing this from easy_install on OS X Leopard. Here is the stacktrace I get:

    Searching for logilab.pylintinstaller
    Reading http://pypi.python.org/simple/logilab.pylintinstaller/
    Best match: logilab.pylintinstaller 0.1.0
    Downloading http://pypi.python.org/packages/source/l/logilab.pylintinstaller/logilab.pylintinstaller-0.1.0.tar.gz#md5=f78649c12c057a5852ef2001add6ebb0
    Processing logilab.pylintinstaller-0.1.0.tar.gz
    Running logilab.pylintinstaller-0.1.0/setup.py -q bdist_egg –dist-dir /var/folders/li/liSBg-6gFQCExc1IKU5tTU+++TM/-Tmp-/easy_install-NHtvbD/logilab.pylintinstaller-0.1.0/egg-dist-tmp-d2XBoV
    error: /var/folders/li/liSBg-6gFQCExc1IKU5tTU+++TM/-Tmp-/easy_install-NHtvbD/logilab.pylintinstaller-0.1.0/logilab/pylintinstaller/docs/README.txt: No such file or directory

    Comment by Tim Gebhardt — February 23, 2008 @ 11:07 pm | Reply

  6. @Tim, yeah it has a bug thx ! try the new release 0.1.1, should be fixed. let me know

    Comment by Tarek Ziadé — February 24, 2008 @ 12:13 am | Reply

  7. Works now. Thanks!

    Comment by Tim Gebhardt — February 24, 2008 @ 8:20 pm | Reply

  8. Thank you so much! I very much appreciate your work on this. Installing pylint has always been a major PITA.
    Btw: The command line in this blog post has one ’s’ too much.

    Comment by Hendrik — February 25, 2008 @ 1:41 am | Reply

  9. @Hendrik: thanks, tipo corrected

    Comment by Tarek Ziadé — February 25, 2008 @ 4:55 am | Reply

  10. Awesome work! Except I am getting, “Your code has been rated at 0.51/10″. Oh boy, I gotta lotta clean-up to do …

    If you are installing w/ buildout, you need to make sure the egg names (logilab.pylintinstaller and pylint) are seperated by line breaks (and make sure you heed the sys.argv[1:] typo fix). If you have a buildout-based project you will also want to include your project’s egg in the pylint eggs so that it can properly handle imports. e.g. if you have created a Grok app from running ‘grokproject grokapp’ then you can include the ‘grokapp’ egg in the pylint eggs declaration and it’s all good.

    Comment by Kevin Teague — May 28, 2008 @ 1:07 am | Reply

  11. @Kai: I’ve put that stuff in my buildout for a grok project. How do I now run it?

    Comment by Peter Bengtsson — July 17, 2008 @ 10:43 am | Reply

  12. @Peter, you should find a “pylint” binary in bin, so just run :

    $ bin/pylint some params

    Comment by Tarek Ziadé — July 18, 2008 @ 3:22 pm | Reply

  13. I struggled for a while trying to install pylint and the logilab-* stuff on OS X. Your installer saved me time and detective work. Thanks! I did have to change pylint==0.14 to pylint==0.15.2 in EGG-INFO/requires.txt.

    Comment by Jeff — October 31, 2008 @ 11:08 pm | Reply

  14. There’s a new version of pylint released and the old one is not found anymore with easy_install. Could you release a new version of pylintinstaller where required pylint version is 0.15.2?

    Comment by Antti — November 18, 2008 @ 12:14 pm | Reply

  15. @Antti

    I have released a new version

    http://products.ingeniweb.com/catalog/logilab-pylintinstaller/releases/0.15.2/logilab.pylintinstaller-0.15.2.tar.gz

    I cannot upload it to PyPI right now which is down, but you can easy_install the given URL until then.

    Comment by Tarek Ziadé — November 18, 2008 @ 11:13 pm | Reply

  16. No go on that 0.15.2 egg…

    Running it in Windows spews some syntax errors,processes a while, then craps out. Too bad… I’ve installed pylint on a few machines and getting the latest version running is a very irritating exercise. This would have been nice!

    Comment by Russ — December 17, 2008 @ 10:46 pm | Reply

  17. @Russ sent me a traceback, it should work !

    Comment by Tarek Ziadé — December 18, 2008 @ 8:24 am | Reply

  18. any tips how plone products could be added to sys.path of pylint interpreter?

    Comment by iE — January 14, 2009 @ 1:05 pm | Reply

  19. Tarek, I’m having problems installing on Windows as well. I’ve forwarded a log of the easy_install session. Please take a look if you have time.

    (BTW, I had to Google for your email address… if you haven’t received the log, please contact me)

    Comment by Shawn Wheatley — January 14, 2009 @ 8:06 pm | Reply

  20. @iE: use zc.recipe.eggs, to create a pylint script in your buildout, containing a modified sys.path

    @Shawn: got your mail, I’ll look at it asap

    Comment by Tarek Ziadé — January 14, 2009 @ 8:51 pm | Reply

  21. [...] this installer package helpful in getting PyLint and its dependencies to all install correctly: http://tarekziade.wordpress.com/2008…n-made-easier/ http://pypi.python.org/pypi/logilab.pylintinstaller I used it on Windows, but it should [...]

    Pingback by working pylint anyone? | keyongtech — January 18, 2009 @ 5:22 pm | Reply

  22. @Shawn: it’s a bug in pylint itself : epylint.bat is missing in the bin directory

    Comment by Tarek Ziadé — January 18, 2009 @ 5:48 pm | Reply

  23. Hey, it worked perfectly on Fedora 10 as well!

    Thank you so much. :)

    Comment by Daniel F. Martins — January 21, 2009 @ 9:16 pm | Reply

  24. Hi,

    I had to manually pin the pylint version to get it to work.

    While:
    Installing pylint.
    Error: There is a version conflict.
    We already have: pylint 0.13.1
    but logilab.pylintinstaller 0.15.2 requires ‘pylint==0.15.2′.

    Using this section in buildout, it works:

    [pylint]
    recipe = zc.recipe.egg
    eggs =
    logilab.pylintinstaller
    pylint==0.15.2
    entry-points = pylint=pylint.lint:Run
    arguments = sys.argv[1:]

    Comment by René Fleschenberg — June 19, 2009 @ 8:58 am | Reply

  25. Can you add a note to this blog entry that logilab.pylintinstaller is deprecated?

    Comment by srid — June 29, 2009 @ 11:00 pm | Reply

  26. @srid : done

    Comment by Tarek Ziadé — June 30, 2009 @ 6:26 am | Reply


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.