stdeb

0.11.0 · active · verified Wed Apr 15

stdeb is a Python utility that extends distutils to simplify the creation of Debian source packages from Python packages. It provides new distutils commands (like `sdist_dsc`, `bdist_deb`) and command-line utilities (like `pypi-install`, `py2dsc`) to automate the conversion process. While it attempts to provide sensible defaults, many aspects of the resulting Debian package can be customized via a configuration file. The library maintains a regular release cadence, with version 0.11.0 released in September 2025, continuing active development and support for modern Python versions.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a simple Python project with a `setup.py` file and then use `stdeb` to generate a Debian binary package (`.deb`). The resulting `.deb` file will be found in the `deb_dist` directory. This is the recommended approach for creating distributable packages, rather than using `pypi-install` directly.

mkdir my_python_project
cd my_python_project

# Create a dummy setup.py
cat <<EOF > setup.py
from setuptools import setup, find_packages

setup(
    name='my-sample-package',
    version='0.1.0',
    packages=find_packages(),
    scripts=['my_script.py'],
    description='A simple test package for stdeb.',
    author='Example User',
    author_email='user@example.com',
    install_requires=[],
)
EOF

# Create a dummy script
mkdir my_sample_package
cat <<EOF > my_sample_package/__init__.py
EOF
cat <<EOF > my_sample_package/my_script.py
import sys

def main():
    print("Hello from my_sample_package!")
    print(f"Running with Python {sys.version_info.major}.{sys.version_info.minor}")

if __name__ == '__main__':
    main()
EOF

# Generate a Debian binary package (.deb)
python3 setup.py --command-packages=stdeb.command bdist_deb

echo "\nGenerated .deb file(s) in:"
ls deb_dist/*.deb

view raw JSON →