A Python client for JuiceFS operations
Project description
JuiceFS Client
A Python client for JuiceFS operations with easy-to-use interfaces and AWS credentials support.
Installation
pip install juicefs-client
Quick Start
Initialize Client
from juicefs_client import JuiceFSClient
# Using environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
client = JuiceFSClient(volume="myvolume", token="mytoken")
# Or with explicit credentials
client = JuiceFSClient(
volume="myvolume",
token="mytoken",
access_key="your-aws-access-key",
secret_key="your-aws-secret-key"
)
Basic File Operations
# Write and read text files
client.write_file("/path/to/file.txt", "Hello World")
content = client.read_file("/path/to/file.txt")
# Binary files (e.g., PyTorch models)
client.save_torch_model("/models/model.pt", model.state_dict())
state_dict = client.load_torch_model("/models/model.pt")
# List directory contents
files = client.list_dir("/path/to/directory")
# Delete files
client.delete_file("/path/to/file.txt")
# Copy files
client.copy_file("/source/path", "/destination/path")
Features
- Simple and intuitive API for JuiceFS operations
- AWS credentials support (both environment variables and explicit)
- Built-in support for PyTorch model serialization
- File operations: read, write, delete, copy, list
- Directory operations: create, list, delete
Configuration
| Parameter | Description | Required | Default |
|---|---|---|---|
| volume | JuiceFS volume name | Yes | None |
| token | Authentication token | Yes | None |
| access_key | AWS access key | No | None |
| secret_key | AWS secret key | No | None |
| endpoint | Custom endpoint URL | No | None |
| region | AWS region | No | 'us-east-1' |
Error Handling
from juicefs_client.exceptions import JuiceFSError
try:
client.read_file("/nonexistent/file.txt")
except JuiceFSError as e:
print(f"Error: {e}")
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
juicefs_client-0.1.9.tar.gz
(8.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file juicefs_client-0.1.9.tar.gz.
File metadata
- Download URL: juicefs_client-0.1.9.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8cc5960c09240a1cefe380e62f1bf2bd4ac10aa75b5a9793e417304ce4ce8a7
|
|
| MD5 |
5cb011d17fda6fcf3da7e38a6450ee4d
|
|
| BLAKE2b-256 |
dee9606ef7029b79e88cb2065dbe5a5e0277107c06c1d1acd36f9bb8fae077ed
|
File details
Details for the file juicefs_client-0.1.9-py3-none-any.whl.
File metadata
- Download URL: juicefs_client-0.1.9-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
750cfc9573cc2a0af8610359bbd563604ece84b37e418a952d71a37669929ebc
|
|
| MD5 |
ab3bad172080be8c6cd558c95c25c664
|
|
| BLAKE2b-256 |
67e20cbfd7823d116345333bf2d7f26bd438feff828f1987c23c7d32699ced81
|