One of the pleasures of open source is that random people contribute back uninvited. I was extremely flattered when the previous week I received an email from Michael Thalmeier with a link to a git branch containing all the necessary work for PySmell to support setuptools.

Indeed, PySmell is now available at PyPI, however with only Python2.5 support, and not tested on Windows yet (but will soon! Windows is a top priority for PySmell).

The trouble I had with setuptools was:

Muddled documentation

The setuptools documentation assumes an intimate knowledge of distutils. Being completely new to this packaging thing, I was completely lost for a while. Then it clicked on me that setuptools is an extension of distutils, adding some functionality on top. Thus, when you want to search for how to do something, you must check both places.

Too many options

This probably continues from the previous point, but there is no quickstart guide for small projects. PySmell is a package of 6 files, with one script and one non-python file (the vim script). I'm sure that larger projects with C-extensions etc. need all these options, but I think that a small quickstart guide that caters to the 80% of the smaller ones would be godsend. Indeed, if such a thing existed, I wouldn't wait for outside contributions (I have to confess that I was sure that at one point or another someone would do this, so I just did nothing).

Not obvious ways to do stuff

Quick, what is the best way to distribute the pysmell.vim helper script? There are dozens of possible places for it to go, guaranteeing that a guess would be wrong. data_files, MANIFEST.in or include_package_data? What happens when using easy_install? Are there post-install hooks? Can I print my custom message when easy_install finishes (as guidance on what to do next)?

These are actually valid questions so please dear LazyWeb, if you have answers I'd be grateful!

Python-specific eggs

Eggs are tied to the Python version that created them (so far as I can tell). That means that I have to install Python 2.4, 2.5 and 2.6 on the same machine just to do egg releases. This is a major overkill - I can see specifying a minimum Python version (as a dependency?), but forwards compatibility should be taken for granted.

PyPI hiccups

While PyPI prompted me to signup right in the console, actually registering PySmell didn't work until I logged in manually. I couldn't overwrite my upload, and I had to delete it and re-upload it every time I changed my setup.py.

Conclusion

I know that I am only going to hit these issues once, and for my next project I'm going to reuse bits and pieces of my current setup. I also know that there's been a lot of discussion about moving setuptools and friends to the next century. I'm going to paste my setup.py now, hoping that a) I'll get some nice comments about improving it and b) it might help someone who is looking for something simple to get things started.

#!/usr/bin/env python

# -*- coding: UTF-8 -*-

from setuptools import setup

setup(
    name='pysmell',
    version ='0.6',
    description = 'An autocompletion library for Python',
    author = 'Orestis Markou',
    author_email = 'orestis@orestis.gr',
    packages = ['pysmell'],
    entry_points = {
        'console_scripts': [ 'pysmell = pysmell.pysmell:main' ]
    },
    data_files = [
        ('vim', ['pysmell.vim'])
    ],
    include_package_data = True,
    keywords = 'vim autocomplete',
    url = 'http://code.google.com/p/pysmell',
    long_description =
"""\
PySmell is a python IDE completion helper.

It tries to statically analyze Python source code, without executing it,
and generates information about a project's structure that IDE tools can
use.

The first target is Vim, because that's what I'm using and because its
completion mechanism is very straightforward, but it's not limited to it.
""",
    classifiers = [
        'Development Status :: 5 - Production/Stable',
        'Environment :: Console',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Topic :: Software Development',
        'Topic :: Utilities',
        'Topic :: Text Editors',
    ]

)

Please point out errors!

October 26, 2008, 11:31 p.m. More (681 words) 3 comments Feed
Previous entry: PySmell v0.6 released
Next entry: Towards headless IDEs

Comments

1

Comment by twobraids , 3 years, 6 months ago :

Thank for posting these thoughts on distutils and setuptools. I hold the same opinions on the opacity of these tools. After puzzling out what to do for one of my small projects, and then having it not work right, I quickly decided it wasn't worth it for such a tiny project. "Just copy it to .../site-packages" has unfortunately become my installation instructions of choice.

2

Comment by PJ Eby , 3 years, 6 months ago :

Eggs aren't really a distribution format; just upload an sdist to PyPI and easy_install will build the eggs for the corresponding platform.

There are only two reasons to upload an actual egg to PyPI:

1. You need to use an automated install tool that can't use source distributions, or

2. You want to provide Windows or Mac binaries of something that's written in C.

If you don't meet either of these criteria, there's no need to even build an egg. Just upload an sdist and move on.

3

Comment by Orestis Markou , 3 years, 6 months ago :

Good information, PJ Eby! I'll remove the egg from PyPI then. I think I'll start write my own quickstart for setuptools after this post.


Comments are not allowed in this post