{"id":21112,"library":"deb-pkg-tools","title":"deb-pkg-tools","description":"A Python library for creating, inspecting, and manipulating Debian packages (.deb files). Version 8.4 is stable, with infrequent releases focused on maintenance.","status":"active","version":"8.4","language":"python","source_language":"en","source_url":"https://github.com/...","tags":["debian","package",".deb","deb-pkg-tools","packaging"],"install":[{"cmd":"pip install deb-pkg-tools","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"DebPackage is in submodule deb_pkg_tools.package, not top-level.","wrong":"from deb_pkg_tools import DebPackage","symbol":"DebPackage","correct":"from deb_pkg_tools.package import DebPackage"}],"quickstart":{"code":"from deb_pkg_tools.package import DebPackage\n\n# Load an existing .deb file\npkg = DebPackage('path/to/package.deb')\nprint(pkg.name, pkg.version)\n\n# Create a new basic package\ncontrol = {\n    'Package': 'example',\n    'Version': '1.0',\n    'Architecture': 'all',\n    'Maintainer': 'Example <example@example.com>',\n    'Description': 'An example package'\n}\nnew_pkg = DebPackage(control=control)\nnew_pkg.write('example_1.0_all.deb')","lang":"python","description":"Basic usage: inspect an existing .deb or create a new one from a control dictionary."},"warnings":[{"fix":"Use DebPackage(control=control) instead of DebPackage(control).","message":"Version 8 changed the API: DebPackage constructor now requires keyword arguments (e.g., control=) instead of positional.","severity":"breaking","affected_versions":">=8.0,<9.0"},{"fix":"Use pkg.name, pkg.version, etc. For raw control data, use pkg._control_data (private).","message":"When reading a .deb file, the control data is accessed via attributes (pkg.name) and not via a dictionary. Mixing up with DebPackage.control (the dict used at creation) can cause confusion.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace with DebPackage.from_control_file(control_path) if you have a control file.","message":"The function deb_pkg_tools.utils.read_control_file is deprecated in favour of DebPackage.from_control_file or the package constructor.","severity":"deprecated","affected_versions":">=7.0,<9.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: from deb_pkg_tools.package import DebPackage","cause":"Trying to import DebPackage from the top-level deb_pkg_tools package, but it resides in the submodule deb_pkg_tools.package.","error":"ImportError: cannot import name 'DebPackage' from 'deb_pkg_tools'"},{"fix":"Use DebPackage(control=control) or DebPackage(path='path/to.deb')","cause":"Attempting to pass a control dictionary as a positional argument. In version 8, the constructor expects keyword arguments.","error":"TypeError: DebPackage() takes 1 positional argument but 2 were given"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}