Skip to main content

Python SDK for Cards — create and manage projects, chain cards, and work items with a cards_pat token

Project description

imagineers-cards-sdk

The Python SDK for Cards. Create and manage projects, chain cards, and work items from any product — Cards becomes a database you write to with a single API key. Zero runtime dependencies.

Install

pip install imagineers-cards-sdk

Authenticate

The SDK uses the same token the cards CLI stores at login. Mint one at imagineers.cards/cli-token — it starts with cards_pat_. Keep it secret; it grants full read/write to your account.

import os
from cards_sdk import CardsClient

cards = CardsClient(api_key=os.environ["CARDS_API_KEY"])

Projects

cards.projects.create("my-app", name="My App")
cards.projects.list()
cards.projects.get("my-app")
cards.projects.update("my-app", name="Renamed")
cards.projects.delete("my-app")

A project with subprojects cannot be deleted until its children are removed or reparented — the API returns a 409 and the SDK raises a CardsApiError.

Chain cards

The chain is the project's append-only log of decisions, observations, invariants, questions, and artifacts.

card = cards.chain.create(
    "my-app",
    title="We chose Postgres over SQLite for the write throughput",
    kind="decision",
    body="Alternatives considered…",
)

cards.chain.list("my-app", kind="decision", limit=20)
cards.chain.get("my-app", card.slug)
cards.chain.update("my-app", card.slug, status="published")
cards.chain.delete("my-app", card.slug)

Work items

Work items are the ephemeral do-and-toss layer parallel to the chain.

item = cards.work.create("my-app", title="Ship the import flow", labels=["feature"])

cards.work.list("my-app", status="todo")
cards.work.update("my-app", item.id, status="done")
cards.work.delete("my-app", item.id)

Errors

Every non-2xx response raises a CardsApiError carrying the HTTP status and the request that failed.

from cards_sdk import CardsApiError

try:
    cards.projects.create("taken")
except CardsApiError as error:
    if error.status == 409:
        ...  # slug already exists

Configuration

Argument Default Notes
api_key (required) A cards_pat_ token.
base_url https://cards-api.krishnanandb.workers.dev Point at a local or staging Worker.
timeout 30.0 Per-request timeout in seconds.

Returned values are frozen dataclasses (Project, CreatedProject, ProjectSummary, Card, WorkItem). Requires Python 3.10+.


## Development

```bash
uv sync
uv run pytest            # unit tests
uv run ruff check        # lint
CARDS_API_KEY=… uv run pytest tests/smoke   # live round-trip against prod

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imagineers_cards_sdk-0.1.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imagineers_cards_sdk-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file imagineers_cards_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: imagineers_cards_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","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}

File hashes

Hashes for imagineers_cards_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 32aaf9e80d2f156a75fa38760d7be0f643e0775dd84d339f4b9a4999d09f694c
MD5 fe74c060323f51a1d43544d0dbfa29d2
BLAKE2b-256 f288f6f7a60e6bc4cfe67ed6382806dc3284900b8c3bfe6b0a81495d67971b0c

See more details on using hashes here.

File details

Details for the file imagineers_cards_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: imagineers_cards_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.18 {"installer":{"name":"uv","version":"0.11.18","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}

File hashes

Hashes for imagineers_cards_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 333481610e1d4d8f202f199ee640e999be902534f1458834bc34f39641824b8b
MD5 c9b52235646decccf65720b2e9a376fb
BLAKE2b-256 7bfdf8ce4e07586f67ddfd2947c8f55a6a3f619edb86573b44ae6275bd9f6364

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page