|
|
|
Easter python eggsIt's easter, and only fitting that I play with eggs, so today I have been
looking at making python eggs. Eggs are a new way of distributing python
software that gets more and more popular. This is mainly because installing
it is simple, and because an egg can contain a list of requirements, and the
installer will check if these requirements are installed, and if not, it
will look them up in the standard Python module library (known as the Cheese
Shop), and download and install them.
This means the end of long hours of downloading, compiling and installing all those modules you need to get your python software working. You download just the module you want as an egg and install it, and all requirements will be installed with it, if they have been eggyfied too. Making eggs is unfortunately a bit tricky. This is because there is no good examples of how to do it, so you have to read through all the documentation, and experiment a lot. This is a shame, because in the end, it turns out to be very easy. All you need is to install the python module setuptools, and create a a setup.py for your package. Creating it can be slightly tricky, if your package layout is complicated. Also, there is not always clear what the parameters in it should be, and there is quite a lot of searching and trying out (and for my finally some honest debugging of setupttools too figure out what was going on, really). The parameters are for the most part the same as for making a package with distutils, so if you have a distutils package, all you need to do is to switch out the "from distutils.core import setup" to "from setuptools import setup" and you are done. Here is an an example of a full setup.py, for the CalCore module:
#!/usr/bin/env python
from setuptools import setup
setup(name='calcore',
package_dir={'': 'src'},
packages=['calcore'],
version='2.0.1',
install_requires=['zope.interfaces >= 3.0',
'zope.schema >= 3.0',
'zope.i18nmessageid >= 3.0'],
dependency_links=['http://download.zope.org/distribution/',],
# metadata for upload to PyPI
author='Martijn Faassen, Infrae;Lennart Regebro, Nuxeo',
author_email='lregebro@nuxeo.com',
description='Calendaring system',
license='GPL2',
keywords='calendar icalendar',
url='http://www.cps-project.org/sections/projects/calendar_server ',
long_description="""CalCore is an advanced, flexible calendaring component for Python. It
allows the Python developer do write advanced calendaring applications
either using their own event storage or integrating with external
calendar servers.
Features of the CalCore include among others:
* Support for making private calendars, shared calendars, resource
booking and more.
* integration with iCalendar clients (Apple iCal, Mozilla Sunbird,
KOrganizer...) using the iCalendar protocol,
* invitation workflow,
* meeting support, including helper functions to look for free time,
* recurring event support (thanks to SchoolTools recurrence
implementation, http://www.schooltool.org),
* etc.
CalCore is being used as the core of Nuxeos CalZope and
CPSSharedCalendar products, products for integrating with Zope and CPS.
These products provide a complete web-based user interface to the
CalCore calendaring.""",
classifiers=['Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: OS Independent',
'Topic :: Office/Business :: Groupware'],
platforms='All',
)
You'll note the install_requires parameter, that list the requirements. You can also use ==, of course, and you can list requirements that are only used for testing, and lots of other stuff. Also note the dependency_links parameter, which enables downloads from other places than the Cheeze Shop, in this case Zope.orgs repository of Zope3 eggs.Important announcement: Join the Nuxeo team and contribute to the Nuxeo project! We have open positions in France and the UK for open source Java EE developers and sales engineers, both junior and senior. Trackback PingsTrackback URL for this entry:
http://blogs.nuxeo.com/sections/blogs/lennart_regebro/2006_04_13_easter-python-eggs/tbping
Posted by Lennart Regebro @ 04/13/2006 07:29 PM.
-
Categories:
python
-
0 comments
|
Nuxeo Bloggers: Log in! Search Nuxeo Blogs
About this blog
Lennart Regebro
Nuxeo Bloggers
Photos and Pictures
|
|
Nuxeo -
Indesko -
Nuxeo 5 Project
All content is copyrighted by their author. CPSSkins is Copyright © 2003-2006 by Jean-Marc Orliaguet. | CPS is Copyright © 2002-2006 by Nuxeo SAS. |