• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 29848115811

21 Jul 2026 04:20PM UTC coverage: 72.514% (+0.03%) from 72.484%
29848115811

push

github

web-flow
#2100: Resolve python versions via uv instead of ide-urls (#2152)

Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>
Co-authored-by: Philipp Hoang <115173117+Caylipp@users.noreply.github.com>

4973 of 7584 branches covered (65.57%)

Branch coverage included in aggregate %.

12824 of 16959 relevant lines covered (75.62%)

3.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

63.64
cli/src/main/java/com/devonfw/tools/ide/tool/uv/UvRepository.java
1
package com.devonfw.tools.ide.tool.uv;
2

3
import java.util.List;
4

5
import com.devonfw.tools.ide.context.IdeContext;
6
import com.devonfw.tools.ide.json.JsonMapping;
7
import com.devonfw.tools.ide.tool.ToolCommandlet;
8
import com.devonfw.tools.ide.tool.pip.PypiObject;
9
import com.devonfw.tools.ide.tool.repository.ArtifactToolRepository;
10
import com.devonfw.tools.ide.version.VersionIdentifier;
11
import com.fasterxml.jackson.core.JsonProcessingException;
12
import com.fasterxml.jackson.databind.ObjectMapper;
13

14
/**
15
 * Implementation of {@link ArtifactToolRepository} for tools installed via {@code uv tool} and resolved from PyPI.
16
 */
17
public class UvRepository extends ArtifactToolRepository<UvArtifact, UvArtifactMetadata> {
18

19
  /** Base URL of PyPI registry */
20
  public static final String REGISTRY_URL = "https://pypi.org/pypi/";
21

22
  private static final ObjectMapper MAPPER = JsonMapping.create();
3✔
23

24
  /** {@link #getId() ID} of this repository. */
25
  public static final String ID = "uv";
26

27
  /**
28
   * The constructor.
29
   *
30
   * @param context the owning {@link IdeContext}.
31
   */
32
  public UvRepository(IdeContext context) {
33
    super(context);
3✔
34
  }
1✔
35

36
  @Override
37
  public String getId() {
38
    return ID;
×
39
  }
40

41
  @Override
42
  protected UvArtifact resolveArtifact(String tool, String edition, VersionIdentifier version, ToolCommandlet toolCommandlet) {
43
    if (toolCommandlet instanceof UvBasedCommandlet uv) {
6!
44
      String name = uv.getPackageName();
3✔
45
      if (version == null) {
2!
46
        version = VersionIdentifier.LATEST;
2✔
47
      }
48
      return new UvArtifact(name, version.toString());
7✔
49
    }
50
    throw new UnsupportedOperationException("Tool '" + tool + "' is not supported by uv repository.");
×
51
  }
52

53
  @Override
54
  protected List<VersionIdentifier> fetchVersions(UvArtifact artifact) {
55
    String url = getRegistryUrl() + artifact.getName() + "/json";
6✔
56
    String json = this.context.getFileAccess().download(url);
6✔
57
    try {
58
      PypiObject pypiObject = MAPPER.readValue(json, PypiObject.class);
6✔
59
      return pypiObject.releases();
3✔
60
    } catch (JsonProcessingException e) {
×
61
      throw new RuntimeException("Failed to process JSON from " + url, e);
×
62
    }
63
  }
64

65
  /**
66
   * @return the registry URL.
67
   */
68
  protected String getRegistryUrl() {
69
    return REGISTRY_URL;
×
70
  }
71

72
  @Override
73
  public UvArtifactMetadata getMetadata(UvArtifact artifact, String tool, String edition) {
74
    return new UvArtifactMetadata(artifact, tool, edition);
×
75
  }
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc