DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Python Development Workflow


Based on http://www.jeffknupp.com/blog/2013/08/16/open-sourcing-a-python-project-the-right-way/

Workflow

The first release(v0.1): see Publish and Install Applications via PyPI for how to commit to PyPI;

After uploading your first release to PyPI, the basic workflow is:

  1. Do some work on your package (i.e. fix bugs, add features, etc);

  2. Make sure the tests pass;

  3. "Freeze" your code by creating a release branch in git-flow;

  4. Update the version number in your package's init.py file;

  5. Run "python setup.py sdist upload" to upload the new version of your package to PyPI;

For usage of git-flow, see note "git-flow Notes".

virtualenv and virtualenvwrapper

See Note about virturalenvwrapper.

Publish a Python Application

Add a "command_line.py" in module, and "entry_points" in setup.py. See the 4th step "Command Line Scripts" in How To Package Your Python Code for details.

Necessary Files

setup.py

Some necessary parameters:

  • entry_points: for defind executables;

  • install_requires: for defining dependencies, get this from "pip freeze" command (exculde the application itself);

MANIFEST.in

Add "inculde README.md" (and other necessary files for installation) in this file, or README.md will note be packaged into installer, and in installation a "README.md not found" error raises because you read this file in setup.py. (see https://wiki.python.org/moin/Distutils/Tutorial for explanation)

All available classifiers

https://pypi.python.org/pypi?%3Aaction=list_classifiers

Create requirements automatically

$ pip freeze > requirements.txt


Published

Jan 9, 2014

Last Updated

Jan 9, 2014

Category

Tech

Tags

  • git-flow 2
  • PyPI 2
  • Python 136
  • workflow 3

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor