package is a package to package your package
package package package
This is the package package package package for Python. It can be found in the Python Package Index, here: http://pypi.python.org/pypi/package/.
package is a toolset to help Python package people package their packages. If you do not personally package Python packages, you can ignore this package package.
DON’T INSTALL THIS PACKAGE (package)!!!
package isn’t meant to be installed like normal Python packages. It is meant to be copied and distributed as a part of other Python packages.
The best thing to do is to to git clone it from GitHub, and put it beside the other packages that you package for Python:
git clone git://github.com/ingydotnet/package-py.git
The second best thing to do is get the latest package-#.#.#.tar.gz from http://pypi.python.org/pypi/package/, untar it and rename the directory to package-py.
Then follow the instructions given below.
Confused? So was I…
I like to write a lot of modules and distribute them as packages, but when I started doing this in Python, I ran into a wall of setup/installer bugs, bad workarounds and community disagreement about what the best way to go was. I decided to fix this in a way that makes all programmers be able to install my Python packages (and their prerequisite packages), regardless of their current Python knowledge or working environment.
The solution is simple. Just add helper tools in a subdirectory that gets included in every Python package you release.
It’s a simple trade of a little extra storage space for functionality, package-author-sanity and world peace. :)
These are some of the things I was concerned with when I started this project:
- Make my Python packages installable by anyone.
- Allow my Python packages to depend on other packages.
- Put as little extra burden on the user as possible.
- Never leave the user uninformed and screaming.
- Make setup.py files be autogenerated from simple yaml files.
- Don’t let this project paint its users into yet another dependency corner.
- Provide a simple Makefile for automating related tasks.
- Provide support for running unittests with make test.
- Keep the bloat of using package to a minimum.
To use this Python package packaging technique, follow these simple steps:
> cd your/src/dir/
In other words, just go to the directory where you want to put this package package’s repository. Putting it next to your other Python package source code repositories is what I am suggesting here…
> git clone git://github.com/ingydotnet/package-py.git
Unless, of course, you already have package-py. Then maybe you should git pull it to get the latest code.
> mkdir newproject
> cd newproject
> make -f ../package-py/Makefile.mk setup
This will set up the all files you need for a new project. These files are in a generic, template form until you complete the next two steps.
Edit package/info.yaml with all the information about your package.
Commonly, you will only need two lines in this file:
name: newproject include: ../package-py/my-info.yaml
You can keep all your common values in a common file to be included. The project name, of course, is always different from package to package.
> make info
This command will update your package files with the information you specified in package/info.yaml. You should run it whenever you update your info.yaml file.
> make help
At this point everything should be set up for you to use just like any other setup.py.
From here on out, you are encouraged (but not required) to use the Makefile. Run make help to see all the options available to you.
> make test
package provides a complete working test environment environment for your package. It even provides one test. This test is a FAILING test! It tests to see if your new Python module will import cleanly. But it won’t. It will, in fact, raise an exception telling you that your module has not yet been implemented.
Fix your module, write more tests, finish your module.
> make upload
Ship your new package to PyPI!
This package package package package has been around for year now. Let’s call it Beta.
I am using this software for all my projects on PyPI. I do most of my development on Ubuntu Linux using Python 2.6.6.
I would love to talk to you about your experience in using this software. Feel free to hunt me down on the net…
package is Copyright (c) 2010, 2011, Ingy dot Net
package is licensed under the New BSD License. See the LICENSE file.