Module: cli
Script containing a command line interface to upload and download repositories from/to arweave. This file is a thin wrapper around RepoManager & FileManager classes to facilitate usage of the repo upload and download functions from the command line.
This CLI is commonly used to upload and download model files from/to arweave, similar to how models are handled in huggingface hub.
download_file(file_path, tx_id, gateways=DEFAULT_GATEWAYS, show_progress=True)
Downloads a file from Arweave using the transaction ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
Path to the file to download. |
required |
tx_id |
str
|
Transaction ID of the file to download. |
required |
gateways |
str
|
Comma separated list of Arweave gateways. |
DEFAULT_GATEWAYS
|
show_progress |
bool
|
If set to false, it will not show the progress bar while |
True
|
To download a file with transaction id
ritual-arweave download-file --file-path
Source code in src/ritual_arweave/cli.py
download_repo(repo_id, base_path='.', force_download=False, show_progress=True, gateways=DEFAULT_GATEWAYS)
Downloads a repo from Arweave using the specified repo ID, and API URL. Optionally, you can specify multiple owners and a base path where the repo files will be saved. Use the --force-download flag to override existing files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_id |
str
|
The ID of the repository to download. |
required |
base_path |
str
|
The base path to save the repo files. Defaults to the current directory. |
'.'
|
force_download |
bool
|
If set, it will override the existing repo files if they exist. |
False
|
show_progress |
bool
|
If set, it will show progress bar while downloading files. |
True
|
gateways |
str
|
Commas separated list of Arweave gateways. |
DEFAULT_GATEWAYS
|
To download a repo with ID
ritual-arweave download-repo --repo-id
To download a repo with ID
ritual-arweave download-repo --repo-id
Source code in src/ritual_arweave/cli.py
upload_file(file_path, max_upload_size, show_progress=True, gateways=','.join(DEFAULT_GATEWAYS), wallet='wallet.json', tags='{}')
Uploads a file to Arweave.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
Path to the file to upload. |
required |
max_upload_size |
int
|
For large files, the file will be split into chunks of this |
required |
gateways |
str
|
Comma separated list of Arweave gateways. |
join(DEFAULT_GATEWAYS)
|
wallet |
str
|
Path to the wallet file. Default is |
'wallet.json'
|
tags |
str
|
Dictionary of tags to attach to the file. Must be a JSON string. |
'{}'
|
To upload a file with path
ritual-arweave upload-file --file-path
Source code in src/ritual_arweave/cli.py
upload_repo(repo_name, repo_dir, version_file, wallet, show_progress, gateways)
Uploads a repo to Arweave using the specified repo name & repo directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repo_name |
str
|
Name of the repo to upload. |
required |
repo_dir |
str
|
Path to the repo directory. |
required |
version_file |
optional
|
Path to the version mapping file. This is a json file that maps repo filenames to their corresponding versions. |
required |
wallet |
optional
|
Path to the wallet file. Default is |
required |
show_progress |
bool
|
If set, it will show progress bar while uploading files. |
required |
gateways |
optional
|
Commas separated list of Arweave gateways. |
required |
To upload a repo with ID
ritual-arweave upload-repo --repo-name
To upload a repo with ID
ritual-arweave upload-repo --repo-name
To upload a repo with ID
ritual-arweave upload-repo --repo-name