hydra.build.assembly module
Type-level model of a distribution package’s assembly plan: the ordered copy/symlink entries and keep-paths that a host-native executor realizes on disk when merging overlay source onto a generated distribution package. Factors the copy(overlay/<lang>/<pkg>/) half of the governing equation into data, so the per-host copy scripts share one translingual description. See https://github.com/CategoricalData/hydra/issues/416.
- class hydra.build.assembly.AssemblyEntry(source_tree: Annotated[str, 'The source tree to realize, as a worktree-relative path (e.g. overlay/<lang>/<pkg>/src)'], dest_tree: Annotated[str, 'The destination tree, as a worktree-relative path (e.g. dist/<lang>/<pkg>/src)'], kind: Annotated[AssemblyEntryKind, 'How the source tree is realized at the destination'], exclude: Annotated[Sequence[str], 'Relative path fragments to exclude when realizing the entry (e.g. __pycache__); empty means copy everything'])
Bases:
objectA single copy-or-link operation in an assembly plan: realize a source tree at a destination tree by the given kind, optionally excluding matching relative paths.
- class Builder(_source_tree: 'str' = None, _dest_tree: 'str' = None, _kind: 'AssemblyEntryKind' = None, _exclude: 'Sequence[str]' = None)
Bases:
object- build()
- dest_tree(dest_tree)
- exclude(exclude)
- kind(kind)
- source_tree(source_tree)
- DEST_TREE = Name(value='destTree')
- EXCLUDE = Name(value='exclude')
- KIND = Name(value='kind')
- SOURCE_TREE = Name(value='sourceTree')
- TYPE_ = Name(value='hydra.build.assembly.AssemblyEntry')
- static builder()
- dest_tree: Annotated[str, 'The destination tree, as a worktree-relative path (e.g. dist/<lang>/<pkg>/src)']
- exclude: Annotated[Sequence[str], 'Relative path fragments to exclude when realizing the entry (e.g. __pycache__); empty means copy everything']
- kind: Annotated[AssemblyEntryKind, 'How the source tree is realized at the destination']
- source_tree: Annotated[str, 'The source tree to realize, as a worktree-relative path (e.g. overlay/<lang>/<pkg>/src)']
- with_dest_tree(dest_tree)
- with_exclude(exclude)
- with_kind(kind)
- with_source_tree(source_tree)
- class hydra.build.assembly.AssemblyEntryKind(*values)
Bases:
EnumHow an assembly entry’s source tree is realized at its destination. The distinction gates the host-native executor’s dispatch (merge-copy vs. wipe-then-copy vs. symlink).
- MERGE = Name(value='merge')
Merge-copy the source tree’s files into the destination, leaving pre-existing files intact
- SYMLINK_DIR = Name(value='symlinkDir')
Symlink the source directory itself into the destination as a single directory link
- SYMLINK_TREE = Name(value='symlinkTree')
Symlink each of the source tree’s files into the destination (per-file links; own real files win)
- TYPE_ = Name(value='hydra.build.assembly.AssemblyEntryKind')
- WIPE_THEN_COPY = Name(value='wipeThenCopy')
Remove the destination tree entirely, then copy the source tree (an exact-mirror replacement)
- class hydra.build.assembly.AssemblyPlan(entries: Annotated[Sequence[AssemblyEntry], 'The copy/symlink entries to realize, in application order'], keep_paths: Annotated[Sequence[KeepPathEntry], 'The files this plan is responsible for, recorded so a prune-stale pass does not delete them'])
Bases:
objectThe complete assembly plan for one distribution package in one target language: the ordered copy/symlink entries to realize and the keep-paths a pruning consumer must protect. Entries are ordered because realization order can matter (e.g. a package that links its own subtree back into an already-assembled dependency’s tree).
- class Builder(_entries: 'Sequence[AssemblyEntry]' = None, _keep_paths: 'Sequence[KeepPathEntry]' = None)
Bases:
object- build()
- entries(entries)
- keep_paths(keep_paths)
- ENTRIES = Name(value='entries')
- KEEP_PATHS = Name(value='keepPaths')
- TYPE_ = Name(value='hydra.build.assembly.AssemblyPlan')
- static builder()
- entries: Annotated[Sequence[AssemblyEntry], 'The copy/symlink entries to realize, in application order']
- keep_paths: Annotated[Sequence[KeepPathEntry], 'The files this plan is responsible for, recorded so a prune-stale pass does not delete them']
- with_entries(entries)
- with_keep_paths(keep_paths)
- class hydra.build.assembly.KeepPathEntry(source_set_dir: Annotated[str, 'The source-set directory the file belongs to, as a worktree-relative path'], rel_path: Annotated[str, "The file's path relative to its source-set directory"])
Bases:
objectOne protected path in a keep-paths manifest: a source-set directory paired with a file’s path relative to it. Serialized by the native executor as <sourceSetDir>t<relPath>, bit-compatible with the prune-stale (#357) and digest-check –keep-paths-from consumers.
- class Builder(_source_set_dir: 'str' = None, _rel_path: 'str' = None)
Bases:
object- build()
- rel_path(rel_path)
- source_set_dir(source_set_dir)
- REL_PATH = Name(value='relPath')
- SOURCE_SET_DIR = Name(value='sourceSetDir')
- TYPE_ = Name(value='hydra.build.assembly.KeepPathEntry')
- static builder()
- rel_path: Annotated[str, "The file's path relative to its source-set directory"]
- source_set_dir: Annotated[str, 'The source-set directory the file belongs to, as a worktree-relative path']
- with_rel_path(rel_path)
- with_source_set_dir(source_set_dir)