First week at the new job, so I get do delve into currently-unkown code. And I get to reload my Django knowledge back into my head: it has been a year since I “did” my till-now-only-one django project.
And I got the job of introducing proper python packaging.
“Proper python packaging” for me means two things:
In the Django context I’d add one more aspect to proper packaging:
Without packaging, you basically end up with one directory structure for your project. One main directory and the libraries (Django: applications) inside it. When you take those libraries and package them independently, you get several advantages:
Coming from a Zope and Plone background, I’m used to packages like zest.releaser, plone.app.something, z3c.anotherthing. Namespaces. Handy to keep zest.releaser out of collective.releaser’s hair. And to keep the generic openid package, plone’s openid package and your company’s openid package out of each others hair: you cannot call all of them “openid”.
We’ve got two main product lines at our company. And the first subdirectory that I tackled was called “base”. So firstproductline.base was born.
Raargh, Django doesn’t like namespaces. You get errors like “application firstproductline not found” when you expect it to load “firstproductline.base”. And from what I read, namespaces are actively discouraged in Django.
So what I settled with, after some googling for examples, was to name the package firstproductline-base (with a dash). The svn url is something like https://.../firstproductline-base/trunk. And inside that, the actual code is in a firstproductline_base directory (with an underscore). firstproductline_base is thus the module name that you import.
Well, I’ll have to see how well such a scheme holds up. Feedback welcome!
My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):