Skip to main content

Pantech Dynamics Python SDK

CI PyPI License: MIT

The official Python library for the Pantech Dynamics public API: instances, VPC networks, firewalls, public IPs, load balancers, volumes, snapshots, managed databases, managed Kubernetes, SSH keys, webhooks, billing and usage.

  • Sync (Pantech) and asyncio (AsyncPantech) clients with the same methods
  • Every operation in the public API, with typed keyword arguments and TypedDict results
  • Automatic Idempotency-Keys, safe retries, cursor pagination, operation and order waiting
  • Webhook signature verification
  • One dependency: httpx. Python 3.10+.

Full documentation: https://docs.pantechdynamics.com/sdks/python

Install

pip install pantech

Quickstart

Create an API key in the console under Organization › API keys, then:

export PANTECH_API_KEY=PAN_...
import pantech

with pantech.Pantech() as client:
    me = client.me.get()
    print("Organization", me["organization_id"])

    for instance in client.instances.list_all():
        print(instance["id"], instance["name"], instance["observed_state"])

Create an instance and wait for it

order = client.instances.create(
    name="web-1",
    plan_slug="starter",
    image_slug="ubuntu-24-04",
    ssh_key_id="sshk_...",
)
client.instances.wait_for_order(order["order_id"])  # raises OrderFailedError if it fails
instance = client.instances.get(order["instance_id"])
print(instance["public_ipv4"])

Most changes return 202 Accepted with an operation. Wait for it:

accepted = client.instances.stop("vm_...")
client.operations.wait(accepted["operation_id"], timeout=300)  # raises OperationFailedError on failure

Async

import asyncio
import pantech


async def main() -> None:
    async with pantech.AsyncPantech() as client:
        async for volume in client.volumes.list_all():
            print(volume["name"])


asyncio.run(main())

Resources

Families are attributes of the client and nest where the API does:

client.networks.create(name="prod", cidr="10.10.0.0/16")
client.networks.subnets.list("net_...")
client.networks.firewall_rules.create("snet_...", ...)
client.public_ips.port_forwarding_rules.list("pip_...")
client.databases.snapshots.create("db_...", name="before-migration")
client.kubernetes.node_pools.scale("k8s_...", "k8spool_...", workers=3)
client.catalog.list_plans(placement="vpc")
client.billing.receipts.get_pdf("rcpt_...")  # bytes

Arguments are keyword-only, except the ids in the path. Optional arguments you leave out are not sent; passing None sends JSON null. Results are plain dicts typed with the TypedDicts in pantech.types. client.request("GET", "/me") calls any route directly.

Configuration

Option Environment Default
api_key PANTECH_API_KEY (required)
base_url PANTECH_API_URL https://api.pantechdynamics.com/public/v1
timeout 60 s per attempt (10 s to connect); a number or an httpx.Timeout
max_retries 3
default_headers, user_agent, http_client

Every method also takes timeout=, extra_headers=, extra_query= and (with a body) extra_body=. Writes take idempotency_key=.

Retries and idempotency

Every POST, PUT, PATCH and DELETE gets a fresh UUIDv4 Idempotency-Key, and retries resend the same key, so the API returns the first result instead of repeating the change. Connection errors, timeouts, 429, 500, 502, 503 and 504 are retried up to max_retries times with jittered exponential backoff, or after the Retry-After the API sends.

A few writes are not replayed by the API, so the SDK sends them once and retries only a 429: creating and deleting SSH keys, opening a console, issuing a volume key credential, revoking the calling key (client.me.revoke()), and the webhook test, delete, secret rotation and redelivery calls.

Errors

try:
    client.networks.subnets.get("snet_...")
except pantech.NotFoundError as err:
    print(err.detail, err.request_id)
except pantech.ValidationError as err:
    for field in err.errors:
        print(field["field"], field["code"], field["message"])
except pantech.APIError as err:
    print(err.status, err.code, err.detail)

APIError carries status, code (stable: branch on it), title, detail (safe to show), request_id (quote it to support) and errors. Subclasses: BadRequestError (400), AuthenticationError (401), PaymentRequiredError (402), PermissionDeniedError (403), NotFoundError (404), ConflictError (409), ValidationError (422), RateLimitError (429), InternalServerError (5xx). No answer at all is APIConnectionError (or APITimeoutError). Waiting raises OperationFailedError, OrderFailedError or WaitTimeoutError. All of them are PantechError.

Webhooks

import pantech


def handle(headers, raw_body: bytes) -> None:
    pantech.verify_webhook(
        secret="whsec_...",
        header=headers.get("Pantech-Signature"),
        body=raw_body,  # the raw bytes, before JSON parsing
        tolerance=300,  # seconds; the default
    )  # raises WebhookVerificationError

The comparison is constant-time, and any of several v1 signatures may match (there are two for 24 hours after a secret rotation). See examples/webhook_server.py.

Examples

Development

python3 -m venv .venv && .venv/bin/pip install -e . pytest pytest-asyncio mypy ruff pyyaml types-PyYAML
.venv/bin/python scripts/sync_spec.py   # download the published spec into openapi/public-api.yaml
.venv/bin/python scripts/generate_types.py && .venv/bin/python scripts/generate_resources.py
.venv/bin/ruff check . && .venv/bin/mypy && .venv/bin/pytest -q

The SDK is generated from the published OpenAPI spec. See CONTRIBUTING.md for the workflow and how releases are made. Report security issues as described in SECURITY.md.

License

MIT. See LICENSE.

Metadata

Release files for pantech 0.1.0

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

Source distribution (sdist)

Source distribution for pantech 0.1.0
File Size Uploaded Provenance
pantech-0.1.0.tar.gz 164.8 kB With provenance Details

Built distribution (wheel)

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

Total release size: 241.5 kB

Release files / pantech-0.1.0.tar.gz

Download URL pantech-0.1.0.tar.gz
Size 164.8 kB
Tags Source
SHA-256 checksum
How to use checksums
321b913ec0731fd309a06a7ba82d39492e231d92a1664689e1a4b7ec728b1922
BLAKE2b-256 checksum
How to use checksums
988ca4aa3bdd7cc815b6b62af00edb5bcf448516279dd815dbf8b8d3c79a6993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / pantech-0.1.0-py3-none-any.whl

Download URL pantech-0.1.0-py3-none-any.whl
Size 76.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
61d91b60d38ddf92bece0bdb8ebe0e6d3edeaf6a8bd4fa659a0cc7c8e3b1c6a3
BLAKE2b-256 checksum
How to use checksums
c0ab1c51a6238eab082e571a9921fc5674038c04673f3e6d33fdb8a1f1b004e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for pantech 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pantech-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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