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. This package has two differences:

  • base_url and GATANA_BASE_URL are the base of the API, for example https://my-org.gatana.ai/api/v1. An organization ID gives that URL automatically.
  • It 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.0.6

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.0.6
File Size Uploaded Provenance Actions
gatana_client-2.0.6.tar.gz 199.4 kB Without provenance Details for gatana_client-2.0.6.tar.gz

Built distribution (wheel)

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

Total release size: 893.0 kB

Release files / gatana_client-2.0.6.tar.gz

Download URL gatana_client-2.0.6.tar.gz
Size 199.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c36d41a8a7b9f42c4235084b355a92a55c1c3d75dbddf4a392aeb28c1fb598a7
BLAKE2b-256 checksum
How to use checksums
3adb5bfc9314f8d6e0f0474ae216ca438685195c438d56d132d8b8e131fe9bbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL gatana_client-2.0.6-py3-none-any.whl
Size 693.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3886649bc23476bf3d47007aa90a712e6e14fb5d8f2ca3f7fcb1387f221a880
BLAKE2b-256 checksum
How to use checksums
4caffa58b550729c5440f959bfdfe34961db8a8c5afc392484e734b9aec137a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for gatana-client 2.0.6

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