Skip to content

[VPEX][6/8] Add local-env uv backend and hidden CLI command#5832

Open
rugpanov wants to merge 1 commit into
dbconnect/05-pipelinefrom
dbconnect/06-command
Open

[VPEX][6/8] Add local-env uv backend and hidden CLI command#5832
rugpanov wants to merge 1 commit into
dbconnect/05-pipelinefrom
dbconnect/06-command

Conversation

@rugpanov

@rugpanov rugpanov commented Jul 3, 2026

Copy link
Copy Markdown

Context

PR 6 of 8 in the stacked databricks local-env python sync series (see #5823 for the full plan). Stacked on #5828 — review PRs 1–5 first; this PR's diff is the seven files below. This PR wires the engine to a runnable CLI command, registered Hidden: true so it does not appear in help or completion until the final unveil PR (#8). It is invocable by name for dogfooding in the meantime, so nothing user-facing changes yet.

What this PR contains

  • libs/localenv/uv.go (+ uv_test.go) — the uv implementation of the PackageManager interface: discover/install uv, install the Python minor, uv sync, seed pip into the venv, and validate the result. Includes the pip.confUV_INDEX_URL bridge for Databricks-managed machines where pypi.org is blocked.
  • cmd/localenv/ — the command tree matching the target path local-env python sync:
    • localenv.go — the local-env group (Hidden: true) and the python subgroup; both parent nodes use root.ReportUnknownSubcommand so an unknown subcommand errors while a bare group shows help.
    • sync.go — the sync verb: target/mode flags, bundle-target resolution, constraint-source precedence (flag → env → default), builds the Pipeline with the uv manager, and renders text or --json.
    • compute.go — the SDK adapter implementing ComputeClient.
    • output.go — text/--json rendering of the pipeline Result.
  • cmd/cmd.go — registers the group.

All three Cobra Use values and the --json command field come from the single command-path constants in libs/localenv (CommandGroup/CommandSubgroup/CommandVerb/CommandName); no code literal re-spells the path.

First layer reachable from main

Because this wires the package into main, it makes the whole libs/localenv package live for the deadcode checker with no //deadcode:allow pragmas. Build, unit tests, lint, deadcode, and gofmt are all clean. The hidden three-level command was smoke-tested end to end: hidden from top-level help; help works at each level; unknown subcommands exit non-zero; a bare group shows help; flags and mutual-exclusion behave.

Unit tests for cmd/localenv/ are intentionally deferred to the acceptance-test PR (#7), per the repo convention that user-visible CLI output is covered by acceptance tests.

This pull request and its description were written by Isaac.


This PR was created with GitHub MCP.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

Based on git history, these people are best suited to review:

  • @pietern -- recent work in cmd/
  • @shreyas-goenka -- recent work in cmd/
  • @simonfaltum -- recent work in cmd/

Eligible reviewers: @andrewnester, @anton-107, @denik, @janniklasrose, @renaudhartert-db

Suggestions based on git history. See OWNERS for ownership rules.

Sixth in the stacked series. Wires the engine to a runnable CLI command,
registered Hidden so it does not appear in help or completion until the final
unveil PR (it is invocable for dogfooding in the meantime).

- libs/localenv/uv.go: the uv implementation of the PackageManager interface
  (discover/install uv, install Python, uv sync, seed pip, validate the venv),
  plus the pip.conf -> UV_INDEX_URL bridge for Databricks-managed machines.
- cmd/localenv: the command tree matching the target path
  "local-env python sync" — a top group (local-env), a python subgroup, and the
  sync verb. Parent nodes use root.ReportUnknownSubcommand so an unknown
  subcommand errors while a bare group shows help. sync resolves flags/bundle
  target, builds the Pipeline with the uv manager, and renders text or --json.
- cmd/cmd.go: register the group (Hidden:true).

The sync verb rejects stray positional args (cobra.NoArgs) rather than silently
ignoring them, since the target is chosen via flags. Job compute resolution
reads job-level environments/job_clusters; task-level compute is out of scope
and returns an actionable error pointing at --cluster/--serverless.

This is the first layer reachable from main, so it makes the whole
libs/localenv package live for the deadcode checker without any pragmas. Build,
unit tests, lint, and deadcode are clean; the hidden three-level command was
smoke-tested end to end (help at each level, unknown-subcommand errors, flags).

Co-authored-by: Isaac
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 2fd09fe

Run: 28681638172

Env 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
🔄​ aws linux 1 7 14 229 1045 6:41
💚​ aws windows 7 14 232 1043 3:51
💚​ aws-ucws linux 7 14 314 963 4:59
💚​ aws-ucws windows 7 14 316 961 3:52
💚​ azure linux 4 15 230 1044 4:05
💚​ azure windows 4 15 232 1042 3:42
💚​ azure-ucws linux 4 15 316 960 5:01
💚​ azure-ucws windows 4 15 318 958 3:54
💚​ gcp linux 4 15 229 1046 3:43
💚​ gcp windows 4 15 231 1044 3:37
22 interesting tests: 14 SKIP, 7 RECOVERED, 1 flaky
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/replace_existing 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_projects/update_display_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🔄​ TestSecretsPutSecretStringValue 🔄​f ✅​p 🙈​s 🙈​s ✅​p ✅​p ✅​p ✅​p ✅​p ✅​p
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 5 slowest tests (at least 2 minutes):
duration env testname
2:51 gcp windows TestAccept
2:48 azure windows TestAccept
2:48 azure-ucws windows TestAccept
2:47 aws windows TestAccept
2:46 aws-ucws windows TestAccept

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants