The Library + CLI to upload/download Ritual files and repositories to Irys
Project description
Ritual Irys
This is a library as well as a CLI tool that allows uploading and downloading data to and from the Irys network. Users can:
- Upload/Download individual files from & to the Irys network.
- Upload/Download repositories to & from the Irys network. Each repository is a
directory containing multiple files (artifacts). These are commonly used in
infernet-mlto store and retrieve models.
Installation
Via pip:
pip install ritual-irys
Via UV:
uv pip install ritual-irys
Usage
CLI:
ritual-irys --help
Library:
Uploading a Repository
=== "Python"
```python
from ritual_irys.repo_manager import RepoManager
repo_manager = RepoManager(wallet='<private key>')
upload_result = repo_manager.upload_repo(
name='my-repo',
path='/path/to/repo',
version_mapping_file='/path/to/version_mapping.json'
)
print(f"Uploaded repo with manifest URL: {upload_result.manifest_url}")
```
=== "CLI"
```bash
ritual-irys upload-repo --repo-name my-repo --repo-dir /path/to/repo
```
<!-- Optional parameters:
* `--version-file`: Path to a JSON file mapping filenames to versions.
* `--wallet`: Wallet string, or path to the wallet file (default is `wallet.txt`).
* `--api-url`: Irys gateway URL (default is `https://irys.net`). -->
Downloading a Repository
=== "Python"
```python
from ritual_irys.repo_manager import RepoManager
repo_manager = RepoManager(wallet_path='<private key>')
files = repo_manager.download_repo('owner/my-repo', base_path='/path/to/save')
print(f"Downloaded files: {files}")
```
=== "CLI"
```bash
ritual-irys download-repo --repo-id owner/my-repo --base-path /path/to/save
```
Uploading a File
=== "Python"
```python
from pathlib import Path
from ritual_irys.file_manager import FileManager
file_manager = FileManager(wallet_path='<private key>')
transaction = file_manager.upload(Path('/path/to/file'), tags_dict={'key': 'value'})
print(f"Uploaded file with transaction ID: {transaction.id}")
```
=== "CLI"
```bash
ritual-irys upload-file --file-path /path/to/file --tags '{"key": "value"}'
```
Downloading a File
=== "Python"
```python
from ritual_irys.file_manager import FileManager
file_manager = FileManager(wallet_path='<private key>')
file_path = file_manager.download('/path/to/save/file', 'transaction-id')
print(f"Downloaded file to: {file_path}")
```
=== "CLI"
```bash
ritual-irys download-file --file-path /path/to/save/file --tx-id transaction-id
```
Generic Blob Upload/Download
You can upload/download generic data blobs to/from Irys using the
FileManager class.
from ritual_irys.file_manager import FileManager
file_manager = FileManager(wallet='<private key>')
data = "yooooo".encode()
tx = file_manager.upload_data(data)
print("tx: %s", tx.id)
Dictionary Upload/Download
Much like blobs, you can upload/download dictionaries to/from Irys using the
FileManager class.
from ritual_irys.file_manager import FileManager
file_manager = FileManager(wallet='<private key>')
data = {"key": "value"}
tx = file_manager.upload_dict(data)
print("tx: %s", tx.id)
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
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 ritual_irys-0.1.1.tar.gz.
File metadata
- Download URL: ritual_irys-0.1.1.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.9.3-76060903-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15b622d86d504c2a6a7fac0a326fde86c495b268b36741ab3c2d145f60a626c9
|
|
| MD5 |
825a4b277b55157d4ba03f10e0269faf
|
|
| BLAKE2b-256 |
bac60fb73b9ed5595daa497c782670d977cc3229dabeb04fe51035054dbd6e37
|
File details
Details for the file ritual_irys-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ritual_irys-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.9.3-76060903-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17645675dba9a888549bc47be3b86dc166726621f67da66894e53bfe18a18e46
|
|
| MD5 |
a4fcdf1781e7851d93a418b912c11a8d
|
|
| BLAKE2b-256 |
2871966c16db242e75f7d920e6699ecd712d5c70da001352bae8f8e92a5995e8
|