Skip to main content

Spotfire Community tools for working with the Spotfire Library API and DXP files.

Project description

Spotfire Community

Spotfire Community is a Python package for working with the Spotfire Library REST API (v2) and DXP files.

It also includes an Automation Services client for starting and monitoring jobs.

Installation

Install from PyPI (recommended):

Using pip:

pip install spotfire-community

Using uv:

uv add spotfire-community

Python 3.10+ is required (see pyproject.toml).

Usage

Library Client

Upload, create, and delete items in the Spotfire Library:

from spotfire_community import LibraryClient
from spotfire_community.library.models import ItemType

client = LibraryClient(
	spotfire_url="https://your-spotfire-host",  # e.g., https://dev.spotfire.com
	client_id="YOUR_CLIENT_ID",
	client_secret="YOUR_CLIENT_SECRET",
)

file_id = client.upload_file(
	data=b"...bytes...",            # upload raw content
	path="/Samples/Doc1",           # library path
	item_type=ItemType.DXP,
	description="Uploaded via LibraryClient",
	overwrite=False,
)
print("uploaded:", file_id)

Automation Services Client

Start and monitor Automation Services jobs:

from spotfire_community.automation_services import (
	AutomationServicesClient,
	JobDefinition,
	OpenAnalysisTask,
)

client = AutomationServicesClient(
	spotfire_url="https://your-spotfire-host",
	client_id="YOUR_CLIENT_ID",
	client_secret="YOUR_CLIENT_SECRET",
)

# Build a minimal job definition
job_def = JobDefinition()
job_def.add_task(OpenAnalysisTask(path="/Samples/Analysis.dxp"))

# Start and wait for completion
status = client.start_job_definition_and_wait(job_def, poll_interval=1, timeout=120)
print("status:", status)

DXP Utilities

Inspect and repackage DXP files:

from spotfire_community import Dxp


print(dxp.get_all_files())
zip_bytes = dxp.get_zip_folder_in_memory()  # BytesIO

Development

For development and testing (requires uv):

uv sync --dev

Mock APIs and Tests

The repo includes a FastAPI mock server for deterministic tests (not included in the PyPI package):

  • Router and handlers: src/mock_spotfire/library_v2/routes/
  • Models: src/mock_spotfire/library_v2/models.py
  • Errors: src/mock_spotfire/library_v2/errors.py
  • In-memory state: src/mock_spotfire/library_v2/state.py

Automation Services (v1) mock:

  • Router and handlers: src/mock_spotfire/automation_services_v1/routes/
  • Models: src/mock_spotfire/automation_services_v1/models.py
  • Errors: src/mock_spotfire/automation_services_v1/errors.py
  • In-memory state: src/mock_spotfire/automation_services_v1/state.py

Endpoints:

  • Core: POST /spotfire/oauth2/token
  • Library v2: GET/POST /spotfire/api/rest/library/v2/items
  • Library v2: DELETE /spotfire/api/rest/library/v2/items/{id}
  • Library v2: POST /spotfire/api/rest/library/v2/upload
  • Library v2: POST /spotfire/api/rest/library/v2/upload/{jobId}
  • Automation Services v1: GET /spotfire/api/rest/as/job/status/{job_id}
  • Automation Services v1: POST /spotfire/api/rest/as/job/abort/{job_id}
  • Automation Services v1: POST /spotfire/api/rest/as/job/start-content
  • Automation Services v1: POST /spotfire/api/rest/as/job/start-library

Tests use fastapi.testclient.TestClient and monkeypatch requests.Session so the client talks to the mock app in‑memory. See tests/library/upload/*.py.

Run tests:

uv run -m pytest -q

Dev Container (VS Code)

This repo ships a devcontainer for a consistent environment (Debian 12 + Python 3.13 + uv).

What you get:

  • Python 3.13 base image
  • uv installed by post-create script
  • .venv virtual environment managed by uv
  • Extensions: Python, TOML

Open it:

  1. Install “Dev Containers” in VS Code.
  2. Open the repo folder and choose “Reopen in Container”.
  3. Wait for the post-create to finish; then run:
uv sync --dev
uvx pyright
uvx ruff format --check .
uv run -m pytest -q

Notes:

  • The container uses the vscode user and exposes WORKSPACE_PATH.
  • After changing dependencies, run uv sync again.
  • If uv is not found, ensure it’s on PATH or re-run the post-create.

CI

GitHub Actions runs lint, type‑check, and tests. See .github/workflows/ci.yaml.

License

Open source. See LICENSE.

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

spotfire_community-0.5.0.tar.gz (38.9 kB view details)

Uploaded Source

Built Distributions

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

spotfire_community-0.5.0-cp313-cp313-win_amd64.whl (184.3 kB view details)

Uploaded CPython 3.13Windows x86-64

spotfire_community-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl (322.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

spotfire_community-0.5.0-cp313-cp313-manylinux_2_28_aarch64.whl (315.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

spotfire_community-0.5.0-cp313-cp313-macosx_11_0_arm64.whl (288.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

spotfire_community-0.5.0-cp313-cp313-macosx_10_12_x86_64.whl (293.2 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

File details

Details for the file spotfire_community-0.5.0.tar.gz.

File metadata

  • Download URL: spotfire_community-0.5.0.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for spotfire_community-0.5.0.tar.gz
Algorithm Hash digest
SHA256 fa9372c4a4681e0d5a2855433f925569968f8cb4ea054373fe62a4a82f96c55b
MD5 affd38c16bb25539e4817303028c2d40
BLAKE2b-256 477fe8d06a2b79117ded5e8b2e0e74fc35bb97ab24233a86bd3e12ae7c1e4506

See more details on using hashes here.

File details

Details for the file spotfire_community-0.5.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for spotfire_community-0.5.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2d0df5ba4595f7a0c069bcefde721e7508e204f6d81deb68aad5aa181b40eb90
MD5 27cd4dbf9fd268f60e774b5422e5d151
BLAKE2b-256 0c0aa5decdc0f78dccbb3e2b5ef4b03cc50c94c6c2c2dec1d8ad643a8c9925e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for spotfire_community-0.5.0-cp313-cp313-win_amd64.whl:

Publisher: publish.yaml on scrankin/spotfire-community

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

File details

Details for the file spotfire_community-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for spotfire_community-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 959d8281a30e8534cbecb08a8031c4b6ba4c8125318cb7265a7e7fe6acc72e0e
MD5 fa4c276ade431a11c88ddec45daba062
BLAKE2b-256 28c62aaddf2e049bcc44ba1d9138bfe2c5b6aefb39ab3b998dddeda375bb821f

See more details on using hashes here.

Provenance

The following attestation bundles were made for spotfire_community-0.5.0-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: publish.yaml on scrankin/spotfire-community

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

File details

Details for the file spotfire_community-0.5.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for spotfire_community-0.5.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 66f3d7f96944232e3e5b6ddb703168342329073bd29fe601235f07635fedcdf1
MD5 e767535967d959ac9082ca82b4b78ca5
BLAKE2b-256 2c83f0eedc8031b38b48eddc9948555b82b101b35148703bdba43cc4b3ed74a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for spotfire_community-0.5.0-cp313-cp313-manylinux_2_28_aarch64.whl:

Publisher: publish.yaml on scrankin/spotfire-community

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

File details

Details for the file spotfire_community-0.5.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spotfire_community-0.5.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4878ac2c9e8985e304e084d80be07afc1e8925dac65114b27503ab728ce7edb1
MD5 17445f96db82401cf6f5d8bc3d360b36
BLAKE2b-256 4e2bb74f673fed2d58b5ba8741debbe4b242c1e4911da5e6bedf41713d5ae7ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for spotfire_community-0.5.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yaml on scrankin/spotfire-community

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

File details

Details for the file spotfire_community-0.5.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for spotfire_community-0.5.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0341bba1c2c765fd909f1505e3d056f88008ced50d1a37359b630186077b7929
MD5 88b68c6ab7cc99217b43275d4df13b82
BLAKE2b-256 b18981be81a5be40430ba2f52d4b336676d1d4f9607922cb1813b036f2f82168

See more details on using hashes here.

Provenance

The following attestation bundles were made for spotfire_community-0.5.0-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: publish.yaml on scrankin/spotfire-community

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