Skip to main content

Python SDK for Meshpocalypse Semantic mesh — NATS + RDF + ATF

Project description

meshpocalypse-semantic — Python SDK

Python SDK for the Meshpocalypse Semantic mesh layer.

Provides async Python access to:

  • NATS messaging via MeshNode async context manager
  • SPARQL queries against the mesh RDF graph via SparqlClient
  • ATF trust checks via ATFClient

Install

pip install meshpocalypse-semantic

Quick Start

import asyncio
from meshpocalypse_semantic import MeshNode, ATFLevel

async def main():
    async with MeshNode("nats://localhost:4222") as mesh:
        # Publish a message
        await mesh.publish("mesh.events.my-agent", b"hello mesh")

        # Run a SPARQL query
        rows = await mesh.sparql.query(
            "SELECT ?agent WHERE { ?agent a <https://meshpocalypse.dev/ontology#Agent> }"
        )
        for row in rows:
            print(row["agent"]["value"])

        # Check ATF trust level
        level = await mesh.atf.get_trust_level("did:mesh:my-agent")
        if level >= ATFLevel.SENIOR:
            print("Agent has operational access")

asyncio.run(main())

Requirements

  • Python ≥ 3.10
  • NATS server running (e.g. docker run -p 4222:4222 nats:latest)
  • nats-py >= 2.8.0, rdflib >= 7.0, protobuf >= 4.0

Development

cd python-sdk
pip install -e ".[dev]"
pytest

Notes

  • BYOK: Bring your own NATS URL and LLM API keys — the SDK does not manage credentials.
  • MeshNode must be used as an async with context manager; calling methods outside raises RuntimeError.
  • SparqlClient requires a running Meshpocalypse SPARQL bridge on the NATS subject mesh.sparql.query.
  • ATFClient requires the TypeScript ATF service on mesh.atf.trust.check.

See docs/integrations/python.md for the full usage guide.

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

meshpocalypse-1.2.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

meshpocalypse-1.2.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file meshpocalypse-1.2.1.tar.gz.

File metadata

  • Download URL: meshpocalypse-1.2.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for meshpocalypse-1.2.1.tar.gz
Algorithm Hash digest
SHA256 e7d65e09b3b6d798cc10c1394f79d0ffdc8dd2f733d6e0202f5853b8918b83cf
MD5 0b91f7dc181b9620557fe7803a6bda9a
BLAKE2b-256 f6352aec732edd0222084c2677e28cf3f191151791b42a07ca7118553eca3e5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshpocalypse-1.2.1.tar.gz:

Publisher: publish-python.yml on one137th/Meshpocalypse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file meshpocalypse-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: meshpocalypse-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for meshpocalypse-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7ca9f3d612deba35c38e6517a0c40baa5e920f2cee98aa73522da5669d04e0f8
MD5 583a5fd8ec07397fb3f6caa023375459
BLAKE2b-256 10621f14d87a23becbcbeb14fb2c8ee529e76595a7b3ebbf9b3190c0f63321b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshpocalypse-1.2.1-py3-none-any.whl:

Publisher: publish-python.yml on one137th/Meshpocalypse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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