Skip to main content

Minio/S3 client VFS abstraction library

Project description

rick-vfs

Minio/S3 client VFS abstraction library

Tests pypi license

Rick-vfs is a high-level abstraction library for file operations on local repositories (a locally accessible folder) and Minio/S3 object storage systems. The main goal is to provide a set of common interface functions with analogous behaviour, to interact with both scenarios.

The intention of "analogous behaviour" is to mimick overall intent and response type, when possible. There will always be differences between invoking a given method on two different backends.

Example:

from io import BytesIO
from minio import Minio
from rick_vfs.s3 import MinioBucket, MinioVfs

client = Minio(
    "localhost:9010",
    secure=False,
    access_key="SomeTestUser",
    secret_key="SomeTestPassword",
)

# initialize bucket
volume = MinioBucket(client, 'my-bucket')
# initialize VFS object
vfs = MinioVfs(volume)

# create directory
vfs.mkdir("contents/files")

# create file from buffer
buf = BytesIO(b'the quick brown fox jumps over the lazy dog')
vfs.write_file(buf, 'contents/files/my_test_file')

# read file
contents = vfs.read_file('my_test_file')
# print contents
print(str(contents.getbuffer().tobytes(), 'utf-8'))

# list bucket contents
print("Bucket contents:")
for item in vfs.ls():
    print(item.object_name)

Object lock

The S3 backend supports the full set of S3 object-lock primitives — bucket lock configuration, versioning, per-object retention (GOVERNANCE / COMPLIANCE), legal hold, governance-bypass deletion and version-targeted operations. Lock support is exposed through the VfsObjectLock and VfsLockableVolume capability interfaces, so a backend can be probed with isinstance():

from rick_vfs import VfsObjectLock

if isinstance(vfs, VfsObjectLock):
    vfs.enable_legal_hold("my-object")

See Object lock & versioning for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rick_vfs-2.0.0.tar.gz (18.3 kB view details)

Uploaded Source

File details

Details for the file rick_vfs-2.0.0.tar.gz.

File metadata

  • Download URL: rick_vfs-2.0.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rick_vfs-2.0.0.tar.gz
Algorithm Hash digest
SHA256 b1baec2d289ef37572bda81533d0de48130e9335211da0ca1b7956bb91ee581b
MD5 bafce28e5de2971dd54114453dcd1956
BLAKE2b-256 ca0c77c0bc9aabc9f5e953aab91fd7518605b5b1b790536c59f2808909208987

See more details on using hashes here.

Provenance

The following attestation bundles were made for rick_vfs-2.0.0.tar.gz:

Publisher: publish.yml on oddbit-project/rick_vfs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page