ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

Storage driver backed by Amazon S3 (or S3-compatible services).

Uses the official AWS SDK for Python (boto3), which is an optional dependency: it is not installed with the framework. Install it before using this driver:

uv add 'orionis[s3]'

The SDK is imported lazily on first operation, and every blocking call runs on a worker thread via asyncio.to_thread so the event loop stays responsive. Directories are virtual: prefixes are inferred from object keys, and explicit directories are stored as zero-byte path/ marker objects.

Method __aclFor Map a visibility level onto an S3 canned ACL.
Method __client Return the boto3 S3 client, bootstrapping it on first use.
Method __headSync Fetch object metadata or raise when the object is absent.
Method __init__ Initialize the driver from an S3 disk configuration entity.
Method __isMissing Check whether an SDK error denotes a missing object.
Method __listKeysSync List every object key under prefix.
Method __missing Build the framework exception for a missing object.
Method __putArgs Build the optional arguments for an object upload.
Method __seedStream Seed buffer with the current object content for a stream.
Async Method __spool Buffer an async byte stream into a spooled temporary file.
Method __urlFor Compose the public URL of an object without SDK involvement.
Method __visibilitySync Resolve the object visibility from its ACL grants.
Async Method copy Copy the object at source to target server-side.
Async Method createDirectory Create a zero-byte directory marker at path.
Async Method delete Delete the object at path.
Async Method deleteDirectory Recursively delete every object under path.
Async Method directories List the directory prefixes contained under path.
Async Method directoryExists Check whether any object exists under path.
Async Method download Download the object at path to the local filesystem.
Async Method exists Check whether an object exists at path.
Async Method files List the object keys that represent files under path.
Async Method hash Compute the content hash of the object at path.
Async Method info Collect a metadata snapshot for the object at path.
Async Method lastModified Return the last-modification timestamp of the object at path.
Async Method mimeType Return the MIME type of the object at path.
Async Method move Move the object at source to target.
Method open Open an asynchronous binary stream for the object at path.
Async Method read Read the full contents of the object at path.
Async Method readStream Stream the contents of the object at path in chunks.
Async Method setVisibility Change the visibility of the object at path.
Async Method size Return the size in bytes of the object at path.
Async Method temporaryUrl Build a presigned URL for the object at path.
Async Method url Build the public URL for the object at path.
Async Method visibility Return the visibility of the object at path.
Async Method write Write contents to path, replacing any existing object.
Async Method writeStream Write the chunks produced by stream to path.
Class Variable __slots__ Undocumented
Instance Variable _base_url Undocumented
Instance Variable _bucket Undocumented
Instance Variable _client Undocumented
Instance Variable _client_error Undocumented
Instance Variable _endpoint Undocumented
Instance Variable _key Undocumented
Instance Variable _region Undocumented
Instance Variable _secret Undocumented
Instance Variable _use_path_style Undocumented
def __aclFor(self, visibility: str) -> str: (source)

Map a visibility level onto an S3 canned ACL.

Parameters
visibility:strVisibility level ('public' or 'private').
Returns
strCanned ACL name.
Raises
UnsupportedStorageOperationExceptionIf visibility is not a supported level.
def __client(self) -> Any: (source)

Return the boto3 S3 client, bootstrapping it on first use.

Returns
AnyConfigured boto3 S3 client.
Raises
MissingStorageDependencyExceptionIf boto3 is not installed.
def __headSync(self, normalized: str) -> dict: (source)

Fetch object metadata or raise when the object is absent.

Parameters
normalized:strCanonical root-relative file path.
Returns
dictRaw head_object response.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
def __init__(self, config: object): (source)

Initialize the driver from an S3 disk configuration entity.

No SDK import or network activity happens here; the client is bootstrapped lazily on first use.

Parameters
config:objectDisk configuration exposing bucket, region, key, secret, url, endpoint, and use_path_style_endpoint.
Returns
NoneUndocumented
def __isMissing(self, exc: Exception) -> bool: (source)

Check whether an SDK error denotes a missing object.

Parameters
exc:ExceptionException raised by the boto3 client.
Returns
boolTrue when the error code maps to a 404 condition.
def __listKeysSync(self, prefix: str) -> list[str]: (source)

List every object key under prefix.

Parameters
prefix:strKey prefix to filter by; empty string lists the bucket.
Returns
list[str]All matching object keys, including directory markers.
def __missing(self, normalized: str) -> StorageFileNotFoundException: (source)

Build the framework exception for a missing object.

Parameters
normalized:strCanonical root-relative file path.
Returns
StorageFileNotFoundExceptionException instance ready to be raised.
def __putArgs(self, normalized: str, visibility: str | None) -> dict[str, str]: (source)

Build the optional arguments for an object upload.

Parameters
normalized:strCanonical root-relative file path.
visibility:str | NoneVisibility to apply, or None to omit the ACL.
Returns
dict[str, str]Extra arguments with ContentType and optional ACL.
def __seedStream(self, buffer: BinaryIO, normalized: str, mode: str): (source)

Seed buffer with the current object content for a stream.

Downloads the object into the buffer and positions the cursor according to mode. Missing objects are tolerated for append modes and rejected for read modes.

Parameters
buffer:BinaryIOSpooled buffer backing the stream.
normalized:strCanonical root-relative file path.
mode:strBinary mode requested by the caller.
Returns
NoneUndocumented
Raises
StorageFileNotFoundExceptionIf the object does not exist and mode requires it.
async def __spool(self, stream: AsyncIterable[bytes]) -> BinaryIO: (source)

Buffer an async byte stream into a spooled temporary file.

Parameters
stream:AsyncIterable[bytes]Asynchronous byte-chunk producer.
Returns
BinaryIORewound buffer holding the full payload.
def __urlFor(self, normalized: str) -> str: (source)

Compose the public URL of an object without SDK involvement.

Parameters
normalized:strCanonical root-relative file path.
Returns
strPublic URL derived from the configured base URL, custom endpoint, or the canonical virtual-host address.
def __visibilitySync(self, normalized: str) -> str: (source)

Resolve the object visibility from its ACL grants.

Parameters
normalized:strCanonical root-relative file path.
Returns
str'public' when anonymous users hold a read grant, otherwise 'private'.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
async def copy(self, source: str, target: str): (source)

Copy the object at source to target server-side.

Parameters
source:strRoot-relative path of the existing object.
target:strRoot-relative destination path.
Returns
NoneUndocumented
Raises
StorageFileNotFoundExceptionIf the source object does not exist.
async def createDirectory(self, path: str): (source)

Create a zero-byte directory marker at path.

Parameters
path:strRoot-relative directory path.
Returns
NoneUndocumented
async def delete(self, path: str) -> bool: (source)

Delete the object at path.

Parameters
path:strRoot-relative file path.
Returns
boolTrue if the object existed and was removed.
async def deleteDirectory(self, path: str) -> bool: (source)

Recursively delete every object under path.

Parameters
path:strRoot-relative directory path. The empty string clears the whole bucket prefix space.
Returns
boolTrue if at least one object was removed.
async def directories(self, path: str = '', *, recursive: bool = False) -> list[str]: (source)

List the directory prefixes contained under path.

Parameters
path:strRoot-relative directory path. Empty string for the root.
recursive:boolWhen True, include all nested prefixes.
Returns
list[str]Sorted root-relative directory paths.
async def directoryExists(self, path: str) -> bool: (source)

Check whether any object exists under path.

Parameters
path:strRoot-relative directory path. The empty string denotes the disk root.
Returns
boolTrue if the prefix contains at least one object.
async def download(self, path: str, destination: str | Path) -> Path: (source)

Download the object at path to the local filesystem.

Parameters
path:strRoot-relative file path on the disk.
destination:str | PathLocal target. When it points to an existing directory the file keeps its original name inside that directory.
Returns
PathAbsolute local path of the downloaded file.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
async def exists(self, path: str) -> bool: (source)

Check whether an object exists at path.

Parameters
path:strRoot-relative file path.
Returns
boolTrue if an object exists at the given key.
async def files(self, path: str = '', *, recursive: bool = False) -> list[str]: (source)

List the object keys that represent files under path.

Parameters
path:strRoot-relative directory path. Empty string for the root.
recursive:boolWhen True, include files from all nested prefixes.
Returns
list[str]Sorted root-relative file paths.
async def hash(self, path: str, algorithm: str = 'sha256') -> str: (source)

Compute the content hash of the object at path.

The object is streamed in chunks, so large files never load fully into memory.

Parameters
path:strRoot-relative file path.
algorithm:strAny algorithm name accepted by hashlib.new.
Returns
strHexadecimal digest of the object contents.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
UnsupportedStorageOperationExceptionIf algorithm is not available.
async def info(self, path: str) -> FileInfo: (source)

Collect a metadata snapshot for the object at path.

The snapshot is built from object metadata only; the checksum field is None because computing it would require a full download (use hash instead).

Parameters
path:strRoot-relative file path.
Returns
FileInfoImmutable entity with size, MIME type, timestamps, ETag, visibility, and URL.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
async def lastModified(self, path: str) -> datetime: (source)

Return the last-modification timestamp of the object at path.

Parameters
path:strRoot-relative file path.
Returns
datetimeTimezone-aware modification timestamp.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
async def mimeType(self, path: str) -> str | None: (source)

Return the MIME type of the object at path.

Prefers the Content-Type stored in S3 and falls back to a guess based on the file extension.

Parameters
path:strRoot-relative file path.
Returns
str | NoneMIME type, or None when it cannot be determined.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
async def move(self, source: str, target: str): (source)

Move the object at source to target.

Implemented as a server-side copy followed by a delete of the source object.

Parameters
source:strRoot-relative path of the existing object.
target:strRoot-relative destination path.
Returns
NoneUndocumented
Raises
StorageFileNotFoundExceptionIf the source object does not exist.
def open(self, path: str, mode: str = 'rb') -> AsyncStream: (source)

Open an asynchronous binary stream for the object at path.

Read-oriented modes download the object into a spooled temporary buffer; writable modes upload the buffered content back to S3 when the stream is closed.

Parameters
path:strRoot-relative file path.
mode:strBinary mode: 'rb', 'wb', 'ab', 'rb+', 'wb+', or 'ab+'.
Returns
AsyncStreamLazily opened stream; use it as an async context manager.
Raises
UnsupportedStorageOperationExceptionIf mode is not a supported binary mode.
async def read(self, path: str) -> bytes: (source)

Read the full contents of the object at path.

Parameters
path:strRoot-relative file path.
Returns
bytesComplete object contents.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
async def readStream(self, path: str, chunk_size: int = _CHUNK_SIZE) -> AsyncIterator[bytes]: (source)

Stream the contents of the object at path in chunks.

Parameters
path:strRoot-relative file path.
chunk_size:intMaximum number of bytes per yielded chunk.
Returns
AsyncIterator[bytes]Undocumented
Yields
bytesConsecutive chunks of the object contents.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
async def setVisibility(self, path: str, visibility: str): (source)

Change the visibility of the object at path.

Parameters
path:strRoot-relative file path.
visibility:strTarget visibility ('public' or 'private').
Returns
NoneUndocumented
Raises
StorageFileNotFoundExceptionIf the object does not exist.
UnsupportedStorageOperationExceptionIf visibility is not a supported level.
async def size(self, path: str) -> int: (source)

Return the size in bytes of the object at path.

Parameters
path:strRoot-relative file path.
Returns
intObject size in bytes.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
async def temporaryUrl(self, path: str, expires_in: int) -> str: (source)

Build a presigned URL for the object at path.

Parameters
path:strRoot-relative file path.
expires_in:intLifetime of the URL in seconds.
Returns
strPresigned GET URL valid for expires_in seconds.
Raises
MissingStorageDependencyExceptionIf boto3 is not installed.
async def url(self, path: str) -> str: (source)

Build the public URL for the object at path.

Parameters
path:strRoot-relative file path.
Returns
strURL derived from the configured base URL, custom endpoint, or the canonical virtual-host address.
async def visibility(self, path: str) -> str: (source)

Return the visibility of the object at path.

Parameters
path:strRoot-relative file path.
Returns
str'public' or 'private' based on the object ACL.
Raises
StorageFileNotFoundExceptionIf the object does not exist.
async def write(self, path: str, contents: bytes | str, visibility: str | None = None): (source)

Write contents to path, replacing any existing object.

Parameters
path:strRoot-relative file path.
contents:bytes | strData to persist. Strings are encoded as UTF-8.
visibility:str | NoneVisibility to apply, or None for the bucket default.
Returns
NoneUndocumented
async def writeStream(self, path: str, stream: AsyncIterable[bytes], visibility: str | None = None): (source)

Write the chunks produced by stream to path.

The payload is buffered into a spooled temporary file (spilling to disk past 8 MiB) and uploaded with the SDK's managed transfer, which switches to multipart uploads for large objects.

Parameters
path:strRoot-relative file path.
stream:AsyncIterable[bytes]Asynchronous byte-chunk producer.
visibility:str | NoneVisibility to apply, or None for the bucket default.
Returns
NoneUndocumented
_base_url: str | None = (source)

Undocumented

Undocumented

_client: Any = (source)

Undocumented

_client_error: type[Exception] = (source)

Undocumented

_endpoint: str | None = (source)

Undocumented

Undocumented

Undocumented

Undocumented

_use_path_style: bool = (source)

Undocumented