Stdeb
produce Debian packages from Python packages
Install / Use
/learn @stdeb/StdebREADME
.. image:: https://github.com/astraw/stdeb/actions/workflows/ci.yaml/badge.svg :target: https://github.com/astraw/stdeb/actions/workflows/ci.yaml
stdeb - Python to Debian source package conversion utility
stdeb <http://github.com/astraw/stdeb>_ 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 (see the
customizing section, below). An additional command, bdist_deb,
creates a Debian binary package, a .deb file. The install_deb
command installs this .deb file. The debianize command builds a
debian/ directory directly alongside your setup.py.
Several convenience utilities are also provided:
pypi-downloadwill query thePython Package Index (PyPI) <http://pypi.python.org/>_ for a package and download it.pypi-installwill query thePython Package Index (PyPI) <http://pypi.python.org/>_ for a package, download it, create a .deb from it, and then install the .deb.py2dscwill convert a distutils-built source tarball into a Debian source package.py2dsc-debwill convert a distutils-built source tarball into a Debian source package and then use the Debian machinery to build a .deb file from this.
.. contents::
Python 3 support
As explained in more detail below, the heart of stdeb is the sdist_dsc
distutils command. This command runs once to generate a Debian source
package. This Debian source package can specify building packages for
Python 2, Python 3, or both. Furthermore, this generation can be done
with the Python 2 or Python 3 interpreter. By default, only packages
are built for the version of Python being used. To override this, use
--with-python2=True or --with-python3=True as an argument to
the sdist_dsc distutils command (or use both to be sure). For example,
to build only a Python 3 package using the Python 3 interpreter::
python3 setup.py --command-packages=stdeb.command bdist_deb
To build both Python 2 and Python 3 packages using the Python 3 interpreter (and only the Python3 package installs scripts)::
python3 setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True --with-python3=True --no-python2-scripts=True bdist_deb
News
-
2025-09-12: Version 0.11.0. See the
download page <https://pypi.python.org/pypi/stdeb/0.11.0>__. -
Breaking changes:
- Remove support for running stdeb using Python 2. stdeb scripts are now only expected to run using Python 3. It may be possible to create Python 2 packages using stdeb from Python 3 but this is not well tested. The new minimum Python version is 3.7 and this will be raised periodically in the future. The goal is to support the latest Python 3 releases in Debian Unstable and Testing back to the current oldoldstable.
- Minimum debhelper version has been raised to 12. Packages are now built using pybuild instead of of python_distutils. The minimum debhelper version will be raised periodically in order to support changes to packaging infrastructure but we will try not to raise it above the current oldoldstable version.
-
New features:
- Add ``Dh-python3-params``` config setting to stdeb.cfg. The value of this setting will be passed to dh_python3 in the debian/rules file and can be used for specifying options that are not otherwise configurable.
-
2025-07-31: Version 0.10.2. See the
download page <https://pypi.python.org/pypi/stdeb/0.10.2>__. This is a bugfix release for 0.10.1 which fixes a regression. -
Bugfixes:
- Add a shim function for which on python2. (#215)
- Fixes a regression introduced in #203.
- Add a shim function for which on python2. (#215)
-
2024-11-14: Version 0.10.1. See the
download page <https://pypi.python.org/pypi/stdeb/0.10.1>__. This is the last planned release of stdeb which supports running stdeb scripts with Python 2.7. Generating Python 2 packages with future releases will be maintained on a best-effort basis. Users of stdeb's Python 2 support are encouraged to report issues and provide test cases which can be added to CI. -
Bugfixes:
- Fix udev rule filenames for automatic dh_installudev recognition. (#180)
-
Improvements:
-
The
--sign-keyargument can now be used to provide an alternative key rather than always signing with the default key. (#187) -
Switch PyPI API usage to JSON and "Simple" APIs now that the XML-RPC API is deprecated. (#201, #202)
-
Detect and use the current binary name for Python 2. (#203) Ubuntu Focal and Ubuntu Jammy install a
python2binary when thepython-all-devpackage is installed. Rather than assuming that thepythonbinary is available and is Python 2, check for apythonorpython2binary and use what is found.
-
-
Development changes:
- Continuous Integration is now run on GitHub Actions using Earthly. (#199)
- Use ruff for style and lint checks (currently not enforced). (#199)
-
2020-10-28: Version 0.10.0. See the
download page <https://pypi.python.org/pypi/stdeb/0.10.0>__. -
Bugfixes:
- add sleep between PyPI API calls to avoid rate limit (#173)
-
Improvements:
- use SOURCE_DATE_EPOCH if set for timestamp in generated changelog to generate reproducbile artifacts (#166)
- update debhelper compat version from 7 to 9 (#158)
- added flag --with-dh-systemd (#162)
- add support for DEBEMAIL envvar (#168)
- use setuptools "url" field for "Homepage" field in debian/control (#169)
- dh_virtualenv: specify Python version (#165)
- added compat flag to modify Debian compatibility level (#163)
-
Cosmetic:
- remove excess newlines from debian/control and rules file (#167)
- use flake8 to check style in Travis CI, update code to comply (#171)
-
2020-06-11: Version 0.9.1. See the
download page <https://pypi.python.org/pypi/stdeb/0.9.1>__. -
Bugfixes:
- handle path with spaces in zip tarball (#150)
- fix map() iterator issue in Python 3 (#152)
- fix checking for python3-all (instead of python-all) when using only Python 3 (#154)
-
Improvements:
- get date in Python, avoiding requiring
dateon macOS (#115) - add configuration file option
Python2-Depends-Name(#156) - add an option
--with-dh-virtualenv(#155) - add an option named
ignore-source-changes(#151)
- get date in Python, avoiding requiring
-
2019-12-09: Version 0.9.0. See the
download page <https://pypi.python.org/pypi/stdeb/0.9.0>__. -
Bugfixes:
- fix applying patch files under Python 3
-
Improvements:
- add
--sign-resultsto sdist_dsc and bdist_deb command - add
--debian-versionto CLI program options - add support for
Breaks/Breaks3in debian/control - add support for
Suite3option - support zip files in pypi-install
- add
-
Breaking changes:
- remove deprecated
dh_desktopcall
- remove deprecated
-
2015-02-18: Version 0.8.5. See the
download page <https://pypi.python.org/pypi/stdeb/0.8.5>__. Bugfixes: reverted change that installed into virtualenv when built in virtualenv. Improvements: Added--allow-virtualenv-install-locationto allow installing into virtualenv location. Supports Debian Squeeze (6), Debian Wheezy (7), Ubuntu Precise (12.04), Ubuntu Trusty (14.04) and later releases. -
2015-02-16: Version 0.8.4. See the
download page <https://pypi.python.org/pypi/stdeb/0.8.4>__. Bugfixes: works on Python 3.4 (e.g. Ubuntu Trusty) again. Improvements: Improved customization for Python 3 (Dirk Thomas addedforce-x-python3-versionandX-Python3-Versionand Louis forRecommends3,Suggests3,Provides3andReplaces3support. Supports Debian Squeeze (6), Debian Wheezy (7), Ubuntu Precise (12.04), Ubuntu Trusty (14.04) and later releases. -
2015-02-14: Version 0.8.3. See the
download page <https://pypi.python.org/pypi/stdeb/0.8.3>__. This is a bugfix release which fixes several aspects of Unicode support. Tests pass on Debian Squeeze (6), Debian Wheezy (7), and Ubuntu Precise (12.04). Support for Python 3.4 (e.g. Ubuntu Trusty 14.04) was mistakenly broken and was fixed in the 0.8.3 release. -
2014-8-14: Version 0.8.2. See the
download page <https://pypi.python.org/pypi/stdeb/0.8.2>__. This is a bugfix release fixing a serious issue that would cause a Python 2 package to be built if only a Python 3 package was requested in some circumstances. -
2014-8-10: Version 0.8.1. See the
download page <https://pypi.python.org/pypi/stdeb/0.8.1>__. Due to bugs in 0.8.0, this release is the first announced from the 0.8 series. Highlights since 0.7.1:-
Full support for Python 3. This includes being run from Python 3 and generating packages for Python 3. The default is to build Python 3 packages when run with Python 3 and to build Python 2 packages when run from Python 2. Command line options can be used to build packages for the other Python interpreter, too.
-
Build .changes file for source package. While this still must be signed for upload to a PPA, for example, it should still be useful in some cases.
-
Switch to Debian source format 3.0 (quilt). Practically speaking, the .diff.gz file that used to come with a source package is now replaced by a .debian.tar.gz file.
-
Verify SSL certificates when talking to PyPI using Requests. (Verification requires Requests >= 0.8.8.)
-
Many bugfixes.
-
-
2014-05-05: Version 0.7.1. See the
download page <https://pypi.python.org/pypi/stdeb/0.7.1>__. Highlights for this release (you may also wish to consult the full `changelog <http://github.com/astraw/stdeb/blob/rel
