Install & Compatibility
Where this runs
tested against v0.167.0 · 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
py 3.10
✕ build_error
✕ build_error
py 3.9
✕ build_error
✕ build_error
387MB installed
● package 387MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Canvas
✓ from canvas_sdk import Canvas
✗ from canvas_sdk import Canvas
Initializes the Canvas SDK client using an API key from environment variables, and then attempts to fetch existing entities from your Canvas instance. This demonstrates basic connectivity and a read operation with the Canvas platform.
import os
from canvas_sdk import Canvas
# Ensure CANVAS_API_KEY is set as an environment variable
# Example: export CANVAS_API_KEY="your_api_key_here"
api_key = os.environ.get("CANVAS_API_KEY", "")
if not api_key:
print("Warning: CANVAS_API_KEY environment variable not set.")
print("Please set it to connect to your Canvas instance.")
# In a real application, you might raise an error here.
else:
try:
canvas_client = Canvas(api_key=api_key)
print("Canvas client initialized successfully.")
# Example: Attempt to retrieve entities from Canvas instance
print("Attempting to retrieve entities...")
entities_page = canvas_client.get_entities() # This sends an API request
print(f"Successfully retrieved {len(entities_page.data)} entities. First 3 names: {[e.name for e in entities_page.data[:3]]}")
except Exception as e:
print(f"Failed to connect or retrieve entities. Ensure API key is valid and Canvas is reachable. Error: {e}")
Debug
Known issues
gotchaThe PyPI package name is `canvas`, but the main import module is `canvas_sdk`. Importing `from canvas import Canvas` will result in a `ModuleNotFoundError`.fixAlways import from `canvas_sdk`: `from canvas_sdk import Canvas`.
affects: All versions
breakingThe `api_key` argument for `Canvas()` initialization became mandatory. Older code that initialized `Canvas()` without an API key will now fail.fixEnsure `Canvas(api_key="your_key")` is always called with a valid API key. It's recommended to load this from environment variables (e.g., `os.environ.get("CANVAS_API_KEY")`). affects: <0.50.0 to >=0.50.0
breakingThe `PythonAction` class and decorator were significantly refactored and moved. Code using `from canvas_sdk.actions import PythonAction` or the decorator might break.fixFor defining actions using a decorator, use `from canvas_sdk.functions import python_action`. For the underlying action classes, refer to `canvas_sdk.actions.Action` and its related types in the latest documentation.
affects: <0.80.0 to >=0.80.0
deprecatedThe `base_url` argument for `Canvas()` client initialization is deprecated and will be removed in future versions. The SDK will automatically infer the correct Canvas platform URL.fixRemove the `base_url` argument from your `Canvas` client initialization. If you have a custom Canvas instance URL, consult the documentation for alternative configuration methods.
affects: 0.100.0 and above
Upgrade
Version history
0.167.0latest on PyPI · released Jun 13, 2026
Audit
Dependencies
httpxrequiredPrimary HTTP client for API communication with the Canvas platform.