Skip to main content

PAWpy — Planning Analytics Workspace REST API Wrapper

PyPI version Python versions License: MIT

A TM1py-inspired Python wrapper for the PAW REST API.

Install

uv sync --extra dev         # installs PAWpy + pytest
uv run python -m pytest     # 32 offline tests (no live server needed)

Requires Python ≥3.11 and requests. The URL-builder calls (paw.ui.*, *.get_embed_url) make no network request and work without a live PAW server.

Releasing

Publishing is automated by .github/workflows/publish.yml via PyPI Trusted Publishing (OIDC — no API token stored). To cut a release:

  1. Bump version in pyproject.toml and add a CHANGELOG.md entry.
  2. One-time on PyPI: add a Trusted Publisher for project PAWpy → bluestarleo/PAWpy, workflow publish.yml, environment pypi.
  3. Tag and push:
    git tag v0.1.0 && git push origin v0.1.0
    

The workflow runs the tests (3.11–3.13), builds, checks the tag matches the package version, and publishes the sdist + wheel to PyPI.

Architecture

PAWService                  ← top-level entry point (mirrors TM1py's TM1Service)
├── RestService             ← session + auth + GET/POST/PATCH/PUT/DELETE core
├── ContentService          ← /pacontent/v1/Assets  (legacy OData folders / books / assets)
├── ContentV1Service        ← /api/v1/content  (OAuth-era assets, permissions,
│                             bulk ops, asset types — PAW 2.1.21+/3.1.8+)
├── UserGroupService        ← /api/v1/content/users|groups  (PAW 2.1.21+/3.1.8+)
├── BookService             ← books (type=book/dashboard) over ContentService
├── ViewService             ← views over ContentService
├── AdminService            ← /api/v1/admin  (servers, users, groups)
├── DatabaseService         ← /api/v1/databases  (list, start/stop/restart, TM1 12
│                             create/delete + backups — PAW 2.1.24+/3.1.11+)
├── UserAdminService        ← /api/v1/useradmin  (user & group CRUD, roles, states,
│                             CSV import/export, environments — PAW 2.1.25+/3.1.12+)
├── CloudAdminService       ← /api/v1/cloudadmin  (PA on Cloud subscriptions &
│                             invitations — SaaS only, PAW 2.1.24+/3.1.11+)
├── UIService               ← URL builder for /ui?type=… embed endpoints
└── TM1ProxyService         ← /api/v0/tm1/<db>/api/v1/…  (TM1 REST via PAW auth;
                              pass tm1_proxy_base="/api/v1/tm1" on PAW 2.1.21+/3.1.8+)

All base paths (content_base, content_v1_base, admin_base, databases_base, useradmin_base, cloudadmin_base, tm1_proxy_base) are constructor-overridable, since they vary across PAW builds (/pacontent/v1 vs /api/v1/content).

Pre-release surfaces. DatabaseService, UserAdminService and CloudAdminService wrap folders that IBM's Postman collection tags for PAW 2.1.24/3.1.11 and 2.1.25/3.1.12. At the time of writing IBM's latest GA "What's new" was 2.1.23, so these version pins are marked UNVERIFIED in version_requirements.py until IBM publishes the release notes.

Auth Modes

Mode How it works
oauth Client-credentials grant against an IdP token_url → Authorization: Bearer (see caveat below)
cam CAM namespace login via POST /login → x-csrf-token — the proven headless mode for on-prem PAW
native TM1 native username/password login via POST /login → x-csrf-token
passport Cognos CAM passport (camid) via POST /login
session Inject an existing csrf_token / session_cookie (dev/test)

On-prem OAuth caveat (per IBM Docs, "Configuring authorized applications (OAuth)"): PAW's built-in OAuth (Administration → Integrations tile, PAW 2.1.21+/3.1.8+) supports only the interactive authorization-code flow (scope v0userContext) — "client credentials (not interactive) flows are not supported" against PAW's own /oauth2/token. Use oauth mode only where an external IdP issues bearer tokens your PAW deployment accepts. For headless/scripted access to on-prem PAW, use cam mode with directory credentials (PAW shares the CAM directory with TM1, so TM1 service credentials typically work). Authorization-code + refresh-token support is on the roadmap.

Usage

OAuth (IdP-issued tokens — see caveat above)

from PAWpy import PAWService

with PAWService(
    host="paw.mycompany.com",
    auth_mode="oauth",
    client_id="my-client-id",
    client_secret="my-client-secret",
    token_url="https://idp.mycompany.com/oauth2/token",  # required for oauth
    scope="paw",                    # optional
    database="Planning Sample",          # optional default TM1 database
) as paw:

    # List books in a folder (returns Asset objects)
    books = paw.books.get_all("/shared/Finance")

    # Get embed URL for an iframe (no HTTP call)
    url = paw.books.get_embed_url("/shared/Finance/Monthly Report")

    # List registered TM1 servers
    servers = paw.admin.get_tm1_servers()

    # OAuth-era content API (PAW 2.1.21+/3.1.8+): permissions, bulk ops, users
    assets = paw.content_v1.list_children("shared")
    perms  = paw.content_v1.get_effective_permissions(assets[0].id)
    users  = paw.user_groups.get_users()

    # TM1 proxy call (MDX via PAW auth) — returns the raw cellset JSON
    tm1 = paw.tm1("Planning Sample")
    data = tm1.execute_mdx("SELECT {[Account].[Revenue]} ON 0 FROM [Revenue Cube]")
    stats = tm1.get_metrics(cube="plan_BudgetPlan")   # TM1 Metrics API via the proxy

    # Database admin (PAW 2.1.24+/3.1.11+): the PAA "database details" buttons
    dbs = paw.databases.get_all()
    paw.databases.restart("Planning Sample")
    backups = paw.databases.get_backups("Planning Sample", "MANUAL")   # TM1 12 only

    # User admin (PAW 2.1.25+/3.1.12+): write-capable users & groups
    roles = paw.user_admin.get_roles()
    grp   = paw.user_admin.create_group("Finance Modelers", role_name="Modeler")
    paw.user_admin.add_user_to_group(grp["id"], login_id="jdoe")

    # Embed URL generation (no HTTP call)
    embed = paw.ui.cube_viewer_url("Planning Sample", "plan_BudgetPlan", view="Budget Input")
with PAWService(
    host="paw.mycompany.com",
    auth_mode="cam",
    namespace="LDAP",
    username="my-username",
    password="secret",
) as paw:
    ...

Multi-tenant (PAW Cloud)

with PAWService(
    host="planning-analytics.cloud.ibm.com",
    tenant_id="my-tenant-id",
    auth_mode="oauth",
    client_id="...",
    client_secret="...",
) as paw:
    ...

Mapping to TM1py

TM1py PAWpy
TM1Service PAWService
CubeService TM1ProxyService (via PAW)
DimensionService TM1ProxyService (via PAW)
ProcessService TM1ProxyService (via PAW)
(no equivalent) BookService
(no equivalent) ContentService
(no equivalent) AdminService
(no equivalent) UIService

Versioning against PAW builds

The PAW REST API is still incomplete and grows with each IBM release, so PAWpy is versioned against two axes: its own semver (PAWpy.__version__) and the minimum PAW build each API group requires. Each service declares its API_GROUP; the per-group minimums live in PAWpy/version_requirements.py (MIN_PAW_VERSION).

paw = PAWService(host="paw.acme.com", auth_mode="oauth", ..., paw_version="2.1.21")

paw.requires("content")          # -> "2.1.21"  (min PAW build for Content Services)
paw.supports("content")          # -> True / False against the known paw_version
paw.assert_supported("content")  # raises PAWVersionError if the build is too old
paw.detect_paw_version()         # best-effort probe (overridable path/field)

When paw_version is unknown, gating is a no-op — PAWpy never blocks a call solely because it couldn't determine the version; the server still rejects genuinely-unsupported requests. The version pins are reconciled on each PAW release as part of a maintainer-local workflow.

Coverage & release tracking

PAWpy's endpoint coverage is tracked in a maintainer-local coverage matrix (not part of this repo). Because the PAW REST API is still growing, it is reconciled on each PAW release: IBM's endpoint inventory (the IBM-linked Postman collection or the published API references) is re-pulled and diffed against the matrix to flag endpoints PAW now exposes that PAWpy doesn't yet wrap, so the wrapper tracks IBM's cadence instead of drifting. New coverage lands here as Added entries in CHANGELOG.md and Roadmap items below.

Roadmap (aligned with IBM's "future releases" promise)

  • Content API v1 (/api/v1/content, PAW 2.1.21+/3.1.8+) — ContentV1Service: assets incl. content retrieval, permissions (get/set/effective), bulk copy/move/delete/permissions, asset types
  • UserGroupService — PAW users/groups reads (/api/v1/content/users|groups)
  • UserAdminService — write-capable users & groups (/api/v1/useradmin, collection folder "User admin (2.1.25 & 3.1.12)")
  • DatabaseService — database lifecycle + TM1 12 backups (/api/v1/databases, "Databases (2.1.24 & 3.1.11)")
  • CloudAdminService — PA on Cloud subscriptions/invitations (/api/v1/cloudadmin)
  • TM1ProxyService.get_metrics() — typed helper for the TM1 Metrics API (GET {db}/api/v1/Metrics())
  • Live-validate the 2.1.24 / 2.1.25 surfaces once a GA build is available and drop the UNVERIFIED markers
  • ViewService — PAW view CRUD
  • EmbedTokenService — generate scoped embed tokens
  • MCPService — PAW MCP endpoint integration. Scope decision still open: PAW 2.1.22 (26 June 2026) consolidated all Planning Analytics Agent MCP tools under the unified /ibm-pa-tools endpoint and removed the discrete cube-tools/analysis-tools endpoints. IBM's Postman collection carries no MCP requests yet, so nothing to diff; MCP is IBM's third PAW API class alongside Workspace APIs and the TM1 proxy.
  • OAuth authorization-code + refresh-token flow — the only OAuth on-prem PAW supports (client-credentials is rejected per IBM Docs)
  • Async support (aiohttp)
  • Pydantic models for Books, Assets, Servers

Metadata

Release files for PAWpy 0.5.0

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

Source distribution (sdist)

Source distribution for PAWpy 0.5.0
File Size Uploaded Provenance Actions
pawpy-0.5.0.tar.gz 38.5 kB With provenance Details for pawpy-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PAWpy 0.5.0
File Interpreter ABI Platform Actions
pawpy-0.5.0-py3-none-any.whl Python 3 none any Details for pawpy-0.5.0-py3-none-any.whl

Total release size: 80.5 kB

Release files / pawpy-0.5.0.tar.gz

Download URL pawpy-0.5.0.tar.gz
Size 38.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a061d045faaf0f9734415d666679fce5fe0bb957410a6d458975a02af2322c10
BLAKE2b-256 checksum
How to use checksums
f9971eb812472447718cf53d672d58fbc4072e1b282cf39d0b092248f77fe9de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Release files / pawpy-0.5.0-py3-none-any.whl

Download URL pawpy-0.5.0-py3-none-any.whl
Size 42.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
443b73b6d171fab78d8a7711670c0c757d3da47016c2816d6a92458937f7b412
BLAKE2b-256 checksum
How to use checksums
c8f7f31d4a78b9ac51c57a23fece0fa46f7e04282451de0a8a76e93bab28e595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

Security for PAWpy 0.5.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pawpy-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 19, 2026.

Transparency log

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