{
    "content": [
        {
            "type": "text",
            "text": "# apt (pydoc)\n\n## TLDR\n\n> Package manager for Debian-based distributions.\n\n- Update the list of available packages and versions (recommended before running other `apt` commands):\n  `sudo apt update`\n- Search packages by name or description:\n  `apt search {{package}}`\n- Search packages by name only (supports wildcards like `*`):\n  `apt list {{package}}`\n- Show detailed information about a package:\n  `apt show {{package}}`\n- Install a package, or update it to the latest version:\n  `sudo apt install {{package}}`\n- Remove a package (use `purge` instead to also remove configuration files):\n  `sudo apt remove {{package}}`\n- Upgrade all installed packages to their latest versions:\n  `sudo apt upgrade`\n- List all installed packages:\n  `apt list {{-i|--installed}}`\n\n*Source: tldr-pages*\n\n---\n\n**Summary:** apt - High-Level Interface for working with apt.\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **PACKAGE CONTENTS** (8 lines)\n- **CLASSES** (6 lines) — 3 subsections\n  - class Cache (240 lines)\n  - class Cdrom (54 lines)\n  - class Package (207 lines)\n- **DATA** (2 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\napt - High-Level Interface for working with apt.\n\n### PACKAGE CONTENTS\n\nauth\ncache\ncdrom\ndebfile\npackage\nprogress (package)\nutils\n\n### CLASSES\n\naptpkg.Cdrom(builtins.object)\napt.cdrom.Cdrom\nbuiltins.object\napt.cache.Cache\napt.package.Package\n\n#### class Cache\n\n|  Cache(progress=None, rootdir=None, memonly=False)\n|\n|  Dictionary-like package cache.\n|\n|  The APT cache file contains a hash table mapping names of binary\n|  packages to their metadata. A Cache object is the in-core\n|  representation of the same. It provides access to APTs idea of the\n|  list of available packages.\n|\n|  The cache can be used like a mapping from package names to Package\n|  objects (although only getting items is supported).\n|\n|  Keyword arguments:\n|  progress -- a OpProgress object,\n|  rootdir  -- an alternative root directory. if that is given the system\n|  sources.list and system lists/files are not read, only file relative\n|  to the given rootdir,\n|  memonly  -- build the cache in memory only.\n|\n|\n|  .. versionchanged:: 1.0\n|\n|      The cache now supports package names with special architecture\n|      qualifiers such as :all and :native. It does not export them\n|      in :meth:`keys()`, though, to keep :meth:`keys()` a unique set.\n|\n|  Methods defined here:\n|\n|  contains(self, key)\n|\n|  enter(self)\n|      Enter the with statement\n|\n|  exit(self, exctype, excvalue, traceback)\n|      Exit the with statement\n|\n|  getitem(self, key)\n|      look like a dictionary (get key)\n|\n|  init(self, progress=None, rootdir=None, memonly=False)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  iter(self)\n|\n|  len(self)\n|\n|  actiongroup(self)\n|      Return an `ActionGroup` object for the current cache.\n|\n|      Action groups can be used to speedup actions. The action group is\n|      active as soon as it is created, and disabled when the object is\n|      deleted or when release() is called.\n|\n|      You can use the action group as a context manager, this is the\n|      recommended way::\n|\n|          with cache.actiongroup():\n|              for package in myselectedpackages:\n|                  package.markinstall()\n|\n|      This way, the action group is automatically released as soon as the\n|      with statement block is left. It also has the benefit of making it\n|      clear which parts of the code run with a action group and which\n|      don't.\n|\n|  cachepostchange(self)\n|      called internally if the cache has changed, emit a signal then\n|\n|  cacheprechange(self)\n|      called internally if the cache is about to change, emit\n|      a signal then\n|\n|  clear(self)\n|      Unmark all changes\n|\n|  close(self)\n|      Close the package cache\n|\n|  commit(self, fetchprogress=None, installprogress=None, allowunauthenticated=None)\n|      Apply the marked changes to the cache.\n|\n|      The first parameter, *fetchprogress*, refers to a FetchProgress()\n|      object as found in apt.progress, the default being\n|      apt.progress.FetchProgress().\n|\n|      The second parameter, *installprogress*, is a\n|      apt.progress.InstallProgress() object.\n|\n|      The keyword-only parameter *allowunauthenticated* specifies whether\n|      to allow unauthenticated downloads. If not specified, it defaults to\n|      the configuration option `APT::Get::AllowUnauthenticated`.\n|\n|  connect(self, name, callback)\n|      Connect to a signal.\n|\n|      .. deprecated:: 1.0\n|\n|          Please use connect2() instead, as this function is very\n|          likely to cause a memory leak.\n|\n|  connect2(self, name, callback, *args, kwds)\n|      Connect to a signal.\n|\n|      The callback will be passed the cache as an argument, and\n|      any arguments passed to this function. Make sure that, if you\n|      pass a method of a class as your callback, your class does not\n|      contain a reference to the cache.\n|\n|      Cyclic references to the cache can cause issues if the Cache object\n|      is replaced by a new one, because the cache keeps a lot of objects and\n|      tens of open file descriptors.\n|\n|      currently only used for cache{post,pre}{changed,open}.\n|\n|      .. versionadded:: 1.0\n|\n|  fetcharchives(self, progress=None, fetcher=None, allowunauthenticated=None)\n|      Fetch the archives for all packages marked for install/upgrade.\n|\n|      You can specify either an :class:`apt.progress.base.AcquireProgress()`\n|      object for the parameter *progress*, or specify an already\n|      existing :class:`aptpkg.Acquire` object for the parameter *fetcher*.\n|\n|      The return value of the function is undefined. If an error occurred,\n|      an exception of type :class:`FetchFailedException` or\n|      :class:`FetchCancelledException` is raised.\n|\n|      The keyword-only parameter *allowunauthenticated* specifies whether\n|      to allow unauthenticated downloads. If not specified, it defaults to\n|      the configuration option `APT::Get::AllowUnauthenticated`.\n|\n|      .. versionadded:: 0.8.0\n|\n|  fixbroken(self)\n|      Fix broken packages.\n|\n|  get(self, key, default=None)\n|      Return *self*[*key*] or *default* if *key* not in *self*.\n|\n|      .. versionadded:: 1.1\n|\n|  getchanges(self)\n|      Get the marked changes\n|\n|  getprovidingpackages(self, pkgname, candidateonly=True, includenonvirtual=False)\n|      Return a list of all packages providing a package.\n|\n|      Return a list of packages which provide the virtual package of the\n|      specified name.\n|\n|      If 'candidateonly' is False, return all packages with at\n|      least one version providing the virtual package. Otherwise,\n|      return only those packages where the candidate version\n|      provides the virtual package.\n|\n|      If 'includenonvirtual' is True then it will search for all\n|      packages providing pkgname, even if pkgname is not itself\n|      a virtual pkg.\n|\n|  haskey(self, key)\n|\n|  installarchives(self, pm, installprogress)\n|      The first parameter *pm* refers to an object returned by\n|      aptpkg.PackageManager().\n|\n|      The second parameter *installprogress* refers to an InstallProgress()\n|      object of the module apt.progress.\n|\n|      This releases a system lock in newer versions, if there is any,\n|      and reestablishes it afterwards.\n|\n|  isvirtualpackage(self, pkgname)\n|      Return whether the package is a virtual package.\n|\n|  keys(self)\n|\n|  open(self, progress=None)\n|      Open the package cache, after that it can be used like\n|      a dictionary\n|\n|  update(self, fetchprogress=None, pulseinterval=0, raiseonerror=True, sourceslist=None)\n|      Run the equivalent of apt-get update.\n|\n|      You probably want to call open() afterwards, in order to utilise the\n|      new cache. Otherwise, the old cache will be used which can lead to\n|      strange bugs.\n|\n|      The first parameter *fetchprogress* may be set to an instance of\n|      apt.progress.FetchProgress, the default is apt.progress.FetchProgress()\n|      .\n|      sourceslist -- Update a alternative sources.list than the default.\n|      Note that the sources.list.d directory is ignored in this case\n|\n|  upgrade(self, distupgrade=False)\n|      Upgrade all packages.\n|\n|      If the parameter *distupgrade* is True, new dependencies will be\n|      installed as well (and conflicting packages may be removed). The\n|      default value is False.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  brokencount\n|      Return the number of packages with broken dependencies.\n|\n|  deletecount\n|      Return the number of packages marked for deletion.\n|\n|  dpkgjournaldirty\n|      Return True if the dpkg was interrupted\n|\n|      All dpkg operations will fail until this is fixed, the action to\n|      fix the system if dpkg got interrupted is to run\n|      'dpkg --configure -a' as root.\n|\n|  installcount\n|      Return the number of packages marked for installation.\n|\n|  keepcount\n|      Return the number of packages marked as keep.\n|\n|  reqreinstallpkgs\n|      Return the packages not downloadable packages in reqreinst state.\n|\n|  requireddownload\n|      Get the size of the packages that are required to download.\n|\n|  requiredspace\n|      Get the size of the additional required space on the fs.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n\n#### class Cdrom\n\n|  Cdrom(progress=None, mountpoint=None, nomount=True)\n|\n|  Support for apt-cdrom like features.\n|\n|  This class has several optional parameters for initialisation, which may\n|  be used to influence the behaviour of the object:\n|\n|  The optional parameter `progress` is a CdromProgress() subclass, which will\n|  ask for the correct cdrom, etc. If not specified or None, a CdromProgress()\n|  object will be used.\n|\n|  The optional parameter `mountpoint` may be used to specify an alternative\n|  mountpoint.\n|\n|  If the optional parameter `nomount` is True, the cdroms will not be\n|  mounted. This is the default behaviour.\n|\n|  Method resolution order:\n|      Cdrom\n|      aptpkg.Cdrom\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, progress=None, mountpoint=None, nomount=True)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  add(self, progress=None)\n|      Add cdrom to the sources.list.\n|\n|  ident(self, progress=None)\n|      Identify the cdrom.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  insourceslist\n|      Check if the cdrom is already in the current sources.list.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from aptpkg.Cdrom:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n\n#### class Package\n\n|  Package(pcache, pkgiter)\n|\n|  Representation of a package in a cache.\n|\n|  This class provides methods and properties for working with a package. It\n|  lets you mark the package for installation, check if it is installed, and\n|  much more.\n|\n|  Methods defined here:\n|\n|  init(self, pcache, pkgiter)\n|      Init the Package object\n|\n|  lt(self, other)\n|      Return self<value.\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  str(self)\n|      Return str(self).\n|\n|  architecture(self)\n|      Return the Architecture of the package.\n|\n|      Note that for Architecture: all packages, this returns the\n|      native architecture, as they are internally treated like native\n|      packages. To get the concrete architecture, look at the\n|      :attr:`Version.architecture` attribute.\n|\n|      .. versionchanged:: 0.7.100.3\n|          This is now the package's architecture in the multi-arch sense,\n|          previously it was the architecture of the candidate version\n|          and deprecated.\n|\n|  commit(self, fprogress, iprogress)\n|      Commit the changes.\n|\n|      The parameter *fprogress* refers to a aptpkg.AcquireProgress() object,\n|      like apt.progress.text.AcquireProgress().\n|\n|      The parameter *iprogress* refers to an InstallProgress() object, as\n|      found in apt.progress.base.\n|\n|  getchangelog(self, uri=None, cancellock=None)\n|      Download the changelog of the package and return it as unicode\n|      string.\n|\n|      The parameter *uri* refers to the uri of the changelog file. It may\n|      contain multiple named variables which will be substitued. These\n|      variables are (srcsection, prefix, srcpkg, srcver). An example is\n|      the Ubuntu changelog::\n|\n|          \"http://changelogs.ubuntu.com/changelogs/pool\" \\\n|              \"/%(srcsection)s/%(prefix)s/%(srcpkg)s\" \\\n|              \"/%(srcpkg)s%(srcver)s/changelog\"\n|\n|      The parameter *cancellock* refers to an instance of threading.Event,\n|      which if set, prevents the download.\n|\n|  markauto(self, auto=True)\n|      Mark a package as automatically installed.\n|\n|      Call this function to mark a package as automatically installed. If the\n|      optional parameter *auto* is set to ``False``, the package will not be\n|      marked as automatically installed anymore. The default is ``True``.\n|\n|  markdelete(self, autofix=True, purge=False)\n|      Mark a package for deletion.\n|\n|      If *autofix* is ``True``, the resolver will be run, trying to fix\n|      broken packages.  This is the default.\n|\n|      If *purge* is ``True``, remove the configuration files of the package\n|      as well.  The default is to keep the configuration.\n|\n|  markinstall(self, autofix=True, autoinst=True, fromuser=True)\n|      Mark a package for install.\n|\n|      If *autoFix* is ``True``, the resolver will be run, trying to fix\n|      broken packages.  This is the default.\n|\n|      If *autoInst* is ``True``, the dependencies of the packages will be\n|      installed automatically.  This is the default.\n|\n|      If *fromUser* is ``True``, this package will not be marked as\n|      automatically installed. This is the default. Set it to False if you\n|      want to be able to automatically remove the package at a later stage\n|      when no other package depends on it.\n|\n|  markkeep(self)\n|      Mark a package for keep.\n|\n|  markupgrade(self, fromuser=True)\n|      Mark a package for upgrade.\n|\n|  ----------------------------------------------------------------------\n|  Readonly properties defined here:\n|\n|  essential\n|      Return True if the package is an essential part of the system.\n|\n|  fullname\n|      Return the name of the package, including architecture.\n|\n|      Note that as for :meth:`architecture`, this returns the\n|      native architecture for Architecture: all packages.\n|\n|      .. versionadded:: 0.7.100.3\n|\n|  hasconfigfiles\n|      Checks whether the package is is the config-files state.\n|\n|  id\n|      Return a uniq ID for the package.\n|\n|      This can be used eg. to store additional information about the pkg.\n|\n|  installed\n|      Return the currently installed version of the package.\n|\n|      .. versionadded:: 0.7.9\n|\n|  installedfiles\n|      Return a list of files installed by the package.\n|\n|      Return a list of unicode names of the files which have\n|      been installed by this package\n|\n|  isautoinstalled\n|      Return whether the package is marked as automatically installed.\n|\n|  isautoremovable\n|      Return ``True`` if the package is no longer required.\n|\n|      If the package has been installed automatically as a dependency of\n|      another package, and if no packages depend on it anymore, the package\n|      is no longer required.\n|\n|  isinstbroken\n|      Return True if the to-be-installed package is broken.\n|\n|  isinstalled\n|      Return ``True`` if the package is installed.\n|\n|  isnowbroken\n|      Return True if the installed package is broken.\n|\n|  isupgradable\n|      Return ``True`` if the package is upgradable.\n|\n|  markeddelete\n|      Return ``True`` if the package is marked for delete.\n|\n|  markeddowngrade\n|      Package is marked for downgrade\n|\n|  markedinstall\n|      Return ``True`` if the package is marked for install.\n|\n|  markedkeep\n|      Return ``True`` if the package is marked for keep.\n|\n|  markedreinstall\n|      Return ``True`` if the package is marked for reinstall.\n|\n|  markedupgrade\n|      Return ``True`` if the package is marked for upgrade.\n|\n|  name\n|      Return the name of the package, possibly including architecture.\n|\n|      If the package is not part of the system's preferred architecture,\n|      return the same as :attr:`fullname`, otherwise return the same\n|      as :attr:`shortname`\n|\n|      .. versionchanged:: 0.7.100.3\n|\n|      As part of multi-arch, this field now may include architecture\n|      information.\n|\n|  shortname\n|      Return the name of the package, without architecture.\n|\n|      .. versionadded:: 0.7.100.3\n|\n|  versions\n|      Return a VersionList() object for all available versions.\n|\n|      .. versionadded:: 0.7.9\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  candidate\n|      Return the candidate version of the package.\n|\n|      This property is writeable to allow you to set the candidate version\n|      of the package. Just assign a Version() object, and it will be set as\n|      the candidate version.\n\n### DATA\n\nall = ['Cache', 'Cdrom', 'Package']\n\n### FILE\n\n/usr/lib/python3/dist-packages/apt/init.py\n\n"
        }
    ],
    "structuredContent": {
        "command": "apt",
        "section": "",
        "mode": "pydoc",
        "summary": "apt - High-Level Interface for working with apt.",
        "synopsis": null,
        "tldr_summary": "Package manager for Debian-based distributions.",
        "tldr_examples": [
            {
                "description": "Update the list of available packages and versions (recommended before running other `apt` commands)",
                "command": "sudo apt update"
            },
            {
                "description": "Search packages by name or description",
                "command": "apt search {{package}}"
            },
            {
                "description": "Search packages by name only (supports wildcards like `*`)",
                "command": "apt list {{package}}"
            },
            {
                "description": "Show detailed information about a package",
                "command": "apt show {{package}}"
            },
            {
                "description": "Install a package, or update it to the latest version",
                "command": "sudo apt install {{package}}"
            },
            {
                "description": "Remove a package (use `purge` instead to also remove configuration files)",
                "command": "sudo apt remove {{package}}"
            },
            {
                "description": "Upgrade all installed packages to their latest versions",
                "command": "sudo apt upgrade"
            },
            {
                "description": "List all installed packages",
                "command": "apt list {{-i|--installed}}"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "PACKAGE CONTENTS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 6,
                "subsections": [
                    {
                        "name": "class Cache",
                        "lines": 240
                    },
                    {
                        "name": "class Cdrom",
                        "lines": 54
                    },
                    {
                        "name": "class Package",
                        "lines": 207
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}