Skip to content

Deprecate setup-local --constraints-only in favour of --no-dbconnect - #6470

Open
rugpanov wants to merge 2 commits into
setup-local/orthogonal-flagsfrom
setup-local/deprecate-constraints-only
Open

Deprecate setup-local --constraints-only in favour of --no-dbconnect#6470
rugpanov wants to merge 2 commits into
setup-local/orthogonal-flagsfrom
setup-local/deprecate-constraints-only

Conversation

@rugpanov

@rugpanov rugpanov commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Why

databricks environments setup-local now offers the orthogonal --no-dbconnect
flag, which skips the databricks-connect dependency with behaviour identical to
the older --constraints-only. Two visible spellings for one behaviour is
confusing, but --constraints-only may already live in users' scripts and CI,
so it can't just be removed.

Stacked on #6464 (which introduced --no-dbconnect).

What

Mark --constraints-only deprecated with cobra's MarkDeprecated, which:

  • hides it from --help, and
  • prints a one-line stderr notice — Flag --constraints-only has been deprecated, use --no-dbconnect instead — once per run when the flag is used.

The flag stays defined and its behaviour is unchanged, so existing callers keep
working. This matches the repo's existing deprecation pattern (--compute-id
--cluster-id, and the aitools --global/--project flags). Actual removal is
left as a separate, later step.

Backward compatibility

  • Default runs are byte-for-byte unchanged.
  • --constraints-only still works identically; the only new output is a stderr
    line, so --output json consumers (whose contract is stdout) are unaffected —
    schemaVersion stays 1.

Testing

  • Unit (cmd/environments): a new test asserts --constraints-only stays
    defined but is Hidden and carries the use --no-dbconnect instead
    deprecation message.
  • Acceptance (acceptance/localenv): regenerated goldens — --constraints-only
    dropped from the help listing; the constraints-only and
    constraints-only-existing runs now show the stderr deprecation line with
    stdout JSON unchanged.
  • gofmt, go vet ./cmd/environments, go test ./cmd/environments, and
    go build ./... all clean.

This pull request and its description were written by Isaac.

rugpanov and others added 2 commits September 1, 2026 17:18
*Why*

`databricks environments setup-local` had a single `--constraints-only` mode
that bundled "skip databricks-connect" together with the rest of the setup. A
caller (the VS Code extension, agents) that wants to write project files but
defer provisioning, or manage its own dependency pins, had no way to express
that. The setup steps are independent, so the flags that control them should be
too.

*What*

Adds three orthogonal, composable negative flags:

- `--no-constraints` skips writing the remote Python-version and dependency
  pins (requires-python and the [tool.uv] constraint block); any existing values
  are left untouched, and provisioning still installs the resolved Python (the
  flag governs only what is written).
- `--no-dbconnect` skips the databricks-connect dependency. Equivalent to the
  existing `--constraints-only`, which stays as-is for now.
- `--no-provision` writes the project files through the merge phase, then stops:
  no Python download, uv sync, or validation. Because it never invokes uv, its
  preflight no longer requires or installs uv either — a files-only run works on
  a machine without uv.

Introduces a new `skipped` phase status (distinct from `pending`, which means an
earlier phase failed): the provision and validate phases report `skipped` under
`--no-provision`, `venvPath` is omitted, and the dry-run plan drops
`wouldInstallPython`. The text summary gains a dedicated "provisioning skipped"
variant so it no longer prints an empty venv path or a broken activation hint.

The `--no-constraints` "unmanaged" signal is a nil ConstraintDeps / empty
requires-python; parseConstraints now normalizes a missing
[tool.uv].constraint-dependencies to a non-nil empty slice so that nil uniquely
means the flag, not merely an artifact that omits the section.

Default runs (no new flags) are byte-for-byte unchanged; the JSON schemaVersion
stays at 1 since the new status only appears when a new flag is passed.

*Verification*

- Unit tests (libs/localenv): no-provision writes files then skips
  provision/validate without invoking uv, dry-run plus no-provision marks them
  skipped and drops wouldInstallPython, no-constraints leaves existing pins
  untouched and omits them greenfield, parseConstraints normalizes missing
  constraint-dependencies, and the merge/render skip guards.
- Acceptance goldens: no-provision (real run), no-constraints, no-dbconnect,
  no-provision-dry-run, no-provision-text, plus the refreshed help output.
- gofmt, go vet, and full go build ./... clean.

Co-authored-by: Isaac <no-reply@databricks.com>
*Why*

`databricks environments setup-local` now has the orthogonal `--no-dbconnect`
flag, which skips the databricks-connect dependency with identical behaviour to
the older `--constraints-only`. Keeping two visible spellings for one behaviour
is confusing, but `--constraints-only` may already live in users' scripts and CI,
so it cannot simply be removed.

*What*

Mark `--constraints-only` deprecated via cobra's `MarkDeprecated`, which hides it
from `--help` and prints a one-line stderr notice ("Flag --constraints-only has
been deprecated, use --no-dbconnect instead") once per run when it is used. The
flag stays defined and its behaviour is unchanged, so existing callers keep
working; actual removal is a separate, later step. Adds a changelog fragment.

*Verification*

- New unit test asserts the flag stays defined but hidden with the deprecation
  notice.
- Regenerated acceptance goldens: `--constraints-only` dropped from the `help`
  listing; the `constraints-only` and `constraints-only-existing` runs now show
  the stderr deprecation line (stdout JSON unchanged, schemaVersion still 1).
- `gofmt`, `go vet ./cmd/environments`, `go test ./cmd/environments`, and
  `go build ./...` all clean.

Co-authored-by: Isaac <no-reply@databricks.com>
@rugpanov
rugpanov force-pushed the setup-local/deprecate-constraints-only branch from 407ed7a to c049d70 Compare September 1, 2026 16:25
@rugpanov
rugpanov marked this pull request as ready for review September 2, 2026 07:40
@rugpanov
rugpanov force-pushed the setup-local/orthogonal-flags branch from 7d3ec5f to f9ffddd Compare September 3, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants