Skip to content


Subversion checkout URL

You can clone with
Download ZIP
produce Debian packages from Python packages
Python Shell Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


stdeb - Python to Debian source package conversion utility

stdeb_ ("setuptools debian") produces Debian source packages from
Python packages via a new distutils command, ``sdist_dsc``. Automatic
defaults are provided for the Debian package, but many aspects of the
resulting package can be customized via a configuration file.

.. _stdeb:


 * 2007-04-02: Version 0.2.a1 Released. See the `download page`_. This version uses python-central_ by default. See the `Changelog for 0.2.a1`_
 * 2006-06-19: Version 0.1 Released. See the `download page`_.

.. _Changelog for 0.2.a1:


All methods eventually result in a call to the ``sdist_dsc`` distutils
command. You may prefer to do so directly::

  python -c "import stdeb; execfile('')" sdist_dsc

Alternatively, two scripts are provided::

  stdeb_run_setup [options] # calls "python sdist_dsc [options]"

  py2dsc [options] mypackage-0.1.tar.gz # uses pre-built Python source package

In all cases, a Debian source package is produced from unmodified
Python packages. The following files are produced in a newly created
subdirectory ``deb_dist``:

 * ``packagename_versionname.orig.tar.gz``
 * ``packagename_versionname-debianversion.dsc``
 * ``packagename_versionname-debianversion.diff.gz``

These can then be compiled into binary packages using the standard
Debian machinery (e.g. dpkg-buildpackage).

A complete example

The following will generate a directory ``bzr-0.16/deb_dist``
containing the files ``bzr_0.16.0-1.diff.gz``, ``bzr_0.16.0-1.dsc``
and ``bzr_0.16.0.orig.tar.gz``, which, together, are a debian source

  tar xzf bzr-0.16.tar.gz
  cd bzr-0.16/
  python -c "import stdeb; execfile('')" sdist_dsc

The source generated in the above way is also extracted (using
``dpkg-source -x``) and placed in the ``deb_dist`` subdirectory. To
continue the example above::

  cd deb_dist/bzr-0.16.0
  dpkg-buildpackage -rfakeroot -uc -us

Finally, the generated package can be installed:: 

  cd ..
  sudo dpkg -i python-bzr_0.16.0-1_all.deb


Files are available at the `download page`_.

.. _download page:

The subversion repository is available at


For the average Python package, its source distribution
(python_package.tar.gz created with ``python sdist``)
contains nearly everything necessary to make a Debian source
package. This near-equivalence encouraged me to write this distutils
extension, which executes the file to extract relevant
information. This process is made significantly easier through the use
of setuptools_.

.. _setuptools:

setuptools is used because of some nice features.  For example,
setuptools makes the job of "Debianizing" python console and gui
scripts much easier.

I wrote this initially to Debianize several Python packages of my own,
but I have the feeling it could be generally useful. It appears
similar, at least in theory, to easydeb_, `Logilab's Devtools`_, and

.. _easydeb:
.. _Logilab's DevTools:
.. _bdist_dpkg:


 * Python_ 2.3 or greater
 * setuptools_
 * subprocess.py_ (included with Python 2.4, backwards compatible with Python 2.3)

.. _Python:

Customizing the produced Debian source package

stdeb will attempt to provide reasonable defaults, but these are only

To customize the Debian source package produced, you may write config
files of the format understood by ConfigParser_. When building each
package, stdeb looks for the existance of a ``stdeb.cfg`` file in the
``.egg-info`` directory. You may specify an additional config file
with the command-line option --extra-cfg-file.

.. _ConfigParser:

For an example configuration file I use to build several packages,
please see

Using stdeb on stdeb

There is a chicken-and-egg problem when trying to make a Debian
package of stdeb with stdeb. Here's a recipe to avoid it::

 # in the stdeb distribution directory (with
 python sdist
 python build
 PYTHONPATH="build/lib" python stdeb/ dist/stdeb-VERSION.tar.gz


* Make output meet `Debian Python Policy`_ specifications or the `new
  python policy`_. This will include several things, including:

  - the ability to make custom changelogs
  - the ability to patch upstream source (added in 0.2.a1 release)
  - the ability to include project-supplied documentation (including
    license information) as a -doc package
  - the ability to include project-supplied examples, tests, and data
    as a separate package
  - much more not listed

* Support python-central_ and/or python-support. (added in 0.2.a1 release)

* Create (better) documentation

* Log output using standard distutils mechanisms

* Refactor the source code to have a simpler, more sane design

.. _debian python policy:
.. _new python policy:
.. _python-central:

Call for volunteers

I don't have a lot of time for this. This project stands a very real
chance of being only a shadow of its potential self unless people step
up and contribute. There are numerous ways in which people could
help. In particular, I'd be interested in finding a co-maintainer or
maintainer if the project generates any interest. Secondarily, I would
appreciate advice from Debian developers or Ubuntu MOTUs about the
arcane details of Python packaging.

Mailing list

Please address all questions to the distutils-SIG_

.. _distutils-SIG:


MIT-style license. Copyright (c) 2006 stdeb authors. 

See the LICENSE.txt file provided with the source distribution for
full details.


Andrew Straw <>, California Institute of

Additional Credits

* WebFaction_ (aka `python-hosting`_) for hosting services.

.. _WebFaction:
.. _python-hosting:
Something went wrong with that request. Please try again.