Skip to main content

pylestia

This module provides a Python interface for interacting with the Celestia Node API. All methods communicate with the API via JSON-RPC, offering a flexible and developer-friendly solution for integrating Celestia functionality into applications.

It is designed for developers who want to interact with the Celestia network without dealing with the complexities of low-level RPC request handling.

Getting Started

Please see our Quick Start Guide to get up and running with pylestia!

We also have example code to help you integrate pylestia into your projects.

Compatibility

IMPORTANT: This library is ONLY compatible with celestia-types v0.11.0 and later. It is NOT backward compatible with earlier versions.

Built exclusively for celestia-types v0.11.0+, supporting:

  • Blob signer information (Share Version 1)
  • Improved error handling for blob submission
  • Public ShareProof fields
  • Updated commitment formats

This library requires celestia-types v0.11.0 and is designed to work with the latest Celestia node versions.

🚀 Installation

# Add pylestia to your project dependencies
poetry add pylestia

# Or specify a specific version
poetry add pylestia==0.2.1

Alternative: Using pip

pip install pylestia

🔧 Usage

Connecting to Celestia Node

Below is an example of how to connect to a real Celestia node using its RPC endpoint.

from pylestia import Client

# Configuration for connecting to a Celestia node
node_url = "https://celestia-rpc.example.com"  # Replace with the actual RPC node URL
auth_token = "your-auth-token"  # Replace with your authentication token (if required)

# Initialize the client
client = Client(node_url)

# Example usage of the API
async with client.connect(auth_token) as api:
    balance = await api.state.balance()

Custom Deserialization Example

from pydantic import BaseModel

class CustomBalanceModel(BaseModel):
    amount: int
    denom: str

async with client.connect(auth_token) as api:
    # The `deserializer` parameter allows you to transform raw API data into a desired format
    last_height = await api.header.local_head(deserializer=lambda data: int(data['header']['height']))
    isinstance(last_height, int) # True
    # Use the Pydantic model to validate and transform the balance response
    balance = await api.state.balance(deserializer=CustomBalanceModel.model_validate)
    isinstance(balance.amount, int) # True

Contributing

Prerequisites

For those interested in contributing to pylestia:

# Clone the repository
git clone https://github.com/Bidon15/pylestia.git
cd pylestia

# Install dependencies with Poetry
poetry install

# Run Python-only tests (don't require Rust compilation)
poetry run pytest tests/test_models.py tests/test_blob_signer.py tests/test_python_only.py

# For full testing including Rust extensions
pip install maturin
maturin develop
poetry run pytest

Building from Source

pylestia contains Rust extensions, so you'll need:

  1. Rust and Cargo installed
  2. A supported Python version (3.10+)

To build the package:

# Install maturin if you don't have it
pip install maturin

# Build the package (will compile Rust code)
maturin build --release

# The built package can be installed with
pip install target/wheels/pylestia-0.2.0-*.whl

Metadata

Release files for pylestia 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pylestia 0.2.1
File Size Uploaded
pylestia-0.2.1.tar.gz 25.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pylestia 0.2.1
File Interpreter ABI Platform
pylestia-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 59.1 kB

Release files / pylestia-0.2.1.tar.gz

Download URL pylestia-0.2.1.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
987014a5759fa741e652b2b00fe7bce84dad0a80398a1160691fb1c9c753b936
BLAKE2b-256 checksum
How to use checksums
d3a2a80463f60235c9d9b59dd0cef206eea24118d12e578b57fb864477b61489
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.13.3 Darwin/24.4.0

Release files / pylestia-0.2.1-py3-none-any.whl

Download URL pylestia-0.2.1-py3-none-any.whl
Size 33.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a79d2a1d8a25a12438602729cbf70080d154b0c87f0877ef5a049d36a2a56272
BLAKE2b-256 checksum
How to use checksums
db875f9f60d0858712c910427053b2c73ce02cfa2f9c66c71db788eb8cf07ae6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.13.3 Darwin/24.4.0

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page