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.5

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.5
File Size Uploaded Provenance Actions
gatana_client-2.0.5.tar.gz 181.5 kB Without provenance Details for gatana_client-2.0.5.tar.gz

Built distribution (wheel)

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

Total release size: 810.2 kB

Release files / gatana_client-2.0.5.tar.gz

Download URL gatana_client-2.0.5.tar.gz
Size 181.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d76ddde15f8e8f8a67bb22dce35265654eb4b264991d79adb440a71c7825970a
BLAKE2b-256 checksum
How to use checksums
deb89aba8b5c170f77c99c7d0511687b2e199afa9057d5377f2dde6c8907e2b3
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.5-py3-none-any.whl

Download URL gatana_client-2.0.5-py3-none-any.whl
Size 628.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74a2c3cbdd47d486a446473065bef2ddfc50b5b796e22ead7e9b29f077be649a
BLAKE2b-256 checksum
How to use checksums
45823b6b624106be74475e622db0e36fd77aae3dc07566832ac6689d3ef9ae53
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.5

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