Name | spotfire-community JSON |
Version |
0.1.2
JSON |
| download |
home_page | None |
Summary | Spotfire Community tools for working with the Spotfire Library API and DXP files. |
upload_time | 2025-08-26 16:52:02 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
spotfire
dxp
rest
library
tibco
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Spotfire Community
Spotfire Community is a Python package for working with the Spotfire Library REST API (v2) and DXP files.
## Installation
Install from PyPI (recommended):
Using pip:
```sh
pip install spotfire-community
```
Using uv:
```sh
uv add spotfire-community
```
Python 3.10+ is required (see `pyproject.toml`).
## Usage
### Library Client
Upload, create, and delete items in the Spotfire Library:
```python
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)
```
### DXP Utilities
Inspect and repackage DXP files:
```python
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](https://github.com/astral-sh/uv)):
```sh
uv sync --dev
```
### Mock Library v2 API and Tests
The package includes a FastAPI mock server for deterministic tests (not included in the PyPI package):
- Router and handlers: `src/mock_spotfire/library_v2/paths.py`
- 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`
Endpoints:
- `POST /spotfire/oauth2/token`
- `GET/POST /spotfire/api/rest/library/v2/items`
- `DELETE /spotfire/api/rest/library/v2/items/{id}`
- `POST /spotfire/api/rest/library/v2/upload`
- `POST /spotfire/api/rest/library/v2/upload/{jobId}`
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:
```sh
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:
```sh
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`.
Raw data
{
"_id": null,
"home_page": null,
"name": "spotfire-community",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "spotfire, dxp, rest, library, tibco",
"author": null,
"author_email": "Clay Rankin <clay@wiserocksoftware.com>",
"download_url": "https://files.pythonhosted.org/packages/d5/ff/1d07cec720c6a7d0988ec6a5a2f47e772fb690d933c8301ad38a3aa220ec/spotfire_community-0.1.2.tar.gz",
"platform": null,
"description": "# Spotfire Community\n\nSpotfire Community is a Python package for working with the Spotfire Library REST API (v2) and DXP files.\n\n## Installation\n\nInstall from PyPI (recommended):\n\nUsing pip:\n\n```sh\npip install spotfire-community\n```\n\nUsing uv:\n\n```sh\nuv add spotfire-community\n```\n\nPython 3.10+ is required (see `pyproject.toml`).\n\n## Usage\n\n### Library Client\n\nUpload, create, and delete items in the Spotfire Library:\n\n```python\nfrom spotfire_community import LibraryClient\nfrom spotfire_community.library.models import ItemType\n\nclient = LibraryClient(\n\tspotfire_url=\"https://your-spotfire-host\", # e.g., https://dev.spotfire.com\n\tclient_id=\"YOUR_CLIENT_ID\",\n\tclient_secret=\"YOUR_CLIENT_SECRET\",\n)\n\nfile_id = client.upload_file(\n\tdata=b\"...bytes...\", # upload raw content\n\tpath=\"/Samples/Doc1\", # library path\n\titem_type=ItemType.DXP,\n\tdescription=\"Uploaded via LibraryClient\",\n\toverwrite=False,\n)\nprint(\"uploaded:\", file_id)\n```\n\n### DXP Utilities\n\nInspect and repackage DXP files:\n\n```python\nfrom spotfire_community import Dxp\n\n\nprint(dxp.get_all_files())\nzip_bytes = dxp.get_zip_folder_in_memory() # BytesIO\n```\n\n---\n\n## Development\n\nFor development and testing (requires [uv](https://github.com/astral-sh/uv)):\n\n```sh\nuv sync --dev\n```\n\n### Mock Library v2 API and Tests\n\nThe package includes a FastAPI mock server for deterministic tests (not included in the PyPI package):\n- Router and handlers: `src/mock_spotfire/library_v2/paths.py`\n- Models: `src/mock_spotfire/library_v2/models.py`\n- Errors: `src/mock_spotfire/library_v2/errors.py`\n- In-memory state: `src/mock_spotfire/library_v2/state.py`\n\nEndpoints:\n- `POST /spotfire/oauth2/token`\n- `GET/POST /spotfire/api/rest/library/v2/items`\n- `DELETE /spotfire/api/rest/library/v2/items/{id}`\n- `POST /spotfire/api/rest/library/v2/upload`\n- `POST /spotfire/api/rest/library/v2/upload/{jobId}`\n\nTests use `fastapi.testclient.TestClient` and monkeypatch `requests.Session` so the client talks to the mock app in\u2011memory. See `tests/library/upload/*.py`.\n\nRun tests:\n\n```sh\nuv run -m pytest -q\n```\n\n### Dev Container (VS Code)\n\nThis repo ships a devcontainer for a consistent environment (Debian 12 + Python 3.13 + uv).\n\nWhat you get:\n- Python 3.13 base image\n- uv installed by post-create script\n- `.venv` virtual environment managed by uv\n- Extensions: Python, TOML\n\nOpen it:\n1. Install \u201cDev Containers\u201d in VS Code.\n2. Open the repo folder and choose \u201cReopen in Container\u201d.\n3. Wait for the post-create to finish; then run:\n\n```sh\nuv sync --dev\nuvx pyright\nuvx ruff format --check .\nuv run -m pytest -q\n```\n\nNotes:\n- The container uses the `vscode` user and exposes `WORKSPACE_PATH`.\n- After changing dependencies, run `uv sync` again.\n- If `uv` is not found, ensure it\u2019s on PATH or re-run the post-create.\n\n### CI\n\nGitHub Actions runs lint, type\u2011check, and tests. See `.github/workflows/ci.yaml`.\n\n## License\n\nOpen source. See `LICENSE`.\n",
"bugtrack_url": null,
"license": null,
"summary": "Spotfire Community tools for working with the Spotfire Library API and DXP files.",
"version": "0.1.2",
"project_urls": {
"Repository": "https://github.com/scrankin/spotfire-community"
},
"split_keywords": [
"spotfire",
" dxp",
" rest",
" library",
" tibco"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "0ae979ffd7c2c1eb32e8ae7ae08642b2d6adc26a6bccad6c6ec1aa8a2dadaedf",
"md5": "d3835aef7ff5efa19eaacc74dfd11d0f",
"sha256": "847bb5015071d22078ba9488e8a07486b03d270b7dad9166f97d87d08d6096f2"
},
"downloads": -1,
"filename": "spotfire_community-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d3835aef7ff5efa19eaacc74dfd11d0f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 18678,
"upload_time": "2025-08-26T16:52:01",
"upload_time_iso_8601": "2025-08-26T16:52:01.052255Z",
"url": "https://files.pythonhosted.org/packages/0a/e9/79ffd7c2c1eb32e8ae7ae08642b2d6adc26a6bccad6c6ec1aa8a2dadaedf/spotfire_community-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d5ff1d07cec720c6a7d0988ec6a5a2f47e772fb690d933c8301ad38a3aa220ec",
"md5": "8676fe649a93c020fbdc67f5c744a69a",
"sha256": "e9f47d2b89443126624cbbe8a4f8bce1a63e08a43e660d4dd7181008dd7495c9"
},
"downloads": -1,
"filename": "spotfire_community-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "8676fe649a93c020fbdc67f5c744a69a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 15005,
"upload_time": "2025-08-26T16:52:02",
"upload_time_iso_8601": "2025-08-26T16:52:02.217825Z",
"url": "https://files.pythonhosted.org/packages/d5/ff/1d07cec720c6a7d0988ec6a5a2f47e772fb690d933c8301ad38a3aa220ec/spotfire_community-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-26 16:52:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "scrankin",
"github_project": "spotfire-community",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "spotfire-community"
}