Skip to content

nexuml.storage.s3

nexuml.storage.s3

Small S3-compatible transport used by distributed dataset export/loading.

S3Path dataclass

Minimal path-like wrapper around an s3:// object key.

suffix property

suffix: str

Object-key suffix.

parse classmethod

parse(value: str) -> 'S3Path'

Parse one S3 URI.

Returns:

Type Description
'S3Path'

Parsed S3 path.

Raises:

Type Description
ValueError

If value is not a plain s3://bucket/key URI.

S3Client

Lazy boto3 wrapper for the few operations NexuML actually needs.

read_bytes

read_bytes(uri: str | S3Path) -> bytes

Read one object into memory.

Returns:

Type Description
bytes

Object bytes.

upload_file

upload_file(
    source: str | Path, destination: str | S3Path
) -> None

Upload one local file to S3.

upload_bytes

upload_bytes(
    data: bytes, destination: str | S3Path
) -> None

Upload one in-memory object to S3.

download_file

download_file(
    source: str | S3Path, destination: str | Path
) -> None

Download one object to a local path.

list

list(prefix: str | S3Path) -> builtins.list[S3Path]

List object paths below an S3 prefix.

Returns:

Type Description
list[S3Path]

S3 paths in provider order.

is_s3_uri

is_s3_uri(value: object) -> bool

Return whether value is an S3 URI.