This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description

Python package distcontrib contributes utility functions to Distutils, extending its functionalities, like integration with Cython build and a launcher for doctest.

The primary reason for the existence of distcontrib is making life a lot easier when you write for your projects. You can create a template file and simply copy it to all new or existing projects you have, without any modification, in most situations. Under the covers, distcontrib finds several bits and pieces about your project and automagically configures itself so that you don’t have to adjust your file every time you create a new project.

See also: distcontrib-migrate


This is an example of how your would look like:

#!/usr/bin/env python

from setuptools import find_packages
from distutils.core import setup
from Cython.Distutils import build_ext as cython_build
import distcontrib as du

# This block contains settings you will eventually need to change

import myapp as myapp   #--- adjust to your package name

PACKAGE      = myapp.pkg_name
VERSION      = myapp.pkg_version
DESCRIPTION  = myapp.pkg_description
LICENSE      = myapp.pkg_license
URL          = myapp.pkg_url
AUTHOR       = myapp.pkg_author
AUTHOR_EMAIL = myapp.pkg_email
KEYWORDS     = myapp.pkg_keywords
REQUIREMENTS = myapp.pkg_requirements
CLASSIFIERS      = [ 'License :: ' + LICENSE,
                     'Operating System :: OS Independent',
                     'Programming Language :: Python',
                     'Programming Language :: Cython',
                     'Development Status :: 3 - Alpha',
                     'Intended Audience :: Developers',
                     'Environment :: Console' ]

# From this point on, it's unlikely you will be changing anything.

PACKAGES      = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"])

    cmdclass={ 'build_ext' : cython_build,
               'doctest'   : du.doctest,
               'zap'       : du.zap, },

Then create under your myapp/ file something like this:

#!/usr/bin/env python

pkg_name         = __name__ if __package__ is None else __package__
pkg_description  = 'This application does everything you can imagine'
pkg_version      = '0.1.0'
pkg_license      = 'OSI Approved :: BSD License'
pkg_url          = 'http://' + pkg_name + ''
pkg_author       = 'Richard Gomes'
pkg_email        = ''
pkg_keywords     = [ 'artificial','intelligence','magic','sorcery','voodoo' ]
pkg_requirements = [ 'lxml', 'sqlalchemy' ]

Then you can do enter from command line:

$ python zap        # clean on steroids
$ python doctest    # run your doctests
$ python build_ext  # build with Cython

Command zap cleans a lot more stuff than command clean does, being ideal as a step before committing changes to the source control or creating a backup copy of your working folder.

Command doctest runs all doctests, from all your packages. If you find that thre are doctests not being run, please make sure you have created files in all packages.

Special cases

In certain circumstances, you may have to guarantee that your installs a minumun set of essential requirements which, if not installed, may prevent your from running properly. By borrowing function install_requirements from package distcontrib.bootstrap and calling it on the top of your, you can install these essential requirements, as shown below:

#!/usr/bin/env python

ESSENTIAL = [ 'distribute', 'version', 'Cython', 'distcontrib', 'distcontrib-migrate' ]

# This function was copied verbatim from distcontrib.bootstrap
# In certain situations, you are not sure if distcontrib is installed, then
# makes sense to have this function straight on the top of your
def install_requirements(requirements, verbose=True):
    import os, pip
    pip_args = list()
    if verbose:
        print('Installing requirements: ' + str(requirements))
        pip_args.append( '--verbose' )
    proxy = os.environ['http_proxy']
    if proxy:
        if verbose:
            print('http_proxy=' + proxy)
    for req in requirements:
        pip_args.append( req )
    pip.main(initial_args = pip_args)

    from setuptools import find_packages
    from distutils.core import setup
    from Cython.Distutils import build_ext as cython_build
    import distcontrib as du
    import distcontrib_migrate as dm
    #-- import distcontrib.bootstrap
    #-- distcontrib.bootstrap.install_requirements( ESSENTIAL )
    install_requirements( ESSENTIAL )

    # do it again
    from setuptools import find_packages
    from distutils.core import setup
    from Cython.Distutils import build_ext as cython_build
    import distcontrib as du
    import distcontrib_migrate as dm

... the rest of your comes here
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
distcontrib-0.1.0.tar.gz (7.7 kB) Copy SHA256 Checksum SHA256 Source Aug 5, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting