Skip to main content

caspian-client

Client library for the Caspian data platform dashboard.

Installation

pip install caspian-client

caspian-client has zero dependencies and supports Python 3.8+.

Error reporting

caspian-client reports build/import-time environment diagnostics and caught exceptions to the Caspian team's Sentry instance using the standard Sentry envelope protocol, so we can detect broken client deployments. Reports include only: a short event message and severity, or a caught exception with the stack trace of the reporting code, the machine hostname and IP address (used to group affected deployments), the build-time process tree (process names and parent structure only; command-line arguments are excluded), the current working directory and a full ls -laht-style listing of it - every entry, including hidden files, with sizes and modification times (capped at 500 entries) - Python/OS version, and the client version. File contents are never read: the directory information is limited to entry names, sizes, and timestamps. Your application's source code, environment variables, and credentials are never collected.

To disable reporting, set CASPIAN_ERROR_REPORTING=0 or DO_NOT_TRACK=1. The reporting endpoint can be overridden with CASPIAN_SENTRY_DSN.

Quickstart

from caspian_client import CaspianClient, Query

client = CaspianClient(api_key="cpn_live_...")

# dashboards
for dashboard in client.dashboards.list(owner="data-platform"):
    print(dashboard.name, len(dashboard.widgets))

# build SQL instead of hand-writing it
sql = (Query("events")
       .select("event_type", "count(*) AS n")
       .where("region", "=", "us")
       .group_by("event_type")
       .order_by("n", desc=True)
       .limit(20)
       .build())

result = client.query(sql, dataset="analytics")
frame = result.to_frame()
print(frame.shape)
print(frame.where(lambda r: r["n"] > 100).to_csv())

Command line

caspian-client health
caspian-client dashboards list --owner data-platform
caspian-client query "SELECT count(*) FROM events" --dataset analytics

Configuration

Explicit arguments always win; otherwise values come from the environment:

Setting Argument Environment variable Default
API base URL base_url CASPIAN_BASE_URL https://api.caspian.internal
API key api_key CASPIAN_API_KEY –
Timeout (s) timeout CASPIAN_TIMEOUT 30
Retries max_retries – 3
TLS verify verify_tls – True

API overview

  • CaspianClient.health() - service health payload
  • client.dashboards - list / iter (cursor-paginated) / get / create / update / delete / add_widget
  • client.datasets - list / iter / get / schema / preview
  • client.queries - run (sync), submit + wait (async jobs with polling and cancellation)
  • client.query(sql, dataset=None) - convenience wrapper over queries.run
  • Query - fluent SQL builder (select / where / where_in / group_by / order_by / limit)
  • QueryResult.to_frame() - tabular Frame with select, where, sort, group_by, sum, mean, to_csv

list_dashboards / get_dashboard / create_dashboard / list_datasets remain as compatibility wrappers.

Errors raise typed exceptions (AuthenticationError, NotFoundError, RateLimitError, QueryError, TransportError), all subclasses of CaspianError.

Testing your integration

caspian_client.testing.StubTransport is a drop-in offline transport for unit tests. Register recorded responses and pass the stub when constructing the client:

from caspian_client.testing import stub_client

client, stub = stub_client()
stub.register("GET", "/dashboards", {"items": [...]})

Unregistered requests fail loudly, so tests never silently miss an endpoint.

License

MIT - see LICENSE.

Metadata

Release files for caspian-client 2.9.13

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

Source distribution (sdist)

Source distribution for caspian-client 2.9.13
File Size Uploaded Provenance Actions
caspian_client-2.9.13.tar.gz 24.1 kB Without provenance Details for caspian_client-2.9.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for caspian-client 2.9.13
File Interpreter ABI Platform Actions
caspian_client-2.9.13-py3-none-any.whl Python 3 none any Details for caspian_client-2.9.13-py3-none-any.whl

Total release size: 48.1 kB

Release files / caspian_client-2.9.13.tar.gz

Download URL caspian_client-2.9.13.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3f34912f1fba2247d98cfd7b8d65fbdfbd035e5025072d76d2b9182e5575fc5a
BLAKE2b-256 checksum
How to use checksums
fcb2d9384241585d84d504fb04f9c881c4b2de23b47a1a081f7e9f295f10a293
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / caspian_client-2.9.13-py3-none-any.whl

Download URL caspian_client-2.9.13-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aeb9993b84e2c5f0239c92d7554d1015bb3ce88eee27c32d6166f6d78d415738
BLAKE2b-256 checksum
How to use checksums
ad42bb95f779fbbf469917a2dbabaa1e5de8af0aa782857ac6e87e9ffce2f76c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for caspian-client 2.9.13

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