diff --git a/changelog.md b/changelog.md index f1907ef88..74a08fb11 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,8 @@ > [!WARNING] > This version is **not released yet** and is under active development. +- [uvx] Implement `outdated` operation. Bump minimal requirement to `0.10.10`. + ## [`6.2.1` (2026-03-26)](https://github.com/kdeldycke/meta-package-manager/compare/v6.2.0...v6.2.1) - [brew,cask] Remove `--quiet` from `outdated` command where it conflicts with `--json`. Closes {issue}`1703`. diff --git a/meta_package_manager/managers/uv.py b/meta_package_manager/managers/uv.py index e320c6e37..407d9361b 100644 --- a/meta_package_manager/managers/uv.py +++ b/meta_package_manager/managers/uv.py @@ -212,7 +212,15 @@ class UVX(UVBase): homepage_url = "https://docs.astral.sh/uv/guides/tools/" + requirement = "0.10.10" + """`0.10.10 `_ is the first + version to introduce ``tool list --outdated`` command. + """ + _INSTALLED_REGEXP = re.compile(r"^(?P\S+)\s+v(?P\S+)$") + _OUTDATED_REGEXP = re.compile( + r"^(?P\S+)\s+v(?P\S+)\s+\[latest:\s+(?P\S+)\]$", + ) @property def installed(self) -> Iterator[Package]: @@ -235,6 +243,28 @@ def installed(self) -> Iterator[Package]: installed_version=match.group("version"), ) + @property + def outdated(self) -> Iterator[Package]: + """Fetch outdated packages. + + .. code-block:: shell-session + + $ uv --color never --no-progress tool list --outdated + pycowsay v0.0.0.1 [latest: 0.0.0.2] + - pycowsay + """ + output = self.run_cli("tool", "list", "--outdated") + + if output: + for line in output.splitlines(): + match = self._OUTDATED_REGEXP.match(line) + if match: + yield self.package( + id=match.group("package_id"), + installed_version=match.group("version"), + latest_version=match.group("latest"), + ) + def install(self, package_id: str, version: str | None = None) -> str: """Install one package. diff --git a/readme.md b/readme.md index 63658a2e8..a040af61f 100644 --- a/readme.md +++ b/readme.md @@ -147,7 +147,7 @@ Meta Package Manager,zypper,1 | [`snap`](https://snapcraft.io) | 2.0.0 | 🅱️ | 🐧 | | ⨂ | | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | | | | [`steamcmd`](https://developer.valvesoftware.com/wiki/SteamCMD) | None | 🅱️ | 🐧 | 🍎 | ⨂ | 🪟 | | | | ✓ | | | | | | | [`uv`](https://docs.astral.sh/uv) | 0.5.0 | 🅱️ | 🐧 | 🍎 | ⨂ | 🪟 | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | | ✓ | -| [`uvx`](https://docs.astral.sh/uv/guides/tools/) | 0.5.0 | 🅱️ | 🐧 | 🍎 | ⨂ | 🪟 | ✓ | | | ✓ | ✓ | ✓ | ✓ | | | +| [`uvx`](https://docs.astral.sh/uv/guides/tools/) | 0.10.10 | 🅱️ | 🐧 | 🍎 | ⨂ | 🪟 | ✓ | ✓ | | ✓ | ✓ | ✓ | ✓ | | | | [`vscode`](https://code.visualstudio.com) | 1.60.0 | 🅱️ | 🐧 | 🍎 | ⨂ | 🪟 | ✓ | | | ✓ | | | ✓ | | | | [`vscodium`](https://vscodium.com) | 1.60.0 | 🅱️ | 🐧 | 🍎 | ⨂ | 🪟 | ✓ | | | ✓ | | | ✓ | | | | [`winget`](https://github.com/microsoft/winget-cli) | 1.7 | | | | | 🪟 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | | |