Skip to content
Draft
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions .codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"api_changelog": true,
"formatter": "go run golang.org/x/tools/cmd/goimports@latest -w $FILENAMES && go fmt ./...",
"version": {
"experimental/python/README.md": "version $VERSION or above",
"experimental/python/databricks/bundles/version.py": "__version__ = \"$VERSION\"",
"experimental/python/pyproject.toml": "version = \"$VERSION\"",
"experimental/python/uv.lock": "name = \"databricks-bundles\"\nversion = \"$VERSION\"",
"python/README.md": "version $VERSION or above",
"python/databricks/bundles/version.py": "__version__ = \"$VERSION\"",
"python/pyproject.toml": "version = \"$VERSION\"",
"python/uv.lock": "name = \"databricks-bundles\"\nversion = \"$VERSION\"",
"libs/template/templates/experimental-jobs-as-code/library/versions.tmpl": "{{define \"latest_databricks_bundles_version\" -}}$VERSION{{- end}}",
"libs/template/templates/default/library/versions.tmpl": "{{define \"latest_databricks_bundles_version\" -}}$VERSION{{- end}}"
},
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ jobs:
version: "0.6.5"

- name: Verify that python/codegen is up to date
working-directory: experimental/python
working-directory: python
run: |-
make codegen

if ! ( git diff --exit-code ); then
echo "Generated Python code is not up-to-date. Please run 'pushd experimental/python && make codegen' and commit the changes."
echo "Generated Python code is not up-to-date. Please run 'pushd python && make codegen' and commit the changes."

exit 1
fi
10 changes: 5 additions & 5 deletions .github/workflows/python_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
pull_request:
types: [opened, synchronize]
paths:
- experimental/python/**
- python/**
merge_group:
types: [checks_requested]
paths:
- experimental/python/**
- python/**
push:
# Always run on push to main. The build cache can only be reused
# if it was saved by a run from the repository's default branch.
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
version: "0.6.5"

- name: Run tests
working-directory: experimental/python
working-directory: python
run: make test

python_linters:
Expand All @@ -56,7 +56,7 @@ jobs:
version: "0.6.5"

- name: Run lint
working-directory: experimental/python
working-directory: python
run: make lint

python_docs:
Expand All @@ -73,5 +73,5 @@ jobs:
version: "0.6.5"

- name: Run docs
working-directory: experimental/python
working-directory: python
run: make docs
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ jobs:
version: "0.6.5"

- name: Build wheel
working-directory: experimental/python
working-directory: python
run: make build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
packages-dir: experimental/python/dist
packages-dir: python/dist
4 changes: 2 additions & 2 deletions .wsignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.codegen/_openapi_sha
.release_metadata.json
bundle/schema/jsonschema.json
experimental/python/docs/images/databricks-logo.svg
python/docs/images/databricks-logo.svg
**/*.dist-info/METADATA
**/*.dist-info/WHEEL

Expand All @@ -25,7 +25,7 @@ cmd/workspace/**/*.go
cmd/account/**/*.go

# Extra whitespace in generated Python models
experimental/python/databricks/bundles/*/_models/*.py
python/databricks/bundles/*/_models/*.py

# Developed elsewhere:
internal/genkit/tagging.py
Expand Down
2 changes: 1 addition & 1 deletion acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ func buildDatabricksBundlesWheel(t *testing.T, buildDir string) string {
// so we prepare here by keeping only one.
_ = prepareWheelBuildDirectory(t, buildDir)

RunCommand(t, []string{"uv", "build", "--no-cache", "-q", "--wheel", "--out-dir", buildDir}, "../experimental/python")
RunCommand(t, []string{"uv", "build", "--no-cache", "-q", "--wheel", "--out-dir", buildDir}, "../python")

latestWheel := prepareWheelBuildDirectory(t, buildDir)
if latestWheel == "" {
Expand Down
2 changes: 1 addition & 1 deletion bundle/config/mutator/python/python_mutator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func TestGetOps_PyDABs(t *testing.T) {
},
}, PythonMutatorPhaseLoadResources)

assert.Error(t, err, "experimental/pydabs is deprecated, use experimental/python instead (https://docs.databricks.com/dev-tools/bundles/python)")
assert.Error(t, err, "experimental/pydabs is deprecated, use python instead (https://docs.databricks.com/dev-tools/bundles/python)")
}

func TestGetOps_empty(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion libs/dyn/dynvar/ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
var (
// !!! Should be in sync with _variable_regex in Python code.
// !!!
// !!! See experimental/python/databricks/bundles/core/_transform.py
// !!! See python/databricks/bundles/core/_transform.py
baseVarDef = `[a-zA-Z]+([-_]*[a-zA-Z0-9]+)*`
re = regexp.MustCompile(fmt.Sprintf(`\$\{(%s(\.%s(\[[0-9]+\])*)*(\[[0-9]+\])*)\}`, baseVarDef, baseVarDef))
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion experimental/python/README.md → python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Python for Databricks Asset Bundles extends [Databricks Asset Bundles](https://d

Documentation is available at https://docs.databricks.com/dev-tools/cli/databricks-cli.html.

Reference documentation is available at https://databricks.github.io/cli/experimental/python/
Reference documentation is available at https://databricks.github.io/cli/python/

## Getting started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,9 @@ def _parse_bool(value) -> Optional[bool]:

def _load_spec() -> dict:
path = (
Path(__file__).parent # ./experimental/python/codegen/codegen
/ ".." # ./experimental/python/codegen
/ ".." # ./experimental/python/
/ ".." # ./experimental
Path(__file__).parent # ./python/codegen/codegen
/ ".." # ./python/codegen
/ ".." # ./python/
/ ".." # ./
/ "./bundle/schema/jsonschema.json"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"resources.Pipeline": "pipelines",
"resources.Schema": "schemas",
"resources.Volume": "volumes",
"resources.DatabaseInstance": "databaseinstances",
}

RESOURCE_TYPES = list(RESOURCE_NAMESPACE.keys())
Expand All @@ -15,11 +16,12 @@
#
# We can't load all types because of errors while loading some of them.
LOADED_NAMESPACES = [
"catalog",
"compute",
"database",
"jobs",
"pipelines",
"resources",
"catalog",
]

RENAMES = {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _read_conf(input: dict) -> tuple[_Conf, Diagnostics]:
return (
_Conf(),
Diagnostics.create_error(
"'experimental/pydabs' is not supported by 'databricks-bundles', use 'experimental/python' instead",
"'experimental/pydabs' is not supported by 'databricks-bundles', use 'python' instead",
detail="",
location=None,
path=("experimental", "pydabs"),
Expand Down
56 changes: 56 additions & 0 deletions python/databricks/bundles/databaseinstances/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
__all__ = [
"CustomTag",
"CustomTagDict",
"CustomTagParam",
"DatabaseInstance",
"DatabaseInstanceDict",
"DatabaseInstanceParam",
"DatabaseInstancePermission",
"DatabaseInstancePermissionDict",
"DatabaseInstancePermissionLevel",
"DatabaseInstancePermissionLevelParam",
"DatabaseInstancePermissionParam",
"DatabaseInstanceRef",
"DatabaseInstanceRefDict",
"DatabaseInstanceRefParam",
"DatabaseInstanceState",
"DatabaseInstanceStateParam",
"Lifecycle",
"LifecycleDict",
"LifecycleParam",
]


from databricks.bundles.databaseinstances._models.custom_tag import (
CustomTag,
CustomTagDict,
CustomTagParam,
)
from databricks.bundles.databaseinstances._models.database_instance import (
DatabaseInstance,
DatabaseInstanceDict,
DatabaseInstanceParam,
)
from databricks.bundles.databaseinstances._models.database_instance_permission import (
DatabaseInstancePermission,
DatabaseInstancePermissionDict,
DatabaseInstancePermissionParam,
)
from databricks.bundles.databaseinstances._models.database_instance_permission_level import (
DatabaseInstancePermissionLevel,
DatabaseInstancePermissionLevelParam,
)
from databricks.bundles.databaseinstances._models.database_instance_ref import (
DatabaseInstanceRef,
DatabaseInstanceRefDict,
DatabaseInstanceRefParam,
)
from databricks.bundles.databaseinstances._models.database_instance_state import (
DatabaseInstanceState,
DatabaseInstanceStateParam,
)
from databricks.bundles.databaseinstances._models.lifecycle import (
Lifecycle,
LifecycleDict,
LifecycleParam,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from dataclasses import dataclass
from typing import TYPE_CHECKING, TypedDict

from databricks.bundles.core._transform import _transform
from databricks.bundles.core._transform_to_json import _transform_to_json_value
from databricks.bundles.core._variable import VariableOrOptional

if TYPE_CHECKING:
from typing_extensions import Self


@dataclass(kw_only=True)
class CustomTag:
""""""

key: VariableOrOptional[str] = None
"""
The key of the custom tag.
"""

value: VariableOrOptional[str] = None
"""
The value of the custom tag.
"""

@classmethod
def from_dict(cls, value: "CustomTagDict") -> "Self":
return _transform(cls, value)

def as_dict(self) -> "CustomTagDict":
return _transform_to_json_value(self) # type:ignore


class CustomTagDict(TypedDict, total=False):
""""""

key: VariableOrOptional[str]
"""
The key of the custom tag.
"""

value: VariableOrOptional[str]
"""
The value of the custom tag.
"""


CustomTagParam = CustomTagDict | CustomTag
Loading
Loading