Modules for interacting with ThreeFold Grid v3.
Project description
Grid3.py
This is a collection of Python modules for working with ThreeFold Grid v3. It's designed foremostly for interactive use on the REPL and joyful scripting. We value conciseness and trying to do what you meant, even at the expense of a few extra CPU cycles.
The following are included:
- Client for querying data from GraphQL and Grid Proxy
- TFChain client mostly for queries but can also be used for submitting extrinsics
- Some minting related code, including minting period calculations
- RMB client based on RMB Peer (external processes required)
- Basic wrapper around
tfcmdfor creating deployments
If you're looking for a complete Grid v3 SDK, they are availalbe for Go and Typescript.
Installation
Tldr: pip install grid3
Requirements
Most of the functionality just requires python3.8 or newer.
The Reliable Message Bus functionality is Linux only and also depends on:
Detailed install
Assuming that python is python3 and pip is pip3, install the latest release from PyPI into a venv using pip:
python -m venv venv
source venv/bin/activate
pip install grid3
Quick tour
With the graphql module, you can easily answer questions like, how many nodes are currently in the standby state that were online in the last 24 hours?
import time, grid3.network
mainnet = grid3.network.GridNetwork()
sleepers = mainnet.graphql.nodes(['nodeID'], power={'state_eq': 'Down'}, updatedAt_gt=int(time.time()) - 24 * 60 * 60)
print(len(sleepers))
We just executed a query against the mainnet GraphQL endpoint nodes without even sweating a line break. Pretty cool!
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 grid3-0.2.1.tar.gz.
File metadata
- Download URL: grid3-0.2.1.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.3 Linux/6.12.30-1-lts
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7c209b632c4518405bf213ad9897b448672938d3cfafb65a19448ae9eef1afb
|
|
| MD5 |
e7e6be4d101079441f549df0a9eb1a24
|
|
| BLAKE2b-256 |
6fc350574e170d784895f171795819c8434deb9a61ec68724bf6bdbf78c13a36
|
File details
Details for the file grid3-0.2.1-py3-none-any.whl.
File metadata
- Download URL: grid3-0.2.1-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.3 Linux/6.12.30-1-lts
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ff8f3bcd349c222fea2345791fe1df631415594e61cb5153617a27b4381a917
|
|
| MD5 |
292021016898e68ac74ccf2dfe38598f
|
|
| BLAKE2b-256 |
8c2c3ef0463466d2f3e78300d1d1de7af63151c15ec7ee0917875f7f0e79a6d8
|