meta_package_manager.managers.uv module¶
- class meta_package_manager.managers.uv.UVBase[source]¶
Bases:
PackageManagerVirtual base shared by the
UVandUVXmanagers defined below.Initialize
cli_errorslist.- homepage_url: str | None = 'https://docs.astral.sh/uv'¶
Home page of the project, only used in documentation for reference.
- logo: str | None = 'uv'¶
Slug of the brand mark standing for this manager in the documentation.
Names an SVG vendored under
docs/assets/managers/, whose provenance and license are recorded indocs/assets/managers/logos.yaml. Inlined at the top of the manager’s page bymeta_package_manager._docs; a manager leaving it unset keeps the page’s default package glyph.Several managers legitimately share one slug, either because they wrap the same upstream (
brewandcask) or because the tool has no mark of its own and its ecosystem’s stands in (aptunder Debian’s swirl,cargounder Rust’s gear). Documentation-only, likehomepage_url: no CLI output reads it.
- requirement: str | None = '>=0.5.0'¶
0.5.0 is the first version to introduce
pip list --outdatedcommand.
- platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='aix', name='IBM AIX'), Platform(id='almalinux', name='AlmaLinux'), Platform(id='alpine', name='Alpine Linux'), Platform(id='altlinux', name='ALT Linux'), Platform(id='amzn', name='Amazon Linux'), Platform(id='android', name='Android'), Platform(id='arch', name='Arch Linux'), Platform(id='buildroot', name='Buildroot'), Platform(id='cachyos', name='CachyOS'), Platform(id='centos', name='CentOS'), Platform(id='chromeos', name='ChromeOS'), Platform(id='clearlinux', name='Clear Linux OS'), Platform(id='cloudlinux', name='CloudLinux OS'), Platform(id='cygwin', name='Cygwin'), Platform(id='debian', name='Debian'), Platform(id='dragonfly_bsd', name='DragonFly BSD'), Platform(id='endeavouros', name='EndeavourOS'), Platform(id='exherbo', name='Exherbo Linux'), Platform(id='fedora', name='Fedora'), Platform(id='freebsd', name='FreeBSD'), Platform(id='generic_linux', name='Generic Linux'), Platform(id='gentoo', name='Gentoo Linux'), Platform(id='guix', name='Guix System'), Platform(id='haiku', name='Haiku'), Platform(id='hurd', name='GNU/Hurd'), Platform(id='ibm_powerkvm', name='IBM PowerKVM'), Platform(id='illumos', name='illumos'), Platform(id='kali', name='Kali Linux'), Platform(id='kvmibm', name='KVM for IBM z Systems'), Platform(id='linuxmint', name='Linux Mint'), Platform(id='macos', name='macOS'), Platform(id='mageia', name='Mageia'), Platform(id='mandriva', name='Mandriva Linux'), Platform(id='manjaro', name='Manjaro Linux'), Platform(id='midnightbsd', name='MidnightBSD'), Platform(id='netbsd', name='NetBSD'), Platform(id='nixos', name='NixOS'), Platform(id='nobara', name='Nobara'), Platform(id='openbsd', name='OpenBSD'), Platform(id='opensuse', name='openSUSE'), Platform(id='openwrt', name='OpenWrt'), Platform(id='oracle', name='Oracle Linux'), Platform(id='os400', name='IBM i'), Platform(id='parallels', name='Parallels'), Platform(id='pidora', name='Pidora'), Platform(id='pikaos', name='PikaOS'), Platform(id='raspbian', name='Raspbian'), Platform(id='rhel', name='RedHat Enterprise Linux'), Platform(id='rocky', name='Rocky Linux'), Platform(id='scientific', name='Scientific Linux'), Platform(id='slackware', name='Slackware'), Platform(id='sles', name='SUSE Linux Enterprise Server'), Platform(id='slitaz', name='SliTaz GNU/Linux'), Platform(id='solaris', name='Solaris'), Platform(id='sourcemage', name='Source Mage GNU/Linux'), Platform(id='sunos', name='SunOS'), Platform(id='tuxedo', name='Tuxedo OS'), Platform(id='ubuntu', name='Ubuntu'), Platform(id='ultramarine', name='Ultramarine'), Platform(id='void', name='Void Linux'), Platform(id='windows', name='Windows'), Platform(id='wsl1', name='Windows Subsystem for Linux v1'), Platform(id='wsl2', name='Windows Subsystem for Linux v2'), Platform(id='xenserver', name='XenServer')})¶
List of platforms supported by the manager.
Allows for a mishmash of platforms and groups of platforms. Will be normalized into a
frozensetofPlatforminstances at instantiation.
- virtual: bool = True¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- cooldown_env_var: ClassVar[str | None] = 'UV_EXCLUDE_NEWER'¶
uv honors a release-age cooldown through its
exclude-newerresolver option.UV_EXCLUDE_NEWERmirrors the--exclude-newerflag and is read by every resolving subcommand (pip install,pip list --outdated,tool install,tool upgrade), so a single environment variable covers install, upgrade and outdated at once. uv accepts an RFC 3339 timestamp, which is exactly what the defaultmeta_package_manager.execution.CLIExecutor.cooldown_env_value()produces.Note
The environment variable is the only mechanism that reaches these subcommands, which is why the cutoff is injected rather than written to a config file. uv pip and uv tool operate at the user level and ignore project-local configuration: a
[tool.uv]table in thepyproject.tomlof whatever directory the user happens to stand in is never consulted. Only user-level and system-leveluv.tomlare, andUV_EXCLUDE_NEWERoutranks both.Caution
Because the variable outranks those files, injecting it replaces any standing
exclude-newerthe user configured rather than tightening it: a cooldown looser than their own policy silently widens it for the duration of the run. See Cooldown, section “The cooldown is authoritative, not a floor”.uv exposes no environment variable for the companion
--exclude-newer-packageflag, so a per-package exemption cannot be injected the way this cutoff is.See uv’s exclude-newer setting.
- pre_args: tuple[str, ...] = ('--color', 'never', '--no-progress')¶
--color color-choiceControl colors in output [default:
auto]Possible values: -
auto: Enables colored output only when the output is going to a terminal or TTY with support -always: Enables colored output regardless of the detected environment -never: Disables colored output
--no-progressHide all progress outputs.
For example, spinners or progress bars.
- version_regexes: tuple[str, ...] = ('uv\\s+(?P<version>\\S+)',)¶
$ uv --version uv 0.2.21 (ebfe6d8fc 2024-07-03)
- cli_names: tuple[str, ...] = ('uvbase',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- class meta_package_manager.managers.uv.UV[source]¶
Bases:
UVBasePython packages managed with uv’s
uv pipinterface.Installed and outdated packages are read with
uv pip list(adding--outdatedand--format=json), acting on whatever environment uv resolves, exactly as a bareuv pipcall in the same shell would. The--outdatedlisting sets the>=0.5.0version floor, the first uv release to ship it. The release-age cooldown rides on uv’s--exclude-newerresolver option, which every resolving subcommand honors, so one cutoff covers install, upgrade and outdated together.Hint
Package specs are passed unquoted, working around uv parse failures on quoted specs.
Initialize
cli_errorslist.- name: str = 'Python uv'¶
Return package manager’s common name.
Default value is based on class name.
- property installed: Iterator[Package]¶
Fetch installed packages.
$ uv --color never --no-progress pip list --format=json [ { "name": "markupsafe", "version": "2.1.5" }, { "name": "meta-package-manager", "version": "5.17.0", "editable_project_location": "/Users/kde/meta-package-manager" }, { "name": "myst-parser", "version": "3.0.1" } ]
- property outdated: Iterator[Package]¶
Fetch outdated packages.
$ uv --color never --no-progress pip list --outdated --format=json [ { "name": "lark-parser", "version": "0.7.8", "latest_version": "0.12.0", "latest_filetype": "wheel" }, { "name": "types-setuptools", "version": "75.3.0.20241107", "latest_version": "75.3.0.20241112", "latest_filetype": "wheel" } ]
- install(package_id, version=None)[source]¶
Install one package.
$ uv --color never --no-progress pip install arrow
- Return type:
- upgrade_one_cli(package_id, version=None)[source]¶
Generates the CLI to upgrade the package provided as parameter.
$ uv --color never --no-progress pip install --upgrade arrow
- remove(package_id)[source]¶
Remove one package.
$ uv --color never --no-progress pip uninstall arrow
- Return type:
- cleanup_cache()[source]¶
Removes things we don’t need anymore.
Warning
Skipped when
mpmitself was launched byuv runoruvx: the parentuvprocess keeps a lock on its cache for as long as its child lives, so each cache command below would wait on its own ancestor forUV_LOCK_TIMEOUT(300 seconds by default), fail, and stall the whole cleanup for ten minutes.uvadvertises itself to its children through theUVenvironment variable, which is the marker detected here.$ uv --color never --no-progress cache clean Clearing cache at: /Users/kde/Library/Caches/uv Removed 97279 files (2.0GiB)
$ uv --color never --no-progress cache prune No cache found at: /Users/kde/.cache/uv
- Return type:
- cli_names: tuple[str, ...] = ('uv',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- class meta_package_manager.managers.uv.UVX[source]¶
Bases:
UVBaseuv’s tool manager for isolated Python applications, like
pipx.mpm drives the
uv toolsubcommands; each application lives in its own venv. Installed and outdated tools are parsed from the plain-texttool listandtool list --outdatedoutput: unlike theuv pipinterface,uv toolemits no JSON. The--outdatedlisting sets the>=0.10.10version floor, the first uv release to ship it. The release-age cooldown rides on uv’s--exclude-newerresolver option, covering install, upgrade and outdated through one cutoff.Hint
Package specs are passed unquoted, working around uv parse failures on quoted specs.
Initialize
cli_errorslist.- name: str = 'Python uvx'¶
Return package manager’s common name.
Default value is based on class name.
- homepage_url: str | None = 'https://docs.astral.sh/uv/guides/tools/'¶
Home page of the project, only used in documentation for reference.
- brewfile_entry_type: ClassVar[str | None] = 'uv'¶
Mapped to Homebrew Bundle’s
uventry type, which installs viauv tool install: the same mechanismUVXwraps, while the pip-styleUVmanager has no Brewfile counterpart. See Snapshot and export, section “uvmapping”.
- requirement: str | None = '>=0.10.10'¶
0.10.10 is the first version to introduce
tool list --outdatedcommand.
- cli_names: tuple[str, ...] = ('uv',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- id: str = 'uvx'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- property installed: Iterator[Package]¶
Fetch installed packages.
$ uv --color never --no-progress tool list pycowsay v0.0.0.1 - pycowsay
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- property outdated: Iterator[Package]¶
Fetch outdated packages.
$ uv --color never --no-progress tool list --outdated pycowsay v0.0.0.1 [latest: 0.0.0.2] - pycowsay
- install(package_id, version=None)[source]¶
Install one package.
$ uv --color never --no-progress tool install pycowsay
- Return type:
- upgrade_all_cli()[source]¶
Generates the CLI to upgrade all packages.
$ uv --color never --no-progress tool upgrade --all Updated pycowsay v0.0.0.1 -> v0.0.0.2 - pycowsay