Registry

Image

class registry.api.image.ImageAPI(api_client)
create(
image: str,
desc: str | None = None,
overview: str | None = None,
label: List[str] | None = None,
label_set: List[str] | None = None,
logo: str | None = None,
publisher: str | None = None,
built_by: str | None = None,
multinode: bool | None = False,
display_name: str | None = None,
) Repository

Create an empty repository.

Parameters:
  • image -- Full image name without tag. <org>/[<team>/]<image>

  • desc -- Description of image. Defaults to None.

  • overview -- Overview of image. Defaults to None.

  • label -- Label of image. Defaults to None.

  • label_set -- Label set of image. Defaults to None.

  • logo -- Logo of image. Defaults to None.

  • publisher -- Publisher of image. Defaults to None.

  • built_by -- Time of image built by. Defaults to None.

  • multinode -- Is image multinode. Defaults to False.

  • display_name -- Display name of image. Defaults to None.

Raises:
  • ValueError -- If image tag is specified.

  • ResourceAlreadyExistsException -- If image not found.

Returns:

ngccli.data.registry.Repository object.

Return type:

Repository

info(
image: str,
layers: bool | None = False,
history: bool | None = False,
details: bool | None = False,
scan: bool | None = False,
) Tuple[Repository, ImageScanDetails | None] | Tuple[MetaImageDetails, GetManifestByTagResponse, List[Tuple[ImageScanDetails, str]], List[ImageArchitectureVariant]]

Image info given an image name, returns either the info of the repo, or info on an image name.

Parameters:
  • image -- Full image name. <org>/[<team>/]<image>[:<tags>]

  • layers -- Include layer of image. Defaults to False.

  • history -- Include history of image. Defaults to False.

  • details -- Include details of image. Defaults to False.

  • scan -- Include scan of image. Defaults to False.

Raises:
  • ArgumentTypeError -- If invalid input

  • ResourceNotFoundException -- If image is not found

  • AuthenticationException -- If access is denied

  • AccessDeniedException -- If access is denied

Returns:

Return depending on input image argument. If image tag is specified, return image repository and scan information If image tag is not specified, return image details, manifest, scan details and architecture variants

list(
pattern: str | None = None,
signed: bool | None = False,
access_type: str | None = None,
product_names: str | None = None,
) Generator[list[RepositorySearchTransformer], Any, None] | list

List image given a pattern, returns either the list of repos, or the list of images.

Parameters:
  • pattern -- Name or pattern of images. Defaults to None.

  • signed -- If True, output only signed images. Defaults to False.

  • access_type -- If specified, output only images with matching access type. Defaults to None.

  • product_names -- If specified, output only images with matching product name. Defaults to None.

Returns:

Returns generator of list of found images.

Return type:

Union[Generator[list[RepositorySearchTransformer], Any, None], list]

pull(image: str, scan: str | None = None) None

Pull an image from the repository.

Parameters:
  • image -- Full image name. <org>/[<team>/]<image>[:<tags>]

  • scan -- Scan options. Defaults to None.

Raises:
  • ResourceNotFoundException -- If image is not found.

  • NgcAPIError -- If image API response error.

  • NgcException -- If NGC related error.

push(
image: str,
desc: str | None = None,
overview: str | None = None,
label: List[str] | None = None,
label_set: List[str] | None = None,
logo: str | None = None,
publisher: str | None = None,
built_by: str | None = None,
multinode: bool | None = None,
display_name: str | None = None,
default_yes: bool | None = False,
output: bool | None = False,
) None

Push an image to the repository.

Parameters:
  • image -- Full image name. nvcr.io/<org>/[<team>/]<image>[:<tags>]

  • desc -- Description of image. Defaults to None.

  • overview -- Overview of image. Defaults to None.

  • label -- Label of image. Defaults to None.

  • label_set -- Label set of image. Defaults to None.

  • logo -- Logo of image. Defaults to None.

  • publisher -- Publisher of image. Defaults to None.

  • built_by -- Time of image built by. Defaults to None.

  • multinode -- Is image multinode. Defaults to None.

  • display_name -- Display name of image. Defaults to None.

  • default_yes -- Is confirmation enabled. Defaults to False.

  • output -- Is output enabled. Defaults to False.

remove(pattern: str, default_yes: bool | None = None) None

Remove a given image, or repository of images.

Parameters:
  • pattern -- Name or pattern of images. <org>/[<team>/]<image>[:<tags>]

  • default_yes -- Is confirmation enabled. Defaults to True for sdk.

Raises:
  • ArgumentTypeError -- If invalid input.

  • ResourceNotFoundException -- If image is not found.

  • AuthenticationException -- If access is denied.

update(
image: str,
desc: str | None = None,
overview: str | None = None,
labels: List[str] | None = None,
add_label: List[str] | None = None,
remove_label: List[str] | None = None,
label_set: List[str] | None = None,
logo: str | None = None,
publisher: str | None = None,
built_by: str | None = None,
multinode: bool | None = False,
no_multinode: bool | None = False,
display_name: str | None = None,
) None

Update an image metadata.

Parameters:
  • image -- Full image name. <org>/[<team>/]<image>[:<tags>]

  • desc -- Description of image. Defaults to None.

  • overview -- Overview of image. Defaults to None.

  • labels -- Labels to declare for image. Defaults to None.

  • add_label -- Labels to add to the image. Default to None.

  • remove_label -- Labels to remove from the image. Default to None.

  • label_set -- Label set to declare for image. Defaults to None.

  • logo -- Logo of image. Defaults to None.

  • publisher -- Publisher of image. Defaults to None.

  • built_by -- Time of image built by. Defaults to None.

  • multinode -- Is image multinode. Defaults to False.

  • no_multinode -- Is image not multinode. Defaults to False.

  • display_name -- Display name of image. Defaults to None.

Raises:
  • ArgumentTypeError -- If invalid input image name.

  • ArgumentTypeError -- If labels or label_set used along with add_label or remove_label.

Model

class registry.api.models.ModelAPI(api_client)
create(
target: str,
application: str,
framework: str,
model_format: str,
precision: str,
short_description: str,
overview_filename: str | None = None,
bias_filename: str | None = None,
explainability_filename: str | None = None,
privacy_filename: str | None = None,
safety_security_filename: str | None = None,
display_name: str | None = None,
label: List[str | None] = None,
label_set: List[str | None] = None,
logo: str | None = None,
public_dataset_name: str | None = None,
public_dataset_link: str | None = None,
public_dataset_license: str | None = None,
built_by: str | None = None,
publisher: str | None = None,
) Model

Create a Model.

Parameters:
  • target -- Full name of model. org/[team/]name[:version]

  • application -- Application of model.

  • framework -- Framework of model.

  • model_format -- Format of model.

  • precision -- Precision of model.

  • short_description -- Short description of model.

  • overview_filename -- Overview filename of model. Defaults to None.

  • bias_filename -- Bias_filename of model. Defaults to None.

  • explainability_filename -- Explainability filename of model. Defaults to None.

  • privacy_filename -- Privacy filename of model. Defaults to None.

  • safety_security_filename -- Safety security filename of model. Defaults to None.

  • display_name -- Display name of model. Defaults to None.

  • labels -- Label of model. Defaults to None.

  • label_sets -- Label set of model. Defaults to None.

  • logo -- Logo of model. Defaults to None.

  • public_dataset_name -- Public dataset name of model. Defaults to None.

  • public_dataset_link -- Public dataset link of model. Defaults to None.

  • public_dataset_license -- Public dataset license of model. Defaults to None.

  • built_by -- Time of model built by. Defaults to None.

  • publisher -- Publisher of model. Defaults to None.

Raises:

ResourceAlreadyExistsException -- _description_

Returns:

_description_

Return type:

Model

download_version(
target: str,
destination: str | None = '.',
file_patterns: List[str] | None = None,
exclude_patterns: List[str] | None = None,
progress_callback_func: Callable[[int, int, int, int, int, int], None] | None = None,
)

Download the specified model version.

Parameters:
  • target -- Full model name. org/[team/]name[:version]

  • destination -- Description of model. Defaults to ".".

  • file_patterns -- Inclusive filter of model files. Defaults to None.

  • exclude_patterns -- Eclusive filter of model files. Defaults to None.

  • progress_callback_func (Optional[Callable[[int, int, int, int, int, int], None]]) -- A callback function that accepts six integers representing completed_bytes, failed_bytes, total_bytes, completed_count, failed_count, and total_count respectively. If provided, this function will be called to report progress periodically. If set to None, progress updates will not be reported.

Returns:

A dictionary-like object with attribute access, containing the following fields: - transfer_id (str): Unique identifier for the transfer session. - status (str): Final status of the transfer (e.g., "completed", "failed"). - path (str): Local path to the directory where the data was downloaded to. - duration_seconds (float): Total duration of the transfer in seconds. - completed_count (int): Number of files successfully transferred. - completed_bytes (int): Total number of bytes successfully transferred. - started_at (str): ISO 8601 timestamp when the transfer began. - ended_at (str): ISO 8601 timestamp when the transfer ended.

Return type:

DotDict

Raises:
  • NgcException -- If unable to download.

  • ResourceNotFoundException -- If model is not found.

info(
target: str,
) ModelResponse | ModelVersionResponse

Retrieve metadata for a model or model version.

Parameters:

target -- Full model name. org/[team/]name[:version]

Raises:

ResourceNotFoundException -- If model is not found.

Returns:

model or model version depending on input

Return type:

Union[ModelResponse, ModelVersionResponse]

list(
target: str | None = None,
org: str | None = None,
team: str | None = None,
order: str | None = None,
access_type: str | None = None,
product_names: str | None = None,
signed: bool = False,
) List[ModelVersion] | List[RepositorySearchTransformer]

List model(s) or model version(s).

Parameters:
  • target -- Name or pattern of models. Defaults to None.

  • org -- Organization. Defaults to None.

  • team -- Team. Defaults to None.

  • order -- Order by. Defaults to None.

  • access_type -- Access type filter of models. Defaults to None.

  • product_names -- Product type filter of models. Defaults to None.

  • signed -- Optional: If true, display models have signed version or versions that are signed, depending on pattern.

Raises:

argparse.ArgumentTypeError -- invalid input target

Returns:

list of model version or list of models depending on input

Return type:

Union[List[ModelVersion], List[RepositorySearchTransformer]]

remove(target: str)

Remove model or model version.

Parameters:

target -- Full model name. org/[team/]name[:version]

Raises:

ResourceNotFoundException -- If model is not found.

update(
target: str,
application: str | None = None,
framework: str | None = None,
model_format: str | None = None,
precision: str | None = None,
short_description: str | None = None,
description: str | None = None,
overview_filename: str | None = None,
bias_filename: str | None = None,
explainability_filename: str | None = None,
privacy_filename: str | None = None,
safety_security_filename: str | None = None,
display_name: str | None = None,
labels: List[str] | None = None,
add_label: List[str] | None = None,
remove_label: List[str] | None = None,
label_set: List[str] | None = None,
logo: str | None = None,
public_dataset_name: str | None = None,
public_dataset_link: str | None = None,
public_dataset_license: str | None = None,
memory_footprint: str | None = None,
built_by: str | None = None,
publisher: str | None = None,
batch_size: int | None = None,
num_epochs: int | None = None,
accuracy_reached: float | None = None,
gpu_model: str | None = None,
set_latest: bool | None = None,
) Model | ModelVersion

Update a model or model version.

Parameters:
  • target -- Full model name. org/[team/]name[:version]

  • application -- Application of model. Defaults to None.

  • framework -- Framework of model. Defaults to None.

  • model_format -- Format of model. Defaults to None.

  • precision -- Precision of model. Defaults to None.

  • short_description -- Short description of model. Defaults to None.

  • description -- Description of model. Defaults to None.

  • overview_filename -- Overview of model filename. Defaults to None.

  • bias_filename -- Bias filename of model. Defaults to None.

  • explainability_filename -- Explainability filename of model. Defaults to None.

  • privacy_filename -- Privacy filename of model. Defaults to None.

  • safety_security_filename -- Safety security filename of model. Defaults to None.

  • display_name -- Display name of model. Defaults to None.

  • (Lis (label_set) -- Label of model. Defaults to None.

  • (Lis -- Label set of model. Defaults to None.

  • logo -- Logo of model. Defaults to None.

  • public_dataset_name -- Public dataset name of model. Defaults to None.

  • public_dataset_link -- Public dataset link of model. Defaults to None.

  • public_dataset_license -- Public dataset license of model. Defaults to None.

  • memory_footprint -- Memory footprint of model. Defaults to None.

  • built_by -- Time model is built by. Defaults to None.

  • publisher -- Model publisher. Defaults to None.

  • batch_size -- Model batch size. Defaults to None.

  • num_epochs -- Epoch number of model. Defaults to None.

  • accuracy_reached -- Accuracy of model. Defaults to None.

  • gpu_model -- GPU model of model. Defaults to None.

  • set_latest -- Model set latest. Defaults to None.

Raises:
  • ResourceNotFoundException -- If model is not found

  • ArgumentTypeError -- If labels or label_set used along with add_label or remove_label.

upload_version(
target: str,
source: str | None = '.',
gpu_model: str | None = None,
memory_footprint: str | None = None,
num_epochs: int | None = None,
batch_size: int | None = None,
accuracy_reached: float | None = None,
description: str | None = None,
link: str | None = None,
link_type: str | None = None,
dry_run: bool | None = False,
credential_files: List[str] | None = None,
metric_files: List[str] | None = None,
base_version: str | None = None,
progress_callback_func: Callable[[int, int, int, int, int, int], None] | None = None,
complete_version=True,
)

Upload a model version.

Parameters:
  • target -- Full model name. org/[team/]name[:version]

  • source -- Source location of model. Defaults to the current directory.

  • gpu_model -- GPU model of model. Defaults to None.

  • memory_footprint -- Memory footprint of model. Defaults to None.

  • num_epochs -- Epoch number of model. Defaults to None.

  • batch_size -- Batch size of model. Defaults to None.

  • accuracy_reached -- Accuracy of model. Defaults to None.

  • description -- Description of model. Defaults to None.

  • link -- Link of model. Defaults to None.

  • link_type -- Link type of model. Defaults to None.

  • dry_run -- Is this a dry run. Defaults to False.

  • credential_files -- Credential files of model. Defaults to None.

  • metric_files -- Metric files of model. Defaults to None.

  • base_version -- Include all files from a base version. Files with same path are overwritten by source.

  • progress_callback_func (Optional[Callable[[int, int, int, int, int, int], None]]) -- A callback function that accepts six integers representing completed_bytes, failed_bytes, total_bytes, completed_count, failed_count, and total_count respectively. If provided, this function will be called to report progress periodically. If set to None, progress updates will not be reported.

  • complete_version -- If all uploads are successful and complete_version is True, mark this version complete.

Returns:

A dictionary-like object with attribute access, containing the following fields: - transfer_id (str): Unique identifier for the transfer session. - status (str): Final status of the transfer (e.g., "completed", "failed"). - path (str): Local path to the directory where the data was uploaded from. - duration_seconds (float): Total duration of the transfer in seconds. - completed_count (int): Number of files successfully transferred. - completed_bytes (int): Total number of bytes successfully transferred. - started_at (str): ISO 8601 timestamp when the transfer began. - ended_at (str): ISO 8601 timestamp when the transfer ended.

Return type:

DotDict

Raises:
  • NgcException -- If failed to upload model.

  • argparse.ArgumentTypeError -- If invalid input model name.

  • ResourceAlreadyExistsException -- If model resource already existed.

  • ResourceNotFoundException -- If model cannot be find.

Resource

class registry.api.resources.ResourceAPI(api_client)
create(
target: str,
application: str,
framework: str,
model_format: str,
precision: str,
short_description: str,
overview_filename: str | None = None,
advanced_filename: str | None = None,
performance_filename: str | None = None,
quick_start_guide_filename: str | None = None,
setup_filename: str | None = None,
display_name: str | None = None,
label: List[str | None] = None,
label_set: List[str | None] = None,
logo: str | None = None,
public_dataset_name: str | None = None,
public_dataset_license: str | None = None,
public_dataset_link: str | None = None,
built_by: str | None = None,
publisher: str | None = None,
) RecipeResponse

Creates a new resource in the model registry with the specified details. This function consolidates various attributes of the resource including application type, framework, and other metadata to submit a creation request to the registry.

Parameters:
  • target -- The identifier for the resource to create.

  • application -- The application type of the model.

  • framework -- The training or usage framework of the model.

  • model_format -- The format of the model.

  • precision -- The precision detail of the model.

  • short_description -- A short description of the model.

  • overview_filename -- Optional filename containing the detailed overview.

  • advanced_filename -- Optional filename containing advanced details.

  • performance_filename -- Optional filename detailing performance metrics.

  • quick_start_guide_filename -- Optional filename for the quick start guide.

  • setup_filename -- Optional filename for setup instructions.

  • display_name -- Optional display name for the resource.

  • label -- Optional list of labels associated with the resource.

  • label_set -- Optional set of labels associated with the resource.

  • logo -- Optional logo path.

  • public_dataset_name -- Optional name of the public dataset used.

  • public_dataset_license -- Optional license of the public dataset used.

  • public_dataset_link -- Optional link to the public dataset.

  • built_by -- Optional creator of the model.

  • publisher -- Optional publisher of the model.

Returns:

An object containing the response details from the creation request.

Return type:

RecipeResponse

Raises:

ResourceAlreadyExistsException -- If a resource with the same identifier already exists.

download_version(
target: str,
destination: str | None = '.',
file_patterns: List[str] | None = None,
exclude_patterns: List[str] | None = None,
progress_callback_func: Callable[[int, int, int, int, int, int], None] | None = None,
)

Downloads the specified model version from a Model Registry based on the provided target identifier. This function checks for the version's availability and download status before proceeding with the download.

Parameters:
  • target (str) -- A string identifier for the model version.

  • destination (str, optional) -- The local directory where the model version should be downloaded. Defaults to '.'.

  • file_patterns (List[str], optional) -- List of file patterns to include in the download.

  • exclude_patterns (List[str], optional) -- List of file patterns to exclude from the download.

  • progress_callback_func (Optional[Callable[[int, int, int, int, int, int], None]]) -- A callback function that accepts six integers representing completed_bytes, failed_bytes, total_bytes, completed_count, failed_count, and total_count respectively. If provided, this function will be called to report progress periodically. If set to None, progress updates will not be reported.

Returns:

A dictionary-like object with attribute access, containing the following fields: - transfer_id (str): Unique identifier for the transfer session. - status (str): Final status of the transfer (e.g., "completed", "failed"). - path (str): Local path to the directory where the data was downloaded to. - duration_seconds (float): Total duration of the transfer in seconds. - completed_count (int): Number of files successfully transferred. - completed_bytes (int): Total number of bytes successfully transferred. - started_at (str): ISO 8601 timestamp when the transfer began. - ended_at (str): ISO 8601 timestamp when the transfer ended.

Return type:

DotDict

Raises:
  • NgcException -- If the destination path does not exist or if the model version is not in 'UPLOAD_COMPLETE' state.

  • ResourceNotFoundException -- If the specified model cannot be found.

info(
target: str,
list_files: bool | None = None,
) RecipeResponse | RecipeVersionResponse

Retrieves information about a specified resource or resource version from the model registry. If a version is specified in the target, it can also list files associated with that version if requested.

Parameters:
  • target -- The identifier of the resource or version for which information is being retrieved.

  • list_files -- Optional; if True, lists the files associated with the specified version. It is not valid for retrieving information about a resource without a specified version.

Returns:

The response object containing details about the resource

or the resource version, depending on the specified target.

Return type:

Union[RecipeResponse, RecipeVersionResponse]

Raises:
  • argparse.ArgumentTypeError -- If the 'list_files' argument is provided for a resource target without a version.

  • ResourceNotFoundException -- If the specified resource or resource version cannot be found.

list(
target: str | None = None,
access_type: str | None = None,
product_names: str | None = None,
org: str | None = None,
team: str | None = None,
signed: bool = False,
) Iterable[ModelScriptSearchTransformer] | Iterable[RecipeVersion]

Retrieves a list of resources or versions based on the provided filters and parameters. This function can be used to search for resources within an organization or team, and can also filter based on access type and product names.

Parameters:
  • target -- Optional: a string identifier or glob pattern for filtering resources or specifying a specific resource.

  • access_type -- Optional: filter resources based on the type of access (e.g., public, private).

  • product_names -- Optional: filter resources based on product names.

  • org -- Optional: specify the organization under which to search for resources. Defaults to the user's current organization.

  • team -- Optional: specify the team under which to search for resources. Defaults to the user's current team.

  • signed -- Optional: If true, return resources have signed version or versions that are signed, depending on pattern.

Returns:

An iterable of either model script search results or version details, depending on the context and filters applied.

Return type:

Union[Iterable[ModelScriptSearchTransformer], Iterable[RecipeVersion]]

Raises:

ResourceNotFoundException -- If the specified resource or version cannot be found when filtering versions specifically.

remove(target: str) None

Removes a specified resource or resource version from the model registry. This function prompts for confirmation before performing the deletion, unless overridden by the default_yes flag.

Parameters:

target -- The identifier of the resource or version to be removed.

Returns:

This function does not return any value.

Return type:

None

Raises:

ResourceNotFoundException -- If the specified resource or resource version does not exist.

update(
target: str,
application: str | None = None,
framework: str | None = None,
model_format: str | None = None,
precision: str | None = None,
short_description: str | None = None,
overview_filename: str | None = None,
advanced_filename: str | None = None,
performance_filename: str | None = None,
quick_start_guide_filename: str | None = None,
release_notes_filename: str | None = None,
setup_filename: str | None = None,
display_name: str | None = None,
labels: List[str] | None = None,
add_label: List[str] | None = None,
remove_label: List[str] | None = None,
label_set: List[str] | None = None,
logo: str | None = None,
public_dataset_name: str | None = None,
desc: str | None = None,
public_dataset_license: str | None = None,
public_dataset_link: str | None = None,
built_by: str | None = None,
publisher: str | None = None,
batch_size: int | None = None,
num_epochs: int | None = None,
accuracy_reached: float | None = None,
gpu_model: str | None = None,
memory_footprint: str | None = None,
)

Updates the details of a specified resource or its version in the model registry, based on the parameters provided. This function handles both the update of resource metadata and specific version details.

Parameters:
  • target -- The identifier of the resource or version to update.

  • application -- Optional application type of the model.

  • framework -- Optional framework used for the model's training or operation.

  • model_format -- Optional format of the model.

  • precision -- Optional precision detail of the model.

  • short_description -- Optional short description of the model.

  • overview_filename -- Optional filename containing the detailed overview.

  • advanced_filename -- Optional filename containing advanced details.

  • performance_filename -- Optional filename detailing performance metrics.

  • quick_start_guide_filename -- Optional filename for the quick start guide.

  • release_notes_filename -- Optional filename for release notes.

  • setup_filename -- Optional filename for setup instructions.

  • display_name -- Optional display name for the resource.

  • labels -- Optional list of labels to declare for the resource.

  • add_label -- Optional list of labels to add to the resource.

  • remove_label -- Optional list of labels to remove frome the resource.

  • label_set -- Optional set of labels associated with the resource.

  • logo -- Optional logo path.

  • public_dataset_name -- Optional name of the public dataset used.

  • desc -- Optional detailed description for version update.

  • public_dataset_license -- Optional license of the public dataset used.

  • public_dataset_link -- Optional link to the public dataset.

  • built_by -- Optional creator of the model.

  • publisher -- Optional publisher of the model.

  • batch_size -- Optional batch size used in model training.

  • num_epochs -- Optional number of epochs the model was trained for.

  • accuracy_reached -- Optional accuracy reached by the model.

  • gpu_model -- Optional GPU model used for training or inference.

  • memory_footprint -- Optional memory footprint of the model.

Returns:

This function does not return any value.

Return type:

None

Raises:
  • ResourceNotFoundException -- If the specified resource or version does not exist.

  • ArgumentTypeError -- If labels or label_set used along with add_label or remove_label.

upload_version(
target: str,
source: str | None = '.',
gpu_model: str | None = None,
memory_footprint: str | None = None,
num_epochs: int | None = None,
release_notes_filename: str | None = None,
quick_start_guide_filename: str | None = None,
performance_filename: str | None = None,
setup_filename: str | None = None,
batch_size: int | None = None,
accuracy_reached: float | None = None,
description: str | None = None,
dry_run: bool | None = False,
base_version: str | None = None,
progress_callback_func=None,
)

Uploads a resource version to a resource Registry based on the provided target identifier, with optional parameters describing resource details and associated documentation. Can perform a dry run to simulate the upload process.

Parameters:
  • target -- A string identifier for the resource version.

  • source -- The local directory from which files will be uploaded. Defaults to '.'.

  • gpu_model -- Optional identifier for the GPU model used.

  • memory_footprint -- Optional description of the memory requirements.

  • num_epochs -- Optional number of epochs completed.

  • release_notes_filename -- Optional path to a file containing release notes.

  • quick_start_guide_filename -- Optional path to a file containing a quick start guide.

  • performance_filename -- Optional path to a file detailing the resource's performance.

  • setup_filename -- Optional path to a file detailing setup instructions.

  • batch_size -- Optional batch size used during training.

  • accuracy_reached -- Optional accuracy reached by the resource.

  • description -- Optional description of the resource.

  • dry_run -- If True, perform a dry run of the upload without actually uploading files. Defaults to False.

  • base_version -- Include all files from a base version. base_version must be a upload completed version from the same .

  • progress_callback_func -- Callback function to update the upload prograss. Defaults to None.

Returns:

A dictionary-like object with attribute access, containing the following fields: - transfer_id (str): Unique identifier for the transfer session. - status (str): Final status of the transfer (e.g., "completed", "failed"). - path (str): Local path to the directory where the data was uploaded from. - duration_seconds (float): Total duration of the transfer in seconds. - completed_count (int): Number of files successfully transferred. - completed_bytes (int): Total number of bytes successfully transferred. - started_at (str): ISO 8601 timestamp when the transfer began. - ended_at (str): ISO 8601 timestamp when the transfer ended.

Return type:

DotDict

Raises:
  • ResourceAlreadyExistsException -- If a resource with the same version already exists and is not in 'UPLOAD_PENDING' state.

  • ResourceNotFoundException -- If the target specified does not exist.

  • NgcException -- If the upload fails or cannot be completed.

Chart

class registry.api.chart.ChartAPI(
api_client,
repo_connection: Connection | None = None,
)

public methods returns unwrapped objects n private methods returns wrapped api reponses n private methods set endpoints.

create(
target: str,
short_description: str,
overview_filepath: str | None = None,
display_name: str | None = None,
labels: List[str] | None = None,
label_sets: List[str] | None = None,
logo: str | None = None,
publisher: str | None = None,
built_by: str | None = None,
) Artifact

Creates metadata for a new Helm chart in the repository. This includes various descriptive elements such as a short description, display name, labels, and potentially an overview file among other details.

Parameters:
  • target -- The unique identifier for the chart.

  • short_description -- A brief description of the chart.

  • overview_filepath -- Optional; the path to a file containing a detailed description of the chart.

  • display_name -- Optional; a user-friendly name for the chart.

  • labels -- Optional; a list of labels associated with the chart.

  • label_sets -- Optional; a list of label sets associated with the chart.

  • logo -- Optional; a URL or a path to an image file to be used as the chart's logo.

  • publisher -- Optional; the name of the entity that published the chart.

  • built_by -- Optional; the name of the developer or organization that built the chart.

Returns:

An object representing the created chart metadata.

Return type:

Artifact

Raises:
  • NgcException -- If the overview file path does not exist or if the chart already exists in the repository.

  • ChartAlreadyExistsException -- Specifically raised if the target chart already exists to distinguish from other potential conflicts.

info(
target: str,
) Artifact | ArtifactVersion

Retrieves detailed information about a chart or a specific version of a chart from the chart repository. The function will return either general chart information or specific version details based on the target.

Parameters:

target -- A string identifier that specifies the chart. Must include the version if specific version info is requested.

Returns:

Depending on whether the target includes a version, returns either chart details or chart version details.

Return type:

Union[Artifact, ArtifactVersion]

Raises:

ChartNotFoundException -- If the specified chart or chart version cannot be found.

list(
target: str | None = None,
access_type: str | None = None,
product_names: str | None = None,
) List[ChartSearchTransformer] | List[ArtifactVersion]

Lists charts or versions in the chart repository based on the provided target, access type and product names. This function distinguishes between listing all charts matching certain criteria or specific versions of a chart, depending on whether a version identifier is included in the target.

Parameters:
  • target -- Optional; a string identifier or glob pattern that may specify a chart name or a version.

  • access_type -- Optional; filter the charts based on the access type (e.g., public, private).

  • product_names -- Optional; filter charts based on product names.

Returns:

Returns a list of charts or chart versions, depending on whether a version is specified in the target.

Return type:

Union[List[ChartSearchTransformer], List[ArtifactVersion]]

Raises:

ResourceNotFoundException -- If no matching charts or versions could be found.

pull(target: str, download_dir: str | None = None) str

Pulls a specified version of a Helm chart to a local directory. If the version is not specified, it will retrieve the latest version. The download directory must exist and have write permissions.

Parameters:
  • target -- The identifier for the Helm chart, which may optionally include a version.

  • download_dir -- Optional; the directory where the Helm chart will be downloaded. Defaults to the current directory.

Returns:

The path to the downloaded Helm chart file.

Return type:

str

Raises:

NgcException -- If the download directory does not exist, lacks write permissions, or if the specified chart version is not in the 'UPLOAD_COMPLETE' state.

push(
target: str,
source_dir: str | None = '.',
is_dry_run: bool | None = False,
cli_messages: List[str] | None = None,
) ArtifactVersion | None

Pushes a packaged Helm chart to the repository. This function can perform a dry run to simulate the upload without actually transmitting any data. Source directory must contain a valid packaged Helm chart.

Parameters:
  • target -- The identifier for the Helm chart, including the version.

  • source_dir -- Optional; the local directory containing the Helm chart package. Defaults to the current directory.

  • is_dry_run -- Optional; if True, performs a dry run of the push operation. Defaults to False.

  • cli_messages -- Optional; a list to append output messages during the operation.

Returns:

Returns an object containing the version details if the operation succeeds, or None if it is a dry run.

Return type:

Union[ArtifactVersion, None]

Raises:

NgcException -- If the chart metadata does not exist or if the upload fails due to an existing chart or other errors.

remove(
target: str,
) ArtifactVersion | Artifact

Removes a specified chart or a specific version of a chart from the repository. Depending on the target provided, this function either removes a single version or all versions of a chart.

Parameters:

target -- A string identifier that specifies the chart and may optionally include a version.

Returns:

Returns either the details of the removed chart version or the chart itself.

Return type:

Union[ArtifactVersion, Artifact]

Raises:

ChartNotFoundException -- If the specified chart or chart version cannot be found.

update(
target: str,
overview_filepath: str | None = None,
display_name: str | None = None,
labels: List[str] | None = None,
add_label: List[str] | None = None,
remove_label: List[str] | None = None,
label_sets: List[str] | None = None,
logo: str | None = None,
publisher: str | None = None,
built_by: str | None = None,
short_description: str | None = None,
) Artifact

Updates the metadata for an existing Helm chart in the repository. This function allows modifications to various metadata attributes such as the display name, labels, logo, and the chart's descriptive content.

Parameters:
  • target -- The unique identifier for the chart.

  • overview_filepath -- Optional; the path to a file containing a detailed description of the chart.

  • display_name -- Optional; a user-friendly name for the chart.

  • labels -- Optional; a list of labels to declare for the chart.

  • add_label -- Optional: a list of labels to add to the chart.

  • remove_label -- Optional: a list of labels to remove from the chart.

  • label_sets -- Optional; a list of label sets associated with the chart.

  • logo -- Optional; a URL or a path to an image file to be used as the chart's logo.

  • publisher -- Optional; the name of the entity that published the chart.

  • built_by -- Optional; the name of the developer or organization that built the chart.

  • short_description -- Optional; a brief description of the chart.

Returns:

An object representing the updated chart metadata.

Return type:

Artifact

Raises:
  • ResourceNotFoundException -- If the specified chart cannot be found in the repository.

  • ArgumentTypeError -- If labels or label_sets used along with add_label or remove_label.