Skip to content

Mark PyDABs generated files as auto-generated - #6394

Merged
Sankalp-Mittal merged 5 commits into
mainfrom
sankalp-mittal/pydabs-mark-generated-files
Aug 28, 2026
Merged

Mark PyDABs generated files as auto-generated#6394
Sankalp-Mittal merged 5 commits into
mainfrom
sankalp-mittal/pydabs-mark-generated-files

Conversation

@Sankalp-Mittal

Copy link
Copy Markdown
Collaborator

Stacked on #6393.

The PyDABs codegen (python/codegen) writes databricks/bundles/<ns>/_models/*.py and each namespace __init__.py, but those files carried no generated-file marker. This addresses review comments on #6335 asking to mark generated files as such.

Changes

  • Header comment: prepend # Code generated by pydabs-codegen. DO NOT EDIT. in both writer paths (_write_code, _write_exports) in python/codegen/codegen/main.py, then regenerate. The regeneration diff is exactly the header (+2 lines per file) — nothing else moves.
  • .gitattributes: add a nested python/databricks/bundles/.gitattributes marking the generated _models trees and the six generated namespace __init__.py files (alerts, catalogs, jobs, pipelines, schemas, volumes) as linguist-generated. core/ and resources/ are hand-written and stay unmarked.

Verification

  • git check-attr confirms generated files are marked, hand-written files are not.
  • codegen_tests: 8 passed; pydabs-test: 220 passed.
  • ruff format + check clean on main.py.

This pull request and its description were written by Isaac.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 660d03d

Run: 33171422589

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 1 1 274 1205 4:26
💚​ aws windows 1 1 276 1203 3:30
💚​ azure linux 1 1 273 1205 4:45
💚​ azure windows 1 1 275 1203 3:30
💚​ gcp linux 1 1 274 1205 5:20
💚​ gcp windows 1 1 276 1203 3:36
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:26 azure windows TestAccept
3:24 aws windows TestAccept
3:17 gcp windows TestAccept

Sankalp-Mittal and others added 3 commits August 28, 2026 14:19
The PyDABs codegen writes databricks/bundles/<ns>/_models/*.py and each
namespace __init__.py, but those files carried no generated-file marker.

- Prepend a "# Code generated by pydabs-codegen. DO NOT EDIT." header in
  both writer paths (_write_code, _write_exports) and regenerate.
- Add a nested python/databricks/bundles/.gitattributes marking the
  generated _models trees and namespace __init__.py files as
  linguist-generated (core/ and resources/ stay hand-written).

Addresses review comments on #6335.

Co-authored-by: Isaac <no-reply@databricks.com>
Match all namespace __init__.py files and unset the hand-written core one,
instead of listing each generated namespace. New resource namespaces are
then marked automatically without touching .gitattributes.

Co-authored-by: Isaac <no-reply@databricks.com>
@Sankalp-Mittal
Sankalp-Mittal force-pushed the sankalp-mittal/pydabs-mark-generated-files branch from 8290083 to 660d03d Compare August 28, 2026 12:30
Base automatically changed from sankalp-mittal/automate-pybads-resources to main August 28, 2026 12:57
@Sankalp-Mittal
Sankalp-Mittal added this pull request to the merge queue Aug 28, 2026
Merged via the queue into main with commit 1b4d6d1 Aug 28, 2026
28 checks passed
@Sankalp-Mittal
Sankalp-Mittal deleted the sankalp-mittal/pydabs-mark-generated-files branch August 28, 2026 13:16
hejcman-enverus pushed a commit to hejcman-enverus/databricks_cli that referenced this pull request Sep 3, 2026
## Changes

- Update `tools/validate_nextchanges.py` to be more opinionated:
  - Leading bullet `*` required
  - All `databricks#123` numbers are expanded github links (issues and PRs)
  - Ends in a bullet and has trailing PR in parentheses.
- Trailing PR link is skipped if no PR is associated to the
branch/commit (e.g. while locally developing)
- Remove `tools/update_github_links.py` and have all link validation be
done in `tools/validate_nextchanges.py`
- `.github/workflows/changelog-preview.yml` workflow (runs on PRs and
pushes to main) does strict validation on the PR being added to new
fragments

## Why

We've been skipping PR numbers/links for a few releases. This enforces
it.

## Tests

Added 4 test.md files (see
https://github.com/databricks/cli/tree/99d5458b3248482f21e2b5f12568bbd8d74d6c44/.nextchanges/cli)

Workflow validation of test files added to this PR:
```
/home/runner/work/cli/cli/.nextchanges/cli/test1.md: must start with a "* " bullet marker
/home/runner/work/cli/cli/.nextchanges/cli/test2.md: unexpanded reference databricks#123: write it as a markdown link, e.g. [databricks#123](databricks#123)
/home/runner/work/cli/cli/.nextchanges/cli/test3.md: trailing PR link databricks#6394 must include the PR that added this fragment (databricks#6395)
```

When fixing the PR attribution in test3.md to 6395 locally and running
`task changelog-preview` it passes (because locally the test calls `gh`
and associates the branch to an open PR). If running locally before
opening a PR (or quickly renaming branch) the test passes since we don't
enforce PR link logic there.


Valid entries look like this (`task changelog-preview`):
```
## Release v1.15.0 (2026-08-27)

### CLI

 * This is an entry. ([databricks#6395](databricks#6395))
 * This is another entry. This feature was developed in a stack of PRs. ([databricks#6394](databricks#6394), [databricks#6395](databricks#6395))
```

---------

Co-authored-by: Isaac <no-reply@databricks.com>
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.

3 participants