Initialize a standalone pipeline repository from packaged template resources.
Functions:
| Name |
Description |
init |
Create a standalone pipeline repository with a working example.
|
Functions:
init
init(
destination: Annotated[
Path | None,
Argument(
help="Path for the new pipeline repository."
),
] = None,
) -> None
Create a standalone pipeline repository with a working example.
Source code in tsdat/cli/init.py
| def init(
destination: Annotated[
Path | None, typer.Argument(help="Path for the new pipeline repository.")
] = None,
) -> None:
"""Create a standalone pipeline repository with a working example."""
if destination is None:
destination = Path(
typer.prompt("Where should the new pipeline repository be created?")
)
if destination.exists() or destination.is_symlink():
raise typer.BadParameter(f"Destination already exists: {destination}")
template = resources.files("tsdat").joinpath("templates", "pipeline_project")
if not template.is_dir():
raise RuntimeError("Packaged pipeline project template is missing.")
destination = destination.absolute()
destination.mkdir(parents=True)
try:
_copy_tree(template, destination)
except Exception:
# Never remove a pre-existing directory; this command only creates new ones.
import shutil
shutil.rmtree(destination)
raise
typer.echo(f"Created pipeline repository at {destination}")
typer.echo(f"Next: cd {destination} && pip install -r requirements-dev.txt")
typer.echo("Then: tsdat create-pipeline ingest (or vap)")
|