Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion experimental/python/codegen/codegen/packages.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import re
from typing import Optional

# All supported resource types and their namespace
# All supported resource types and their namespace.
#
# We put each resource type into own package and don't do cross-package imports,

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.

"don't do cross-package imports" isn't quite what the generated code does: every file under jobs/_models and pipelines/_models imports from databricks.bundles.core (Resource, VariableOr, ...), it's only the resource packages that never import each other. Can we say that instead, e.g. "Resource packages never import from each other, only from databricks.bundles.core; every type reachable from a resource is generated into that resource's package"?

# each package is self-contained. If two resources share the same datatype, it's
# duplicated to allow independent evolution.
#
# The convention is that each resource type uses a plural name as package name,
# e.g., "resources.Job" -> "jobs", "resources.Pipeline" -> "pipelines".
RESOURCE_NAMESPACE = {
"resources.Job": "jobs",
"resources.Pipeline": "pipelines",
Expand Down