Skip to main content

Official Python SDK for the Plystra Kernel Phase 1 API.

Project description

plystra

Official Python SDK for the Plystra Kernel Phase 1 API.

PyPI package name: plystra Repository name: plystra/python-sdk

Requires Python 3.10 or newer.

Install

pip install plystra

Usage

Phase 1 is Context Mode: your trusted backend keeps its existing users, organizations, roles, and business rows, then calls Plystra to protect one action.

from plystra import Plystra

with Plystra("https://plystra.internal", api_key="ply_kernel_secret") as plystra:
    decision = plystra.authz.check(
        actor={
            "user_id": "user_external_alice",
            "member_id": "member_finance_reviewer",
            "binding_id": "binding_external_alice_finance",
            "space_id": "space_acme",
        },
        resource={
            "type": "invoice",
            "external_id": "invoice_001",
            "space_id": "space_acme",
            "group_path": "finance.apac",
            "owner_member_id": "member_invoice_creator",
        },
        grants=[{
            "role_key": "finance_approver",
            "resource": "invoice",
            "action": "approve",
            "scope": "group_tree",
            "space_id": "space_acme",
            "scope_anchor_group_path": "finance",
        }],
        action="approve",
        explain=True,
    )

Inline actor, resource, and grant context is trusted server-side input. Build it from your authenticated session and database state, never directly from browser-submitted JSON.

Async Usage

import asyncio
from plystra import AsyncPlystra


async def main() -> None:
    async with AsyncPlystra("https://plystra.internal", api_key="ply_kernel_secret") as plystra:
        print(await plystra.system.capabilities())


asyncio.run(main())

Kernel Surfaces

  • system.health(), system.ready(), system.version()
  • system.capabilities()
  • resource_types.list()
  • authz.check() and authz.explain()
  • audit.list() and audit.get()
  • request() for low-level calls

Attach a correlation id to a group of calls:

scoped = plystra.with_request_id("req_01HY...")
scoped.authz.explain(**context_mode_request)

Protected routes require a scoped server API key. Public health, readiness, and version checks do not send the key.

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

plystra-1.0.0rc115.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

plystra-1.0.0rc115-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file plystra-1.0.0rc115.tar.gz.

File metadata

  • Download URL: plystra-1.0.0rc115.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for plystra-1.0.0rc115.tar.gz
Algorithm Hash digest
SHA256 f613c1e21896739893eb95c64e7df978cc19e28ad7652b6c5a327886d09d302b
MD5 fb816acb6319895906b5c90f98761f01
BLAKE2b-256 95d5992d52dd18c7c68059377c9d3af345873ff389b8bd79c46d564921cb5195

See more details on using hashes here.

Provenance

The following attestation bundles were made for plystra-1.0.0rc115.tar.gz:

Publisher: publish.yml on plystra/python-sdk

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

File details

Details for the file plystra-1.0.0rc115-py3-none-any.whl.

File metadata

  • Download URL: plystra-1.0.0rc115-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for plystra-1.0.0rc115-py3-none-any.whl
Algorithm Hash digest
SHA256 9253b4dc7420802f4074b63a19e12f668999342d6b74ea8c323efbe902e1f280
MD5 0878a80e2ab9713a0ec7a19f151f328e
BLAKE2b-256 8a13fa494945642edaec1d98b22b0abf974a65f6f10dee493f6cea62e7f20b1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for plystra-1.0.0rc115-py3-none-any.whl:

Publisher: publish.yml on plystra/python-sdk

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