Skip to main content

A TM1py-inspired Python wrapper for the IBM Planning Analytics Workspace (PAW) REST API.

Project description

PAWpy — Planning Analytics Workspace REST API Wrapper

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

Install

uv sync --extra dev         # installs PAWpy + pytest
uv run python -m pytest     # 14 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 PAWpybluestarleo/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  (OData folders / books / assets)
├── BookService             ← books (type=book/dashboard) over ContentService
├── ViewService             ← views over ContentService
├── AdminService            ← /api/v1/admin  (servers, users, groups)
├── UIService               ← URL builder for /ui?type=… embed endpoints
└── TM1ProxyService         ← /api/v0/tm1/<db>/api/v1/…  (TM1 REST via PAW auth)

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

Auth Modes

Mode How it works
oauth Client-credentials grant against token_urlAuthorization: Bearer
cam CAM namespace login via POST /loginx-csrf-token
native TM1 native username/password login via POST /loginx-csrf-token
passport Cognos CAM passport (camid) via POST /login
session Inject an existing csrf_token / session_cookie (dev/test)

Usage

OAuth (Recommended)

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="Global FPA",          # optional default TM1 database
) as paw:

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

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

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

    # TM1 proxy call (MDX via PAW auth) — returns the raw cellset JSON
    tm1 = paw.tm1("Global FPA")
    data = tm1.execute_mdx("SELECT {[Account].[Revenue]} ON 0 FROM [Revenue Cube]")

    # Embed URL generation (no HTTP call)
    embed = paw.ui.cube_viewer_url("Global FPA", "Revenue Cube", view="Monthly View")

Legacy CAM

with PAWService(
    host="paw.mycompany.com",
    auth_mode="cam",
    namespace="LDAP",
    username="leo",
    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

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

  • ViewService — PAW view CRUD
  • UserGroupService — full user/group management
  • EmbedTokenService — generate scoped embed tokens
  • MCPService — PAW MCP endpoint integration
  • Token refresh / OAuth expiry handling
  • Async support (aiohttp)
  • Pydantic models for Books, Assets, Servers

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

pawpy-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

pawpy-0.1.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pawpy-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pawpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 65cf4e7352236bad7482771ddda9990c8c10d184d3251066029d7b6693198413
MD5 4a5eb7d5a990da24c16c421510caeec7
BLAKE2b-256 25db5f23725795959055886070a6374406a377fd5b76e852fd28bbcaf9bd5549

See more details on using hashes here.

Provenance

The following attestation bundles were made for pawpy-0.1.0.tar.gz:

Publisher: publish.yml on bluestarleo/PAWpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: pawpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pawpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d891d5ccf3d7c4a6aefe119a31cafe578b393aed2e2e08840231307f109e2feb
MD5 ed963adb0624ab02d89330a3ed1645ce
BLAKE2b-256 056f14fac7dd24f5fab619504abe72f2a4519a4d6485eed1998d77f999f3a5a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pawpy-0.1.0-py3-none-any.whl:

Publisher: publish.yml on bluestarleo/PAWpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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