Creating extensions ¶
Tipfy has several extensions that add new features and support the various App Engine APIs. For example, extensions can:
- Provide mixin classes for RequestHandler
- Implement App Engine APIs
- Implement third party APIs
- Wrap external libraries to provide utilities
- Implement middleware for the WSGI application
- Implement middleware for handlers
- Provide miscelaneous utilities
- ... and whatever you imagine that can be useful.
Create and Publish your own Extension¶
An extension is a Python package distributed through PyPi. To help create new extensions, we have an Extension Builder that can create a package skeleton ready to be published. Here's how:
- Create your package using the Extension Builder.
Notice that extensions can be a package or module, so select the right option:
- If your extension is single file, select "module". All extension code will
be contained in
tipfy/ext/my_extension_name.py. - If your extension has several files, select "package". Your extension will
be a package with at least
tipfy/ext/my_extension_name/__init__.py.
- If your extension is single file, select "module". All extension code will
be contained in
- Unzip the generated file and add your extension code to the package or module inside
tipfy/ext.
That's it! Now you can use your extension in development or publish it to the world.
Use your extension in development only¶
If you are developing your extension and it is not ready to be published yet, or if it is not a public extension at all, you can still use buildout to add it to your app.
- Add the extension directory to your project directory.
- Open
buildout.cfgand add a variabledevelopto the[buildout]section:Here,[buildout] develop = ./my_extension_dir ./my_other_extension_dir
my_extension_diris your extension directory, the one that containssetup.py. You can list many extensions there, one by line, so we also addedmy_other_extension_dir. - Access your project directory and run on command line:
bin/buildout
There, your develop extension will be installed and you can use it in your app.
Publish your extension¶
After your extension is ready, you can publish it on PyPi to share it with the world. Let's see how to do this.
If you are not registered with PyPi¶
If you have never published a package before and is not registered with PyPi, you need to register first. To do this, access your extension directory from comamnd line and run:
python2.5 setup.py register
You'll see a menu like this:
running register
We need to know who you are, so please choose either:
1. use your existing login,
2. register as a new user,
3. have the server generate a new password for you (and email it to you), or
4. quit
Your selection [default 1]:
Choose option 2 to register a new user and follow the steps. After submitting your details, you will receive an email to confirm your registration. Confirm it and move to the next section to register your extension.
If you have problems, the full documentation is here.
If you are already registered with PyPi¶
Once you are registered with PyPi, access your extension directory from comamnd line and run:
python2.5 setup.py register
This will register your extension name and need to be done only once. For future versions of the extension, you can skip this step.
Then, to actually publish the extension, run:
python2.5 setup.py sdist --formats=gztar,zip upload
This will publish the extension on Pypi in two formats, gzip and zip. Now you can install the extension using tipfy's buildout tool.
Tell the world¶
After your extension is published, one step is left: tell the world about it! Here're some good ideas to follow:
- Add a page to the extension list explaining the extension and showing an example.
- Announce it on tipfy discussion group.
- Announce it on reddit.
Here is list of all current tipfy modules found on PyPI.
- Version: latest
- Edited by pedromorgan on 7/23/10 6:58 AM
- Save on Delicious | Submit to Reddit
- History
- Edit
