Skip to content

RTECO-992 - Added support for uv package manager#3436

Open
agrasth wants to merge 11 commits intojfrog:masterfrom
agrasth:feature/RTECO-992
Open

RTECO-992 - Added support for uv package manager#3436
agrasth wants to merge 11 commits intojfrog:masterfrom
agrasth:feature/RTECO-992

Conversation

@agrasth
Copy link
Copy Markdown
Contributor

@agrasth agrasth commented Apr 15, 2026

  • All tests have passed. If this feature is not already covered by the tests, new tests have been added.
  • The pull request is targeting the master branch.
  • The code has been validated to compile successfully by running go vet ./....
  • The code has been formatted properly using go fmt ./....

Adds jf uv — a transparent wrapper over the uv CLI with Artifactory credential injection, build-info collection, and full support for all uv subcommands (sync, lock, add, remove, build, publish, run, tree, etc.).

How it works

jf uv <args> behaves identically to uv <args> with two additions:

  1. Credential injection — Artifactory index credentials are set as UV_INDEX_* env vars before calling uv, following UV's own auth priority chain (env vars → embedded URL → netrc → jf config)
  2. Build-info collection — after the command completes, dependency and artifact information is recorded locally for later publishing via jf rt bp

Typical workflow

jf uv sync    --build-name myapp --build-number $BUILD_NUM   # collect deps
jf uv build   --build-name myapp --build-number $BUILD_NUM   # build wheel/sdist
jf uv publish --build-name myapp --build-number $BUILD_NUM   # upload + record artifacts
jf rt bp myapp $BUILD_NUM                                     # publish build-info

CI/Integration notes

  • Fully compatible with UV_INDEX_URL, UV_DEFAULT_INDEX, and UV_INDEX_*_USERNAME/PASSWORD env vars — jf defers to any native auth already present
  • [dependency-groups] (PEP 735) and [tool.uv.dev-dependencies] both supported; --no-dev, --only-dev, --group, --only-group, --no-group, --all-groups all respected via uv pip list ground truth
  • jf uv run --script <file> collects build-info from the script's own inline dependencies (not the surrounding project)
  • Command is marked Hidden: true pending migration of the definition to jfrog-cli-artifactory

Test coverage

Added uv_test.go with integration tests covering: sync/lock/add/remove/build/publish pipelines, all auth methods, virtual/local/remote repo combinations, build-info verification (deps, artifacts, requestedBy chains, sha1/md5), --module, --server-id, --project, dev/group dependency handling, and CI/VCS properties.

@agrasth agrasth force-pushed the feature/RTECO-992 branch from 5f863ce to ce3bc96 Compare April 15, 2026 17:33
@agrasth agrasth marked this pull request as ready for review April 24, 2026 09:09
@agrasth agrasth added the safe to test Approve running integration tests on a pull request label Apr 24, 2026
Comment thread buildtools/cli.go
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

command definition should be part of jfrog-cli-artifactory

Comment thread .github/workflows/uvTests.yml Outdated
if: matrix.os.name != 'macos'
uses: actions/setup-python@v6
with:
python-version: "3.11.5"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we have a matrix step with latest version of python as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added python-version as a matrix dimension: ["3.11.5", "3.x"]. The 3.x entry always resolves to the latest stable Python 3 via actions/setup-python.


- name: Setup UV
if: matrix.os.name != 'macos'
uses: astral-sh/setup-uv@v5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same with uv package manager as well create matrix step and check if it possible to fetch lastest version always.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added uv-version as a matrix dimension: ["0.6.17", "latest"]. The astral-sh/setup-uv action supports version: "latest" to always fetch the newest release. The version input is now templated from the matrix.

Comment thread buildtools/cli.go
Action: PoetryCmd,
},
{
Name: "uv",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's mark the command as hidden for now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added Hidden: true to the uv command definition. The command definition will move to jfrog-cli-artifactory in a follow-up.

Comment thread buildtools/cli.go Outdated
}

// uvPyprojectToml holds the [tool.uv] fields we need from pyproject.toml.
type uvPyprojectToml struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we don't need nested structs here and isn't github.com/BurntSushi/toml library used for parsing toml files?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Replaced the anonymous nested struct in uvPyprojectToml with a named uvToolUv type and reused the existing uvIndexEntry type for the index slice. github.com/BurntSushi/toml was already the parser in use.

Comment thread buildtools/cli.go Outdated
log.Info("UV auth [publish]: using UV_PUBLISH_USERNAME/PASSWORD (native, step 2b)")
default:
// deployerRepo is already resolved (CLI flag > pyproject.toml) before auth block.
switch {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this nested switch block? Looks like a code smell. Please avoid.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the nested switch entirely. The fallback path is now extracted into uvInjectPublishCredentials which uses early returns instead of nesting.

Comment thread buildtools/cli.go Outdated
// (when index and publish URL share the same Artifactory host,
// the index native credentials are valid for publish too)
// Fallback: jf server config (only if publish host == jf config host)
switch {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please refactor this entire block.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Refactored into two flat functions: uvApplyPublishAuth (single-level switch over all 5 priority steps) and uvInjectPublishCredentials (early-return guards for steps 4b and fallback). Call site is now a single line.

…d, flat structs and no nested switch in publish auth
…emove UV helpers from cli.go and buildinfo.go
Update python.NewNativeUvCommand() call to python.NewNativeUVCommand()
to match the renamed identifier in jfrog-cli-artifactory.
@agrasth agrasth requested a review from bhanurp April 28, 2026 06:18
@agrasth agrasth added safe to test Approve running integration tests on a pull request and removed safe to test Approve running integration tests on a pull request labels Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Approve running integration tests on a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants