For your next Python project, consider using Paste Script. Paste Script helps you set up your project structure quickly so that it's ready for distribution.
Just easy_install Paste Script like so:
easy_install PasteScript
This will download the latest Paste Script and all its dependencies from the Cheese Shop.
If you don't want easy_install to put the downloaded packages into your standard site-packages directory, consider using workingenv or look at Custom Installation Locations.
This is where it gets interesting. When we invoke the paster create command, we'll be asked a couple of questions, most of which we can answer by hitting enter and thereby using the default value:
$ paster create Selected and implied templates: PasteScript#basic_package A basic setuptools-enabled package Enter project name: MyFancyNewProject Variables: package: myfancynewproject project: MyFancyNewProject Creating template basic_package Enter version (Version (like 0.1)) ['']: Enter description (One-line description of the package) ['']: This is a fancy project ...
After answering the questions, Paste Script will set up the files for our project:
Creating directory ./MyFancyNewProject
Recursing into +package+
Creating ./MyFancyNewProject/myfancynewproject/
Copying __init__.py to ./MyFancyNewProject/myfancynewproject/__init__.py
Recursing into +project+.egg-info
Creating ./MyFancyNewProject/MyFancyNewProject.egg-info/
Recursing into docs
Creating ./MyFancyNewProject/docs/
Copying setup.cfg to ./MyFancyNewProject/setup.cfg
Copying setup.py_tmpl to ./MyFancyNewProject/setup.py
Running /usr/bin/python setup.py egg_info
Your newly started project is now ready for distribution!
By the way, there's also a handy --svn-repository=REPOS argument to the paster create command which will create a basic Subversion layout for your project. Pass the Subversion directory that you want to be used as the parent of your project's directory like so:
$ paster create --svn-repository=http://mysubversionserver/myprojects/
This will create a MyFancyNewProject directory under myprojects/ and it'll create trunk, branches and tags subdirectories therein.
Adding your own set of templates to Paste Script is fairly simple. The Paste Script developer documentation explains how to do that.
Based on that, I've had the idea of creating a simple set of templates for quickstarting a Zope project. There's already the skeletor project which aims to do something similar for Zope 2. When I looked at skeletor though, I decided that it does a bit much and it's fairly complex. I also ran into a few tracebacks while trying to use the tool. Which led me to trying out Paste Script.
I've started a small project which I call ZopeSkel. The only purpose of ZopeSkel is to add a couple of templates to the existing ones of Paste Script. Right now, ZopeSkel contains only one template called basic_zope, which is very bare bones. Take a look at the project's templates directory.
You can think of ZopeSkel as a minimal example of creating your own templates package for use with Paste Script. I want to look and see if I can create a good set of templates. Please tell me what kinds of templates would be helpful for you!
To install the latest ZopeSkel from Subversion do easy_install http://svn.plone.org/svn/collective/ZopeSkel/trunk#egg=ZopeSkel-dev. After installing, you can see that the list of templates available to paster create has been extended:
$ paster create --list-templates Available templates: basic_package: A basic setuptools-enabled package basic_zope: A Zope project paste_deploy: A web application deployed through paste.deploy
Try paster create --help to find out more about the create command.
When developing setuptools enabled projects, setuptool's Development Mode is essential. In Development Mode, you can edit code inside the checkout directory and immediatley see the effects of your changes when running the program. (If you make any changes to the project's setup script or C extensions, you need to run python setup.py develop).
posted at: 21:17 |
0 comments |
category: /devel/zope
|
permanent link |
add to del.icio.us or digg it
| May 2006 | > | |||||
| Su | Mo | Tu | We | Th | Fr | Sa |
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 | |||
Feed of all categories:
rss |
atom