{"id":6895,"library":"stdeb","title":"stdeb","description":"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.","status":"active","version":"0.11.0","language":"python","source_language":"en","source_url":"https://github.com/astraw/stdeb","tags":["debian","packaging","distutils","py2deb","distribution","apt"],"install":[{"cmd":"pip install stdeb","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core dependency for Debian packaging utilities.","package":"python-debian","optional":false},{"reason":"Used in the Python packaging ecosystem for building wheels, which can interact with distutils/setuptools build processes.","package":"wheel","optional":false},{"reason":"While stdeb removed a direct dependency in older versions, it primarily works by extending distutils commands via setup.py, for which setuptools is the de facto standard and provides a distutils shim in Python 3.12+.","package":"setuptools","optional":false}],"imports":[{"note":"stdeb is primarily used via distutils commands specified on the command line, rather than direct Python imports in user code.","symbol":"stdeb.command","correct":"python setup.py --command-packages=stdeb.command <command>"},{"note":"Command-line utility for quick installation from PyPI to a .deb. Use with caution (see warnings).","symbol":"pypi-install","correct":"pypi-install mypackage"}],"quickstart":{"code":"mkdir my_python_project\ncd my_python_project\n\n# Create a dummy setup.py\ncat <<EOF > setup.py\nfrom setuptools import setup, find_packages\n\nsetup(\n    name='my-sample-package',\n    version='0.1.0',\n    packages=find_packages(),\n    scripts=['my_script.py'],\n    description='A simple test package for stdeb.',\n    author='Example User',\n    author_email='user@example.com',\n    install_requires=[],\n)\nEOF\n\n# Create a dummy script\nmkdir my_sample_package\ncat <<EOF > my_sample_package/__init__.py\nEOF\ncat <<EOF > my_sample_package/my_script.py\nimport sys\n\ndef main():\n    print(\"Hello from my_sample_package!\")\n    print(f\"Running with Python {sys.version_info.major}.{sys.version_info.minor}\")\n\nif __name__ == '__main__':\n    main()\nEOF\n\n# Generate a Debian binary package (.deb)\npython3 setup.py --command-packages=stdeb.command bdist_deb\n\necho \"\\nGenerated .deb file(s) in:\"\nls deb_dist/*.deb\n","lang":"bash","description":"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."},"warnings":[{"fix":"Ensure you are running stdeb with Python 3.7+ and have `debhelper` version 12+ installed on your system. If generating Python 2 packages, older stdeb versions (0.10.x and below) might still work on a best-effort basis.","message":"stdeb has removed support for Python 2.x and now requires Python 3.7 or newer. Additionally, it requires a minimum `debhelper` version of 12 for building Debian packages.","severity":"breaking","affected_versions":"0.11.0+"},{"fix":"For production or customized packages, use the `sdist_dsc` or `bdist_deb` distutils commands (e.g., `python setup.py --command-packages=stdeb.command bdist_deb`) and manually verify/customize the generated `debian/` directory.","message":"The `pypi-install` command-line utility provides a quick way to convert and install a PyPI package as a `.deb`, but it does not guarantee proper fulfillment of all Debian package dependencies and bypasses customization options. Manual intervention for dependencies is frequently required.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Build your `.deb` packages on the exact target distribution and version where they will be installed, or target a stable/oldstable Debian distribution for wider compatibility.","message":"Debian packages generated by `stdeb` (especially those with extension modules) are highly sensitive to the build environment. Installing a `.deb` on a different Debian/Ubuntu version than where it was compiled can lead to undefined behavior or breakages.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `setuptools` is installed and up-to-date in your environment. Be aware that the Python packaging ecosystem is evolving beyond `distutils`/`setup.py` towards `pyproject.toml` and other build backends. Monitor stdeb's official channels for updates regarding modern packaging standards.","message":"stdeb relies on extending `distutils` commands via `setup.py`. With Python 3.12+, `distutils` was removed from the standard library. While `setuptools` provides a compatibility shim, direct reliance on `distutils` might lead to future compatibility issues or require specific `setuptools` versions.","severity":"breaking","affected_versions":"Potentially Python 3.12+"},{"fix":"After running `debianize`, inspect and modify `debian/control` to ensure all build dependencies (especially `python3-all`, `dh-python`, and any other required system libraries or Python packages) are correctly listed.","message":"When using the `debianize` command (or `bdist_deb`), `stdeb` generates a `debian/` directory. The `Build-Depends` in the resulting `debian/control` file often requires manual review and adjustment to correctly specify all necessary system-level and Python package build dependencies.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Before using `stdeb`, ensure you install necessary system packages: `sudo apt-get install python3-all debhelper dh-python` (or equivalent for your distribution).","message":"System-level packages like `python3-all` (for Python 3 projects) and `dh-python` are often crucial runtime or build dependencies for `stdeb` to function correctly, but might not be explicitly pulled in by `pip install stdeb` alone. Missing these can lead to cryptic build failures.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'0.11.0':76 '2025':80 'activ':82 'apt':95 'aspect':54 'attempt':48 'autom':42 'bdist':29 'cadenc':73 'command':25,33 'command-lin':32 'configur':65 'continu':81 'convers':44 'creation':13 'custom':62 'deb':30 'debian':15,58,90 'default':52 'develop':83 'distribut':94 'distutil':9,24,92 'dsc':28 'extend':8 'file':66 'instal':39 'librari':68 'like':26,36 'line':34 'maintain':69 'mani':53 'modern':87 'new':23 'packag':17,20,59,91 'process':45 'provid':22,50 'py2deb':93 'py2dsc':40 'pypi':38 'pypi-instal':37 'python':5,19,88 'regular':71 'releas':72,77 'result':57 'sdist':27 'sensibl':51 'septemb':79 'simplifi':11 'sourc':16 'stdeb':1,2 'support':85 'util':6,35 'version':75,89 'via':63","created_at":"2026-04-15T18:47:38.354242+00:00","updated_at":"2026-04-16T22:23:20.496148+00:00","problems":{"verify_error":"no import statement found"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.11.0","cli_name":"py2dsc","cli_version":"Traceback (most recent call last):","type":"library","homepage":null,"github":"http://github.com/astraw/stdeb","docs":null,"changelog":null,"pypi":"https://pypi.org/project/stdeb/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"skip","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-05","install_tag":null}}