Skip to main content

No project description provided

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:

  1. Upload/Download individual files from & to the Irys network.
  2. Upload/Download repositories to & from the Irys network. Each repository is a directory containing multiple files (artifacts). These are commonly used in infernet-ml to 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='<wallet string>')
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='./wallet.json')
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='./wallet.json')
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='./wallet.json')
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='<wallet string>')
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='<wallet string>')
data = {"key": "value"}
tx = file_manager.upload_dict(data)
print("tx: %s", tx.id)

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

ritual_irys-0.1.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ritual_irys-0.1.0-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file ritual_irys-0.1.0.tar.gz.

File metadata

  • Download URL: ritual_irys-0.1.0.tar.gz
  • Upload date:
  • Size: 21.8 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

Hashes for ritual_irys-0.1.0.tar.gz
Algorithm Hash digest
SHA256 faf0c7befa22c8cc845e6bd2e1067507fd16b7f8efd28b27e4f76b716eda2599
MD5 f6dafb5fc9db26c55693b5f3119a767f
BLAKE2b-256 43a7eb5dba155927e3668f90dbea47e95fd9bb04c2db872a342582c792f519d9

See more details on using hashes here.

File details

Details for the file ritual_irys-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ritual_irys-0.1.0-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

Hashes for ritual_irys-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b93fb9a514a202b534911409776498410a27e888b33dfc993dac53a6f1107ea4
MD5 24475902f1314a6e17a369edcea1f9fe
BLAKE2b-256 60bf8572acc20eff37129dc91df810ab8469eb6c02ff11af0f49084f803ccc89

See more details on using hashes here.

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