views:

65

answers:

2

Currently an application of mine is using SQLAlchemy, but I have been considering the possibility of using Django model API.

Django 1.1.1 is about 3.6 megabytes in size, whereas SQLAlchemy is about 400 kilobytes (as reported by PyPM - which is essentially the size of the files installed by python setup.py install).

I would like to use the Django models (so as to not have other developers learn yet-another-ORM), but do not want to include 3.6 megabytes of stuff most of which are not needed. (FYI - the application, final executable that is, actually bundles the install_requires from setup.py)

+1  A: 

The Django ORM is usable on its own - you can use "settings.configure()" to set up the database settings. That said, you'll have to do the stripping down and repackaging yourself, and you'll have to experiment with how much you can actually strip away. I'm sure you can ditch contrib/, forms/, template/, and probably several other unrelated pieces. The ORM definitely relies on conf/, and quite likely on core/ and util/ as well. A few quick greps through db/* should make it clear what's imported.

Carl Meyer
+1  A: 

You may be able to get a good idea of what is safe to strip out by checking which files don't have their access time updated when you run your application.

gnibbler