As an example, let’s create a Python package. The Projy template mostly follows recommandations from The Hitchhiker’s Guide to Packaging.
Use simply:
$ projy PythonPackage TowelStuff
In the same directory as you typed this command, you now have a TowelStuff directory, with the following structure:
TowelStuff/
bin/
bootstrap
CHANGES.txt
docs/
index.rst
LICENSE.txt
MANIFEST.in
README.txt
setup.py
towelstuff/
__init__.py
Each file has been created with a specific template, so the package is fully functional, yet empty. Now, let’s give a little explanation on each file. You can find further information here.
See the links for more information.
This file is a little treat, not present in The Hitchhiker’s Guide to Packaging. Using the BootstrapScriptFileTemplate template, it is a simple bash file creating a virtual environment easily. Use it with a simple:
$ source bootstrap
Everything you need to write quality code :-) Of course, you can add any other package you may need, it’s up to you. You can even externalize this list of package to a requirement file.
The template of the CHANGES.txt file simply contains:
v<version>, <date> -- Initial release.
By default, the Python package template contains the GPL v3 as LICENSE.txt. Change it as your convenience.
The manifest is an important file that contains this:
include CHANGES.txt
include LICENSE.txt
include MANIFEST.in
include README.txt
recursive-include bin *
recursive-include docs *
recursive-include towelstuff *
The usual README file, written in reStructuredText format.
The setup.py file created from the template contains:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # -*- coding: utf-8 -*-
""" $project setup.py script """
# system
from distutils.core import setup
from os.path import join, dirname
setup(
name='TowelStuff',
version='0.1.0',
author='Stéphane Péchard',
author_email='stephanepechard@provider.com',
packages=['towelstuff','towelstuff.test'],
url='http://',
license='LICENSE.txt',
long_description=open(join(dirname(__file__), 'README.txt')).read(),
install_requires=[''],
test_suite='towelstuff.test',
)
|