fbpx
dirtSimple.orgwhat stands in the way, becomes the way

Reinvent no more forever

Python as a community is plagued by massive amounts of wheel-reinvention. The infamous web framework proliferation problem is just the most egregious example.

Why is Python “blessed” with so much reinvention? Because it’s often cheaper to rewrite than to reuse. Python code is easy to write, but hard to depend on. You pretty much have to:

  1. limit yourself to platforms with a suitable packaging system,
  2. bundle all your dependencies into your distribution, or
  3. make your users do all the work themselves

Ouch. No wonder rewriting looks easier. The only way to stop this trend is to make it easier to reuse than to rewrite, which has been my mission with setuptools and EasyInstall. As of setuptools-0.5a5, it’s possible to sanely develop packages with dependencies, just by listing them in the ‘install_requires’ keyword to setuptools.setup(), and including the ‘ez_setup.py’ bootstrap file in the same directory as your ‘setup.py’. When a user does ‘setup.py install’, your package is installed as an egg, and all your dependencies are downloaded and installed if not already present. Similarly, if a user installs your package with EasyInstall, the same thing happens. What more could you want?

Well, seriously, there are lots of little improvements still on my list – like documentation, for example. A tutorial on how to convert a package to using setuptools would be awesome. I also want to add some support for automatically detecting whether a package can be safely installed as a zipped .egg file, using a conservative algorithm based on the absence of data files outside the metadata directory.

But for right now, I plan to start by putting my dependencies where my mouth is. I will bundle no more forever, for I am tired of keeping them up-to-date with their upstream maintainers. I shall rend my monolithic packages into smaller projects, so that people can make use of cool parts of PEAK without having to install anything but the part they want. I will find out if this stuff really works. From where the setuptools now stand, I will bundle no more forever.

Join the discussion
dirtSimple.org

Menu

Stay In Touch

Follow our feeds or subscribe to get new articles by email on these topics:

  • RSS
  • RSS
  • RSS

 

Get Unstuck, FAST

Cover photo of "A Minute To Unlimit You" by PJ Eby
Skip to toolbar