Skip to content

SPACE Python SDK ​

The SPACE Python SDK provides a Python interface to supported SPACE capabilities from scripts and Jupyter notebooks.

It is designed for Python code running inside SPACE, allowing scripts to use centrally managed configuration without hard-coding SPACE API calls, authentication tokens, credentials, or environment-specific connection details.

A primary use case is secure access to secrets and connections.

Authentication ​

Python executions inside SPACE receive a SPACE authentication token through the execution environment.

The SDK uses this authentication when communicating with the SPACE API, so scripts and notebooks do not need to embed a SPACE token in source code.

This also allows the same Python code to be reused without maintaining a separate SPACE API credential in the project.

Secrets ​

Use the SDK to retrieve a named secret when Python code needs credentials or another sensitive value managed by SPACE.

The detailed secret API, returned fields, and examples are documented under Secrets and connections.

A typical workflow is:

  1. An administrator creates the secret in SPACE.
  2. Python code requests the secret by name.
  3. The script uses the returned fields at runtime.
  4. The credentials remain outside the Python source code and Git repository.

Connections ​

The SDK can also expose configured SPACE connections to Python.

Import secrets and connections from the space package:

python
from space import secrets, connections

Use connections.get() to retrieve a configured SPACE connection:

python
config = connections.get("TeamOneTest")
print(config)

Use secrets.get() to retrieve a named secret:

python
username = secrets.get("Workday PROD")["username"]

The returned connection configuration can include the endpoint and authentication information required by a Python client library.

This makes it possible to reuse centrally configured connections rather than maintaining a second set of connection settings for Python.

Using the SDK with other Python libraries ​

The SDK does not replace libraries used to communicate with external systems. Instead, it can provide the configuration and credentials those libraries need.

For example, a Python workflow can:

  1. retrieve a configured IBM Planning Analytics connection from SPACE;
  2. obtain its connection and authentication settings;
  3. pass those values to TM1py;
  4. use TM1py for the Planning Analytics operation.

See TM1py for Planning Analytics examples.

Security ​

Avoid copying retrieved credentials into notebooks, logs, output, or source-controlled files.

The purpose of the SDK is to allow Python code to use centrally managed values at runtime while keeping sensitive configuration outside the code itself.

See Secrets and connections for practical usage patterns.