Skip to main content

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 tfcmd for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grid3-0.3.0.tar.gz (29.9 kB view details)

Uploaded Source

Built Distribution

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

grid3-0.3.0-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

Details for the file grid3-0.3.0.tar.gz.

File metadata

  • Download URL: grid3-0.3.0.tar.gz
  • Upload date:
  • Size: 29.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.17.1-arch1-1

File hashes

Hashes for grid3-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9489c2681c31e03b78275706b1d8cb18d837c2a8e077c67f2c81f1b182d4f7f6
MD5 7825fec7a77a7b62e5a59c56da5c9dac
BLAKE2b-256 52153684fe2335c50a15eb24c53d2c832529ef77da856756d67e059238fee04b

See more details on using hashes here.

File details

Details for the file grid3-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: grid3-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 32.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.17.1-arch1-1

File hashes

Hashes for grid3-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae27d95e939f818e69af3f835255f5b9e5c3c4ee737e9a2a17da34ccb8556d28
MD5 40c60bb6f1d45cb4e3c127a99da09b94
BLAKE2b-256 940e29496fb298e9ea6ac0dbadb37e285b2a600601a51ee108b1fc2b079ce1ff

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