yggdrasil.databricks.wheels.service¶
service ¶
Wheel registry — uniform CRUD over the workspace PyPI-like index.
A wheel is identified by (project, version). The registry is a PEP 503-style
layout under /Workspace/Shared/pypi/<dist>/<version>/ — distribution and
version are folder levels — holding the .whl files.
Every project — ygg included — is handled identically; there is no special
casing.
create fetches the wheel and uploads it:
- a local path (a directory/file with a
pyproject.toml) is built from source (uv build), so "deploy the project I'm working on" just works; - anything else is treated as a PyPI project and downloaded
(
pip download).
Fetches land in a local on-disk cache first (~ tmp/yggdrasil/wheel-cache) so
repeated builds/downloads/uploads are cheap. The :class:Wheels service
(dbc.wheels) is the front door; versions are parsed and compared with
:class:yggdrasil.version.VersionInfo.
Wheels ¶
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.
environments
property
¶
Base-environment service (shorthand for client.environments).
tables
property
¶
Collection-level Unity Catalog table service (shorthand for client.tables).
views
property
¶
Alias for :attr:tables — :class:Table covers both managed/external
tables and view-shaped securables.
catalogs
property
¶
Collection-level Unity Catalog hierarchy service (shorthand for client.catalogs).
schemas
property
¶
Collection-level Unity Catalog schema service (shorthand for client.schemas).
volumes
property
¶
Collection-level Unity Catalog volume service (shorthand for client.volumes).
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.
default_tags ¶
Return default resource tags for Databricks assets.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
A dict of default tags. |
serverless_environment_version ¶
The serverless environment_version whose runtime Python matches python.
environment_key_for ¶
The serverless environment_key for a Python (3.11 → "py311").
parse_version ¶
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.x → 0.8.57).
wheel_parts ¶
(dist, version, pytag) parsed from a wheel filename.
wheel_for_python ¶
Pick the wheel matching python (a cp3XX build, else the universal
py3-none-any wheel, else the first). Returns a string path.
distribution_for ¶
The distribution (pip) name providing import package (yggdrasil →
ygg); 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 ¶
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 ¶
A nice, capitalized display name for a project — each word capitalized
(my-app → My App, meteologica → Meteologica).
read_pyproject ¶
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.