Skip to content

#2026: Create UvRepository and UvBasedCommandlet#2064

Open
Paras14 wants to merge 9 commits into
devonfw:mainfrom
Paras14:feature/2026-create-uvrepository-uvBasedcommandlet
Open

#2026: Create UvRepository and UvBasedCommandlet#2064
Paras14 wants to merge 9 commits into
devonfw:mainfrom
Paras14:feature/2026-create-uvrepository-uvBasedcommandlet

Conversation

@Paras14

@Paras14 Paras14 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #2026

Implemented changes

  • Added UvRepository (resolves tool versions from PyPI, reusing the existing PypiObject JSON model) together with UvArtifact and UvArtifactMetadata.
  • Added UvBasedCommandlet, the abstract base for tools installed via uv tool install.
  • Exposed getUvRepository() on IdeContext / AbstractIdeContext.
  • Added Just as the first concrete uv-based tool (PyPI package rust-just, command just) and registered it in CommandletManagerImpl.
  • Wired UV_TOOL_BIN_DIR onto the path in Uv.setEnvironment (via withPathEntry()) so uv-installed tools are actually runnable.
  • Added corresponding unit tests.

Note for review: the withPathEntry() change in Uv.setEnvironment() affects all uv usage (including uv-as-pip-backend), not only uv-tool installs. It was needed because uv installs tool executables into UV_TOOL_BIN_DIR (software/python/bin), which nothing previously added to the path. So the install succeeded but ide just failed with CreateProcess error=2. I'd appreciate a check on whether this has any precedence/existing-user side effects I haven't considered.


Testing instructions

  1. list-versions just: lists rust-just versions from PyPI (newest first).
  2. install just: installs the latest version.
  3. install just 1.51.0: installs a specific version.
  4. just --version: runs the installed tool.
  5. Automated: mvn clean test (see JustTest).

Checklist for this PR

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary»
  • PR top-level comment summarizes what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labeled with internal
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

Checklist for tool commandlets

  • The tool can be installed automatically (during setup via settings) or via the commandlet call
  • The tool is isolated in its IDEasy project (Sandbox Principle)
  • The new tool is added to the table of tools in LICENSE.asciidoc
  • The new commandlet is a command-wrapper for just
  • Proper help texts for all supported languages are added
  • The new commandlet installs potential dependencies automatically
  • The variables JUST_VERSION and JUST_EDITION are honored by the commandlet
  • The new commandlet is tested on the platforms in scope of the issue

@CLAassistant

CLAassistant commented Jun 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Paras14 Paras14 self-assigned this Jun 23, 2026
@Paras14 Paras14 moved this from 🆕 New to Team Review in IDEasy board Jun 23, 2026
@quando632 quando632 self-assigned this Jun 24, 2026
@coveralls

coveralls commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 28428343995

Coverage decreased (-0.1%) to 71.226%

Details

  • Coverage decreased (-0.1%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 188 coverage regressions across 4 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

188 previously-covered lines in 4 files lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/context/AbstractIdeContext.java 164 67.64%
com/devonfw/tools/ide/context/IdeContext.java 16 77.78%
com/devonfw/tools/ide/commandlet/CommandletManagerImpl.java 7 91.75%
com/devonfw/tools/ide/version/VersionSegment.java 1 89.24%

Coverage Stats

Coverage Status
Relevant Lines: 16356
Covered Lines: 12151
Line Coverage: 74.29%
Relevant Branches: 7308
Covered Branches: 4704
Branch Coverage: 64.37%
Branches in Coverage %: Yes
Coverage Strength: 3.14 hits per line

💛 - Coveralls

@quando632 quando632 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean implementation that follows the existing NpmRepository / PipRepository patterns well. Wiring, registration of Just, help texts and license entry are all complete, and Just is nicely minimal. Tests pass (JustTest, UvTest). I only have a few points.

request.setProcessContext(pc);
ProcessResult result = runPackageManager(request);
if (result.isSuccessful()) {
String prefix = packageName + "v";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong prefix when parsing uv tool list

UvBasedCommandlet.java:79

String prefix = packageName + "v";

The real uv tool list output is rust-just v1.37.0 (with a space), so this prefix never matches. As a result the installed version is never detected and getInstalledVersion() always returns null. Should be packageName + " v".

.setProcessMode(ProcessMode.DEFAULT_CAPTURE);
ProcessContext pc = this.context.newProcess().errorHandling(ProcessErrorHandling.NONE);
request.setProcessContext(pc);
ProcessResult result = runPackageManager(request);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version check can trigger an installation

computeInstalledVersion calls the one-arg runPackageManager(request). The base class @implNote explicitly says to use runPackageManager(request, true) with skipInstallation=true for version checks, since the one-arg form calls pm.install(...) internally.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing validation

UvArtifact is missing the requireNotEmpty(name, ...) validation that PipArtifact has. Since getPackageName() currently always returns a hardcoded string this is not an immediate problem, but future UvBasedCommandlet implementations returning null or empty would only fail at the HTTP request rather than immediately with a clear exception.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests don't cover computeInstalledVersion

The uv mock script only handles pip/venv and echoes uv tool list for the list call, so it never returns a real list. That's why the busg in UvBasedCommandlet went unnoticed. Adding a test with a realistic uv tool list output (e.g. rust-just v1.37.0) would cover both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

Create UvRepository and UvBasedCommandlet

4 participants