Registry / data / civis
library2.9.1pypypi✓ verified 86d ago

The Civis API Python Client provides a convenient way to interact with the Civis Platform API from Python. It allows users to manage data, jobs, scripts, and other resources within the platform. The current version is 2.8.1, and the library maintains an active release cadence with frequent minor updates and bug fixes.

pip install civis
INSTALL
IMPORT
SIG · CIVIS
C
civis
datapythonv2.9.1
Install
3.7s avg
Import
717ms
Disk
35MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.756s · 36.7MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.7s · import 0.677s · 37MB
35MB installed
● package 35MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

APIClient
from civis import APIClient
io
import civis.io
from civis import io
While `from civis import io` might work, `import civis.io` is the more common and recommended pattern for submodules.

Initialize the API client. It's recommended to set your Civis API key as an environment variable (CIVIS_API_KEY). This example attempts to list containers to verify connectivity and authentication.

import os from civis import APIClient # Best practice: set CIVIS_API_KEY environment variable # If not set, you can pass it directly: APIClient(api_key="YOUR_API_KEY") client = APIClient(api_key=os.environ.get('CIVIS_API_KEY', '')) # Example: List containers (requires appropriate permissions) try: containers = client.containers.list() print(f"Successfully connected! Found {len(containers)} containers.") except Exception as e: print(f"Error connecting to Civis Platform: {e}") print("Please ensure CIVIS_API_KEY is set correctly and has permissions.")
civis --version
Debug
Known issues
gotchaAlways set your Civis API key via the `CIVIS_API_KEY` environment variable. Passing the API key directly in code is less secure and not recommended for production.
fix
Set `CIVIS_API_KEY` in your environment or use a secure secret management solution. Example: `export CIVIS_API_KEY='your_api_key'`
affects: All versions
gotchaThe `civis.io` functions (e.g., `read_civis_sql`, `read_civis`) for dataframes gained a `return_as` keyword argument in v2.6.0. While the default `"list"` maintains backward compatibility for existing code, if you explicitly want a `pandas.DataFrame` or `polars.DataFrame`, you must specify `return_as="pandas"` or `return_as="polars"`.
fix
For DataFrame output, explicitly set `return_as="pandas"` or `return_as="polars"`: `df = civis.io.read_civis_sql(sql_query, database_id, return_as="pandas")`
affects: >=2.6.0
gotchaThe `PaginatedResponse` object gained a `.json()` method in v2.8.0. If you are on an older version and attempt to call `.json()` on a paginated response, it will result in an `AttributeError`.
fix
Upgrade to `civis>=2.8.0` to use the `.json()` method on `PaginatedResponse` objects. Alternatively, on older versions, iterate through the response to access items.
affects: <2.8.0
Errors
Common errors & fixes
civis.base.CivisAPIError: Civis API request failed with status code 401: Unauthorized
The `CIVIS_API_KEY` environment variable is either not set, incorrect, or the provided API key is invalid/expired. The client failed to authenticate with the Civis Platform.
fix
Verify your `CIVIS_API_KEY` environment variable is correctly set and contains a valid Civis API key. Ensure the key has the necessary permissions for the API calls you are making.
ModuleNotFoundError: No module named 'civis'
The `civis` library has not been installed in your current Python environment.
fix
Install the library using pip: `pip install civis`
AttributeError: 'PaginatedResponse' object has no attribute 'json'
You are attempting to use the `.json()` method on a `PaginatedResponse` object, but your `civis` library version is older than 2.8.0, where this method was introduced.
fix
Upgrade your `civis` library to version 2.8.0 or newer: `pip install --upgrade civis`. If unable to upgrade, you will need to process the paginated response by iterating over it rather than calling `.json()`.
Upgrade
Version history
2.9.1latest on PyPI · released Apr 27, 2026
Audit
Dependencies
pandasoptionalUsed by `civis.io` functions for DataFrame operations, though optional.
polarsoptionalUsed by `civis.io` functions for DataFrame operations as an alternative to pandas (added in v2.6.0), though optional.
Agent activity
20 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
civis — pip install civis · libregistry