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.3.0.tar.gz (21.1 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.3.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for meshpocalypse-1.3.0.tar.gz
Algorithm Hash digest
SHA256 79b40297a7f1fe4cedeefa36fce8b26176fd0ed009aa386f1744ac42310a7d57
MD5 34ceae6dbf53cf78d98a478db7c4fcbe
BLAKE2b-256 8129fea4ff5daa2aefe978bc5541fc42b056bc7fdee3523fb62f9b38997ba72d

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshpocalypse-1.3.0.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: meshpocalypse-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 21.6 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb6568b72439c80c6bc406ffec022b076f35e7a12a72ba336d6238bc28bf7078
MD5 55bdc88024d2d1153a292000372d9867
BLAKE2b-256 16c2c4ddc0f77a5709682c46d38ecdac62f7910755124be57f040f9a4188d20b

See more details on using hashes here.

Provenance

The following attestation bundles were made for meshpocalypse-1.3.0-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