Skip to content

yggdrasil.databricks.wheels

wheels

Wheel registry — build/upload/deploy/browse wheels in the workspace.

dbc.wheels (the :class:Wheels service) is the front door; the module-level functions in :mod:yggdrasil.databricks.wheels.service carry the build/upload machinery and stay importable for the internals that compose them.

Wheels

Wheels(client: Optional[DatabricksClient] = None)

Bases: DatabricksService

CRUD over the workspace wheel registry (dbc.wheels).

A wheel is keyed by (project, version). :meth:create fetches it from a local project or PyPI and uploads it; :meth:find returns it, building it on a miss; :meth:update / :meth:delete re-fetch / remove it.

wheels property

wheels: 'Wheels'

Wheel registry service (shorthand for client.wheels).

environments property

environments: 'Environments'

Base-environment service (shorthand for client.environments).

tables property

tables: 'Tables'

Collection-level Unity Catalog table service (shorthand for client.tables).

views property

views: 'Tables'

Alias for :attr:tables — :class:Table covers both managed/external tables and view-shaped securables.

catalogs property

catalogs: 'Catalogs'

Collection-level Unity Catalog hierarchy service (shorthand for client.catalogs).

schemas property

schemas: 'Schemas'

Collection-level Unity Catalog schema service (shorthand for client.schemas).

volumes property

volumes: 'Volumes'

Collection-level Unity Catalog volume service (shorthand for client.volumes).

genie property

genie: 'Genie'

Genie service (shorthand for client.genie).

ai property

ai: 'DatabricksAI'

Databricks AI umbrella service (shorthand for client.ai).

default_tags

default_tags(update: bool = True) -> dict[str, str]

Return default resource tags for Databricks assets.

Returns:

Type Description
dict[str, str]

A dict of default tags.

create

create(
    project: "str | Path" = "ygg",
    version: "str | VersionInfo | None" = None,
    *,
    python: "str | None" = None,
    extras: "tuple[str, ...] | list[str]" = (),
    deps: bool = False,
    workspace_dir: "str | None" = None,
    overwrite: bool = True,
    rebuild: bool = False
) -> "list[Wheel]"

Fetch project (a local pyproject path or a PyPI name) at version and upload its wheel(s) to the registry — project wheel first. With deps the whole zero-PyPI closure is uploaded too.

update

update(
    project: "str | Path" = "ygg",
    version: "str | VersionInfo | None" = None,
    **kwargs: Any
) -> "list[Wheel]"

Re-fetch and overwrite project's wheel(s) in the registry.

list

list(
    project: "str | None" = None, *, workspace_dir: "str | None" = None
) -> "list[Wheel] | list[str]"

Browse the registry: the :class:Wheel s under project's folder, or the distribution folder names when project is None.

get

get(
    project: "str | Path" = "ygg",
    version: "str | VersionInfo | None" = None,
    *,
    python: "str | None" = None,
    workspace_dir: "str | None" = None
) -> "Optional[Wheel]"

The deployed wheel for project (matching version / python), or None — never builds. See :meth:find to build on a miss.

find

find(
    project: "str | Path" = "ygg",
    version: "VersionInfo | str | None" = None,
    *,
    install: bool = True,
    python: "str | None" = None,
    extras: "tuple[str, ...] | list[str]" = (),
    workspace_dir: "str | None" = None
) -> "Optional[Wheel]"

Find project's wheel in the registry; build + upload it (from a local pyproject or PyPI) when missing and install (the default).

delete

delete(
    project: "str | Path" = "ygg",
    version: "str | VersionInfo | None" = None,
    *,
    workspace_dir: "str | None" = None
) -> "list[Wheel]"

Delete project's wheel(s) from the registry (a specific version, or every version when omitted). Returns the wheels removed.

Wheel

Wheel(service=None, *, path: str)

Bases: DatabricksResource

A deployed wheel — <dist>-<version>-<pytag>.whl in the registry.

explore_url property

explore_url: Optional[URL]

Workspace UI deep-link for this resource, or None.

Concrete resources (:class:Catalog, :class:Schema, :class:Volume, :class:Table, :class:SQLWarehouse, :class:Job, :class:VolumePath, …) override this to return the /explore/data/... / /sql/warehouses/... / /jobs/... URL that opens the resource in the workspace UI. The inherited :class:ExploreUrlRepr keys off the override — anything that returns a non-None URL gets a ClassName(<url>) repr (and a clickable _repr_html_) for free without restating it on every subclass.

sql property

sql: 'SQLEngine'

Shorthand for self.service.client.sql — the active :class:SQLEngine.

download

download(dest: 'str | _LocalPath') -> _LocalPath

Pull the wheel down to local dest (a file or directory).

serverless_environment_version

serverless_environment_version(python: 'str | None' = None) -> str

The serverless environment_version whose runtime Python matches python.

environment_key_for

environment_key_for(python: 'str | None' = None) -> str

The serverless environment_key for a Python (3.11"py311").

parse_version

parse_version(text: 'str | VersionInfo | None') -> 'Optional[VersionInfo]'

Parse text into a :class:VersionInfo, or None if it can't be read.

Tolerates wheel-filename escaping (0_8_57 / 0-8-57) and a PEP 440 local segment (0.8.57+host.x0.8.57).

wheel_parts

wheel_parts(filename: 'str | Path') -> 'tuple[str, Optional[VersionInfo], str]'

(dist, version, pytag) parsed from a wheel filename.

wheel_for_python

wheel_for_python(wheels: 'list', python: 'str | None' = None) -> str

Pick the wheel matching python (a cp3XX build, else the universal py3-none-any wheel, else the first). Returns a string path.

distribution_for

distribution_for(package: str) -> str

The distribution (pip) name providing import package (yggdrasilygg); falls back to package.

An explicit :data:PROJECT_ALIASES entry (extendable via YGG_DATABRICKS_PROJECT_ALIASES) wins first, so a project deploys under one canonical distribution regardless of whether its metadata is installed locally; otherwise the import → distribution mapping is read from installed metadata.

runtime_dependencies

runtime_dependencies(
    project: str = "ygg",
    extras: "tuple[str, ...] | list[str]" = ("databricks",),
) -> "list[str]"

project's declared runtime dependencies as index requirement specs (names + version pins), for a Spark Connect / cluster install that resolves them from the index. Bare names are pinned to their installed version so the registry doesn't mistake an unpinned dep for a local package.

find_pyproject

find_pyproject(start: 'str | Path | None' = None) -> 'Optional[Path]'

The nearest pyproject.toml at or above start (cwd by default), or None when start isn't a real local path / has no project on the way up.

project_display_name

project_display_name(name: str) -> str

A nice, capitalized display name for a project — each word capitalized (my-appMy App, meteologicaMeteologica).

read_pyproject

read_pyproject(path: 'str | Path') -> 'dict[str, Any]'

Parse a pyproject.toml's [project] into name / version / dependencies / optional_dependencies / requires_python / dir.

fetch_wheels

fetch_wheels(
    spec: "str | Path",
    version: "str | None" = None,
    *,
    python: "str | None" = None,
    deps: bool = False,
    extras: "tuple[str, ...] | list[str]" = (),
    rebuild: bool = False
) -> "list[Path]"

Resolve spec into local wheel files (project wheel first), via the local cache. A path with a pyproject.toml is built; otherwise spec is a PyPI project downloaded by name. With deps the full closure is fetched.

registry_upload

registry_upload(
    client: Any,
    wheel: "str | Path",
    *,
    workspace_dir: str = WORKSPACE_PYPI_DIR,
    overwrite: bool = False
) -> str

Upload wheel to <workspace_dir>/<dist>/<version>/<wheel> and return the path — distribution and version are folder levels, so the registry browses like a PEP 503 index. An already-present, immutable wheel is reused unless overwrite.