Skip to content

Instantly share code, notes, and snippets.

@optilude
Created December 28, 2011 11:20
Show Gist options
  • Save optilude/1527606 to your computer and use it in GitHub Desktop.
Save optilude/1527606 to your computer and use it in GitHub Desktop.
Basic Python package in virtualenv
$ easy_install -U virtualenv
# Create a sandbox
$ virtualenv --no-site-packages myenv
$ cd myenv
# Install Paste Script
$ bin/pip install PasteScript
$ bin/paster create --list-templates
Available templates:
basic_package: A basic setuptools-enabled package
paste_deploy: A web application deployed through paste.deploy
# Create a package
$ bin/paster create -t basic_package mypackage
Selected and implied templates:
PasteScript#basic_package A basic setuptools-enabled package
Variables:
egg: mypackage
package: mypackage
project: mypackage
Enter version (Version (like 0.1)) ['']:
Enter description (One-line description of the package) ['']:
Enter long_description (Multi-line description (in reST)) ['']:
Enter keywords (Space-separated keywords/tags) ['']:
Enter author (Author name) ['']:
Enter author_email (Author email) ['']:
Enter url (URL of homepage) ['']:
Enter license_name (License name) ['']:
Enter zip_safe (True/False: if the package can be distributed as a .zip file) [False]:
Creating template basic_package
Creating directory ./mypackage
Recursing into +package+
Creating ./mypackage/mypackage/
Copying __init__.py to ./mypackage/mypackage/__init__.py
Copying setup.cfg to ./mypackage/setup.cfg
Copying setup.py_tmpl to ./mypackage/setup.py
Running /Users/optilude/tmp/myenv/bin/python setup.py egg_info
$ ls mypackage
mypackage mypackage.egg-info setup.cfg setup.py
# Create a repository
$ cd mypackage
$ git init .
# Install nose - see http://readthedocs.org/docs/nose/en/latest/
$ bin/pip install nose
$ bin/nosetests --help
# Install jarn.mkrelease
$ bin/pip install jarn.mkrelease
# Release
$ bin/mkrelease --dry-run -d pypi mypackage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment