pipeline (new pipeline generator)
What it is
Creates a new pipeline scaffold by copying a predefined template into a destination directory, using a PascalCase pipeline name.
Public API
new_pipeline(pipeline_name: str, pipeline_path: str = ".", extra_values: dict = {})- Normalizes
pipeline_nameto PascalCase. - Resolves
pipeline_path("."→ current working directory). - Ensures the destination directory exists.
- Copies the pipeline template from the package templates into the destination via
Copier, passing template variables.
- Normalizes
- CLI command:
new pipeline PIPELINE_NAME [PIPELINE_PATH]- Implemented by
_new_pipeline(pipeline_name, pipeline_path)(Click command handler) which callsnew_pipeline.
- Implemented by
Configuration/Dependencies
- Filesystem
- Creates
pipeline_pathif it does not exist (os.makedirs(..., exist_ok=True)).
- Creates
- Template source
- Templates are loaded from:
<naas_abi_cli package dir>/cli/new/templates/pipeline
- Templates are loaded from:
- Python dependencies
clickfor CLI integration.naas_abi_cli.cli.utils.Copier.Copierfor template copying..utils.to_pascal_casefor name normalization.
Usage
As a function
from naas_abi_cli.cli.new.pipeline import new_pipeline
new_pipeline("my_pipeline", "./out")
Via CLI
naas-abi-cli new pipeline my_pipeline ./out
Caveats
extra_valueshas a mutable default ({}); avoid mutating it inside callers.- The template variable
pipeline_name_pascalis always provided; any key inextra_valueswith the same name will be overwritten by the built-in value.