-
Notifications
You must be signed in to change notification settings - Fork 233
Generate PyDABs reference doc pages from generated modules #6727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| databricks-bundles | ||
| -------------------------------- | ||
|
|
||
| `databricks-bundles` package implements Python support for Declarative Automation Bundles. | ||
|
|
||
| See `What is Python support for Declarative Automation Bundles? (TBD) <#>`_. | ||
|
|
||
|
|
||
| .. toctree:: | ||
| :maxdepth: 7 | ||
|
|
||
| ${toctree} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| ${title} | ||
| =============================== | ||
|
|
||
| .. currentmodule:: ${module} | ||
|
|
||
| **Package:** ``${module}`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: ${module} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| #!/usr/bin/env python3 | ||
| """Generate the Sphinx .rst pages from the resource module dirs under | ||
| databricks/bundles/, so the documented resource list can never drift from the | ||
| generated code. Driven by scanning the output tree, not RESOURCE_NAMESPACE. | ||
|
|
||
| The doc structure lives in the *.rst.tmpl templates so it can be reviewed | ||
| separately from this code: doc_page.rst.tmpl (one page per resource) and | ||
| doc_index.rst.tmpl (the index prose header + generated toctree).""" | ||
|
|
||
| from pathlib import Path | ||
| from string import Template | ||
|
|
||
| import codegen.packages as packages | ||
|
|
||
| # .title() mangles acronyms; override those namespaces. | ||
| _TITLE_OVERRIDES = { | ||
| "sql_warehouses": "SQL Warehouses", | ||
| "mcp_services": "MCP Services", | ||
| } | ||
|
Sankalp-Mittal marked this conversation as resolved.
|
||
|
|
||
|
|
||
| def _load_template(name: str) -> Template: | ||
| return Template((Path(__file__).parent / name).read_text()) | ||
|
|
||
|
|
||
| _PAGE_TEMPLATE = _load_template("doc_page.rst.tmpl") | ||
| _INDEX_TEMPLATE = _load_template("doc_index.rst.tmpl") | ||
|
|
||
|
|
||
| def _title(namespace: str) -> str: | ||
| return _TITLE_OVERRIDES.get(namespace, namespace.replace("_", " ").title()) | ||
|
|
||
|
|
||
| def write_docs(output: str): | ||
| docs = Path(output) / "docs" | ||
| bundles = Path(output) / "databricks" / "bundles" | ||
|
|
||
| # core is hand-written; every other package dir gets a generated page. | ||
| namespaces = sorted( | ||
| p.name | ||
| for p in bundles.iterdir() | ||
| if p.name != "core" and (p / "__init__.py").exists() | ||
| ) | ||
|
|
||
| # Drop stale pages so a removed resource loses its page; keep core.rst. | ||
| for rst in docs.glob("databricks.bundles.*.rst"): | ||
| if rst.name != "databricks.bundles.core.rst": | ||
| rst.unlink() | ||
|
|
||
| for namespace in namespaces: | ||
| module = packages.get_root_package(namespace) | ||
| page = _PAGE_TEMPLATE.substitute(title=_title(namespace), module=module) | ||
| (docs / f"databricks.bundles.{namespace}.rst").write_text(page) | ||
|
|
||
| entries = ["databricks.bundles.core"] + [ | ||
| packages.get_root_package(ns) for ns in namespaces | ||
| ] | ||
| toctree = "\n".join(f" {entry}" for entry in entries) | ||
| (docs / "index.rst").write_text(_INDEX_TEMPLATE.substitute(toctree=toctree)) | ||
|
|
||
| print(f"Writing {len(namespaces) + 1} doc pages into {docs}") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 17 additions & 13 deletions
30
python/databricks/bundles/sql_warehouses/_models/spot_instance_policy.py
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Alerts | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.alerts | ||
|
|
||
| **Package:** ``databricks.bundles.alerts`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.alerts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Apps | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.apps | ||
|
|
||
| **Package:** ``databricks.bundles.apps`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.apps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Catalogs | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.catalogs | ||
|
|
||
| **Package:** ``databricks.bundles.catalogs`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.catalogs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Cluster Policies | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.cluster_policies | ||
|
|
||
| **Package:** ``databricks.bundles.cluster_policies`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.cluster_policies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Clusters | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.clusters | ||
|
|
||
| **Package:** ``databricks.bundles.clusters`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.clusters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Dashboards | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.dashboards | ||
|
|
||
| **Package:** ``databricks.bundles.dashboards`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.dashboards |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Database Catalogs | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.database_catalogs | ||
|
|
||
| **Package:** ``databricks.bundles.database_catalogs`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.database_catalogs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Database Instances | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.database_instances | ||
|
|
||
| **Package:** ``databricks.bundles.database_instances`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.database_instances |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Experiments | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.experiments | ||
|
|
||
| **Package:** ``databricks.bundles.experiments`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.experiments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| External Locations | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.external_locations | ||
|
|
||
| **Package:** ``databricks.bundles.external_locations`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.external_locations |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Genie Spaces | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.genie_spaces | ||
|
|
||
| **Package:** ``databricks.bundles.genie_spaces`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.genie_spaces |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Instance Pools | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.instance_pools | ||
|
|
||
| **Package:** ``databricks.bundles.instance_pools`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.instance_pools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| Job Runs | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.job_runs | ||
|
|
||
| **Package:** ``databricks.bundles.job_runs`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.job_runs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| MCP Services | ||
| =============================== | ||
|
|
||
| .. currentmodule:: databricks.bundles.mcp_services | ||
|
|
||
| **Package:** ``databricks.bundles.mcp_services`` | ||
|
|
||
| Classes | ||
| --------------- | ||
|
|
||
| .. automodule:: databricks.bundles.mcp_services |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.