Skip to main content
Version: 1.27.0 (latest)

dlt._workspace.deployment.requirements

Export, save, load, and migrate TWorkspaceRequirementsManifest — the wire format for workspace dependencies shipped to the runtime. Supports requirements.txt and requirements.in. If uv installed - supports pyproject with dependency groups and uv/PEP lock files. poetry/PDM support can be easily added.

TInstallSpec Objects

class TInstallSpec(TypedDict)

View source on GitHub

How a Python package is installed, derived from PEP 610 direct_url.json.

WorkspaceRequirementsError Objects

class WorkspaceRequirementsError(Exception)

View source on GitHub

Raised when a workspace's dependency files cannot be exported.

get_dlt_requirement_spec

def get_dlt_requirement_spec() -> str

View source on GitHub

PEP 508 spec for the currently installed dlt distribution, deployment-mode.

get_pkg_install_spec

def get_pkg_install_spec(pkg_name: str,
*,
extras: Optional[List[str]] = None) -> TInstallSpec

View source on GitHub

Classify the install of pkg_name as pypi / path / editable / git.

render_pep508

def render_pep508(spec: TInstallSpec, *, for_deployment: bool) -> str

View source on GitHub

PEP 508 line for [project.dependencies] / top-of-requirements.txt.

Arguments:

  • spec - Install spec to render.
  • for_deployment - When True, render a portable line (editable becomes a version pin; path/git become PEP 508 direct refs). When False (used for scaffolding), emit a version pin so [tool.uv.sources] can carry the override.

render_uv_source

def render_uv_source(spec: TInstallSpec) -> Optional[Dict[str, Any]]

View source on GitHub

[tool.uv.sources][<name>] value, or None when a direct ref in deps suffices.

render_requirements_lines

def render_requirements_lines(spec: TInstallSpec) -> List[str]

View source on GitHub

Lines for requirements.txt reproducing spec. Editable becomes -e <path>.

get_workspace_install_specs

def get_workspace_install_specs() -> List[TInstallSpec]

View source on GitHub

Specs for dlt[hub] + dlthub + dlthub-client, skipping ones not installed.

python_version

def python_version() -> str

View source on GitHub

Current interpreter's major.minor version, e.g. "3.12".

build_launcher_requirements

def build_launcher_requirements() -> Dict[str, List[str]]

View source on GitHub

Per-launcher mandatory specs. dlt is injected separately at build time.

build_dashboard_group

def build_dashboard_group() -> List[str]

View source on GitHub

Specs for the DASHBOARD_JOB_REF group.

default_requirements_manifest

def default_requirements_manifest() -> TWorkspaceRequirementsManifest

View source on GitHub

Minimal manifest: empty main, dashboard group, launcher specs with dlt injected.

export_workspace_requirements

def export_workspace_requirements(
workspace_root: Path,
default_groups: Optional[List[str]] = None
) -> TWorkspaceRequirementsManifest

View source on GitHub

Export a workspace's dependencies as a TWorkspaceRequirementsManifest.

If no default group names dlt, the installed dlt spec is injected into the launcher baseline so every job gets it.

Arguments:

  • workspace_root Path - Workspace directory.
  • default_groups Optional[List[str]] - Manifest-level default_groups. Defaults to ["main"].

Returns:

  • TWorkspaceRequirementsManifest - Always contains a main entry in groups.

Raises:

  • WorkspaceRequirementsError - uv.lock out of sync, uv failure, or parse error.

migrate_requirements

def migrate_requirements(manifest_dict: DictStrAny, from_engine: int,
to_engine: int) -> TWorkspaceRequirementsManifest

View source on GitHub

Migrate a requirements manifest dict between engine versions.

save_requirements

def save_requirements(req: TWorkspaceRequirementsManifest,
f: BinaryIO) -> None

View source on GitHub

Serialize a requirements manifest as typed JSON.

load_requirements

def load_requirements(f: BinaryIO) -> TWorkspaceRequirementsManifest

View source on GitHub

Read, migrate, and validate a requirements manifest.

is_uv_available

def is_uv_available() -> bool

View source on GitHub

Return True if the uv binary is on PATH.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.