Skip to main content

gatana-client

PyPI License: MIT

Python client for the Gatana API. It is generated from the backend's OpenAPI document with openapi-python-client, and adds the loading of the credentials. Python 3.10+.

Install

pip install gatana-client

Or with uv:

uv add gatana-client

Usage

The easiest way to start is GatanaClient. It finds the configuration in parameters, environment variables or ~/.gatana.config.

from gatana_client import GatanaClient

# Explicit
client = GatanaClient(token="gk_...", org_id="my-org")

# Or no configuration in code: reads GATANA_API_KEY and GATANA_ORG_ID,
# or else ~/.gatana.config
client = GatanaClient()

Configuration

GatanaClient uses the first source that is complete:

  1. token, and org_id or base_url, passed to GatanaClient
  2. The environment variables GATANA_API_KEY, and GATANA_ORG_ID or GATANA_BASE_URL
  3. The config file ~/.gatana.config

See Configuration for the environment variables and the config file, which the CLI and the JavaScript SDK also use. GatanaClient uses only the host of base_url and GATANA_BASE_URL and adds /api/v1, so https://my-org.gatana.ai and https://my-org.gatana.ai/api/v1 give the same client.

This package does not refresh OIDC tokens from the config file. Use an API key or a personal access token for scripts and CI.

To select the strategies yourself, give a config_loader:

from gatana_client import ConfigLoader, EnvConfigStrategy, FileConfigStrategy, GatanaClient

client = GatanaClient(
    config_loader=ConfigLoader([EnvConfigStrategy(), FileConfigStrategy(org_id="other-org")])
)

Calling endpoints

Each API endpoint is a Python module with sync and async variants:

from gatana_client.api.sandboxes import list_sandboxes

with client as client:
    sandboxes = list_sandboxes.sync(client=client)

Async:

async with client as client:
    sandboxes = await list_sandboxes.asyncio(client=client)

Every endpoint module has four functions:

Function Description
sync Blocking, returns parsed data or None
sync_detailed Blocking, returns the full Response
asyncio Async version of sync
asyncio_detailed Async version of sync_detailed

Development

Most of this package is generated. Run these from the repository root:

just generate-py   # download the OpenAPI document and regenerate the client
just generate-py https://acme.local.gatana.ai/api/v1/openapi.json   # from a local backend

The generator replaces api/, models/, types.py, errors.py and _base_client.py in gatana_client/. These files are hand-written, and the generator keeps them: client.py, config.py, __init__.py and py.typed.

The Python dev environment, the lint and type-check config and the tests (tests/test_config.py for this package) are in packages/gatana-langchain. That package installs this one from its folder. See its README for the just py-* recipes.

Releasing

just release in the repository root releases every package with changes, this one included. To release only this package:

just py-release gatana-client patch           # tag and make a GitHub release
just py-release gatana-client patch publish   # also publish to PyPI

License

MIT

Metadata

Release files for gatana-client 2.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 gatana-client 2.1.0
File Size Uploaded Provenance Actions
gatana_client-2.1.0.tar.gz 204.8 kB Without provenance Details for gatana_client-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gatana-client 2.1.0
File Interpreter ABI Platform Actions
gatana_client-2.1.0-py3-none-any.whl Python 3 none any Details for gatana_client-2.1.0-py3-none-any.whl

Total release size: 917.3 kB

Release files / gatana_client-2.1.0.tar.gz

Download URL gatana_client-2.1.0.tar.gz
Size 204.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2577270c68a15e4adcf4eece8ca964699f730dd5729ec36a88383479f6b96277
BLAKE2b-256 checksum
How to use checksums
e94bd1e3210575dc0e3147eeb80d418b49e59e5351960a5b85183356b2fc5e7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / gatana_client-2.1.0-py3-none-any.whl

Download URL gatana_client-2.1.0-py3-none-any.whl
Size 712.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc5f504c803af72f1396f6549654a42117e59c0e1dd72e14d75f9840ba22aa91
BLAKE2b-256 checksum
How to use checksums
3d34e0bc3de848f79ac85d9f935f1bcdd4e99cb7da8e3c35c673bf2468400cb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for gatana-client 2.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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