Skip to content

PythonPackage

laktory.models.resources.databricks.PythonPackage ¤

Bases: BaseModel, PulumiResource, TerraformResource

Python Package built and deployed as a wheel file.

This resource type allows to target a local python package to generate a wheel file that will be built at deploy and deployed as a WorkspaceFile.

Examples:

import laktory as lk

pp = lk.models.resources.databricks.PythonPackage(
    package_name="lake",
    config_filepath="lake/pyproject.toml",
    dirpath="/wheels/",
)
PARAMETER DESCRIPTION
access_controls

Access controls list

TYPE: list[AccessControl | VariableType] | VariableType DEFAULT: []

build_command

The build command used to generate the wheel file.

TYPE: str | VariableType DEFAULT: 'uv build --wheel'

config_filepath

File path of the pyproject.toml file or setup.py configuration file.

TYPE: str | VariableType

dirpath

Workspace directory inside rootpath in which the workspace file is deployed. Used only if path is not specified.

TYPE: str | VariableType DEFAULT: None

package_name

Name of the package

TYPE: str | VariableType

path_

Workspace filepath for the file. Overwrite rootpath and dirpath.

TYPE: str | VariableType DEFAULT: None

METHOD DESCRIPTION
get_path

Get workspace path

ATTRIBUTE DESCRIPTION
filename

File filename

TYPE: str | None

resource_key

package name

TYPE: str

filename property ¤

File filename

resource_key property ¤

package name

get_path() ¤

Get workspace path

Source code in laktory/models/resources/databricks/pythonpackage.py
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
def get_path(self):
    """Get workspace path"""
    # Path set
    if self.path_:
        return self.path_

    if not self.source:
        return None

    # dir
    if self.dirpath is None:
        self.dirpath = ""
    if self.dirpath.startswith("/"):
        self.dirpath = self.dirpath[1:]

    # path
    _path = Path(settings.workspace_root) / self.dirpath / self.filename

    return _path.as_posix()