meta_package_manager.managers.pip

class meta_package_manager.managers.pip.Pip[source]

Bases: meta_package_manager.base.PackageManager

Virutal package manager shared by pip2 and pip3 CLI defined below.

platforms = frozenset({'linux', 'macos', 'windows'})
requirement = '10.0.0'
cli_name = None
global_args = ['--no-color']
get_version()[source]

Fetch version from pip --version output.

Raw CLI output samples:

$ pip --version
pip 2.0.2 from /usr/local/lib/python/site-packages/pip (python 3.7)
installed

Fetch installed packages from pip list output.

Raw CLI output samples:

$ pip list --format=json --verbose | jq
[
 {
    "version": "1.3",
    "name": "backports.functools-lru-cache",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": "pip"
  },
  {
    "version": "0.9999999",
    "name": "html5lib",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": "pip"
  },
  {
    "name": "setuptools",
    "version": "46.0.0",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": ""
  },
  {
    "version": "2.8",
    "name": "Jinja2",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": ""
  },
  (...)
]
search(query, extended, exact)[source]

Fetch matching packages from pip search output.

$ pip search --no-color abc
ABC (0.0.0)                 - UNKNOWN
micropython-abc (0.0.1)     - Dummy abc module for MicroPython
abc1 (1.2.0)                - a list about my think
abcd (0.3.0)                - AeroGear Build Cli for Digger
abcyui (1.0.0)              - Sorry ,This is practice!
astroabc (1.4.2)            - A Python implementation of an
                              Approximate Bayesian Computation
                              Sequential Monte Carlo (ABC SMC)
                              sampler for parameter estimation.
collective.js.abcjs (1.10)  - UNKNOWN
cosmo (1.0.5)               - Python ABC sampler
outdated

Fetch outdated packages from pip list --outdated output.

Raw CLI output samples:

$ pip list --format=json --outdated --verbose --quiet | jq
[
  {
    "latest_filetype": "wheel",
    "version": "0.7.9",
    "name": "alabaster",
    "latest_version": "0.7.10",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": "pip"
  },
  {
    "latest_filetype": "wheel",
    "version": "0.9999999",
    "name": "html5lib",
    "latest_version": "0.999999999",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": "pip"
   },
  {
    "latest_filetype": "wheel",
    "version": "2.8",
    "name": "Jinja2",
    "latest_version": "2.9.5",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": "pip"
   },
  {
    "latest_filetype": "wheel",
    "version": "0.5.3",
    "name": "mccabe",
    "latest_version": "0.6.1",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": "pip"
   },
  {
    "latest_filetype": "wheel",
    "version": "2.2.0",
    "name": "pycodestyle",
    "latest_version": "2.3.1",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": "pip"
   },
  {
    "latest_filetype": "wheel",
    "version": "2.1.3",
    "name": "Pygments",
    "latest_version": "2.2.0",
    "location": "/usr/local/lib/python3.7/site-packages",
    "installer": ""
   }
]
upgrade_cli(package_id)[source]

Return a bash-compatible full-CLI to upgrade a package.

upgrade_all_cli()[source]

Pip lacks support of a proper full upgrade command.

See: https://github.com/pypa/pip/issues/59

class meta_package_manager.managers.pip.Pip2[source]

Bases: meta_package_manager.managers.pip.Pip

name = "Python 2's Pip"
cli_name = 'pip2'
class meta_package_manager.managers.pip.Pip3[source]

Bases: meta_package_manager.managers.pip.Pip

name = "Python 3's Pip"
cli_name = 'pip3'