gatana-client
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:
token, andorg_idorbase_url, passed toGatanaClient- The environment variables
GATANA_API_KEY, andGATANA_ORG_IDorGATANA_BASE_URL - 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_urlandGATANA_BASE_URLare the base of the API, for examplehttps://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
Metadata
Release files for gatana-client 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gatana_client-2.0.3.tar.gz | 165.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gatana_client-2.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 732.0 kB
Release files / gatana_client-2.0.3.tar.gz
| Download URL | gatana_client-2.0.3.tar.gz |
|---|---|
| Size | 165.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8519abeef75a0350f9eac357ef0308dc13bd5411814da78a2e85eba0daee234
|
|
BLAKE2b-256 checksum How to use checksums |
0df10e86cd96e1c49bd0c7f42a5fc2706444ac8c6521be06f8d28eff452c59c9
|
| 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.3-py3-none-any.whl
| Download URL | gatana_client-2.0.3-py3-none-any.whl |
|---|---|
| Size | 566.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc6d8f128688d2fe3cfff779483f5a8ed6cbe3983bca5bc42d7ed27e4daf46a7
|
|
BLAKE2b-256 checksum How to use checksums |
31ac2e9d7b580c53dfb8a30bcf4e1b078caac3fd07761d656979e01e4f1d1135
|
| 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}
|