Skip to content

Python ​

SPACE includes an integrated Python and Jupyter environment for analysis, development, and automation. Work with notebooks and Python scripts directly in SPACE, install additional packages, use Git for version control, and run scripts automatically through SPACE jobs.

Python can also integrate with other parts of SPACE through the SPACE Python SDK. Scripts and notebooks can securely access secrets and configured connection information without hard-coding credentials, making it practical to build reusable integrations and automation for IBM Planning Analytics and other systems.

Python workspace

Scripts and notebooks ​

Use Python scripts for reusable programs and automation, including scripts that can be executed through Jobs.

Use Jupyter for interactive analysis and development, where you can run code incrementally, inspect results, and combine code with explanatory content.

The Python workspace includes a file browser and launcher for working with scripts, notebooks, folders, consoles, and other files.

SPACE Python SDK ​

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

It can be used to access SPACE-managed resources without embedding SPACE API calls or authentication details directly in your code. Authentication to SPACE is provided automatically to Python executions through the SPACE environment.

This provides a foundation for Python workflows that need to work with centrally managed configuration while remaining portable between SPACE environments.

Secrets and connections ​

SPACE administrators can securely store credentials and other sensitive values as secrets and configure reusable connections for external systems.

Python code can access these through the SPACE Python SDK. This avoids storing passwords, API keys, or other credentials directly in notebooks, scripts, Git repositories, or configuration files.

For example, a script can retrieve:

  • a named secret containing credentials or API keys;
  • the configuration for a SPACE connection;
  • connection authentication information needed by a Python client library.

Use from space import secrets, connections to access these resources. See Secrets and connections for the SDK methods and usage patterns.

IBM Planning Analytics and TM1py ​

TM1py can be used in SPACE scripts and notebooks to work programmatically with IBM Planning Analytics.

Combined with SPACE-managed connections and secrets, TM1py code can obtain the required connection configuration and credentials at runtime instead of maintaining them separately in Python files.

This is useful for custom Planning Analytics analysis, administration, development, and automation that goes beyond the built-in SPACE tools.

Custom packages ​

Additional Python libraries can be made available in the SPACE Python environment when a workflow requires packages that are not included by default.

See Custom packages for installation and package-management options.

Git ​

SPACE includes Git support for Python development so client scripts, notebooks, and related files can be maintained in a Git repository using the JupyterLab Git extension.

Python Git is separate from the Planning Analytics Git integration, which is designed for Planning Analytics model assets.

See Git for repository setup and configuration.

Examples ​

Python examples brings the individual capabilities together in practical workflows.

Examples include using the SPACE Python SDK, retrieving secrets and connection configuration, connecting to Planning Analytics with TM1py, and combining these capabilities in reusable scripts and notebooks.

The individual feature pages also include focused code snippets where they are most useful, while the Examples page is intended for more complete end-to-end workflows.