hfutils.entry.upload

This module provides functionality for uploading data to HuggingFace repositories.

It includes a CLI command for uploading files, archives, or directories to HuggingFace repositories. The module handles different upload scenarios, including creating new repositories, setting visibility, and handling various input types.

Usage:

This module is typically used as part of a larger CLI application for interacting with HuggingFace repositories. It requires appropriate authentication through HuggingFace tokens (set via environment variable HF_TOKEN).

NoRemotePathAssignedWithUpload

class hfutils.entry.upload.NoRemotePathAssignedWithUpload(message: str)[source]

Custom exception class for indicating that no remote path in the repository is assigned.

This exception is raised when attempting to upload without specifying a remote path (file, archive, or directory) in the repository. At least one of these options must be provided for successful upload operation.

Attribute exit_code:

The exit code to be used when this exception is raised.

exit_code = 33

The exit code for this exception.

show(file: IO | None = None) None

Display the error message in red.

Parameters:

file (Optional[IO]) – File to write the output to.