Metadata-Version: 2.4
Name: sasvi
Version: 0.1.0
Summary: Python SDK and CLI for SAS Visual Investigator: task-oriented services over the REST APIs.
Author: SAS Institute Inc.
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/sassoftware/SASVI
Project-URL: Documentation, https://sassoftware.github.io/SASVI/
Project-URL: Changelog, https://github.com/sassoftware/SASVI/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/sassoftware/SASVI/issues
Keywords: sas,visual-investigator,vi,sdk,rest-api,openapi,investigation,alerts
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: attrs<27,>=23.2
Requires-Dist: httpx2<3,>=2.16
Requires-Dist: pydantic<3,>=2.12
Provides-Extra: cli
Requires-Dist: typer<1,>=0.15.4; extra == "cli"
Requires-Dist: click<9,>=8.1; extra == "cli"
Requires-Dist: rich<16,>=13; extra == "cli"
Provides-Extra: dev
Requires-Dist: build==1.6.1; extra == "dev"
Requires-Dist: PyYAML<7,>=6.0.3; extra == "dev"
Requires-Dist: coverage==7.17.3; extra == "dev"
Requires-Dist: mypy==2.4.1; extra == "dev"
Requires-Dist: openapi-python-client==0.30.0; extra == "dev"
Requires-Dist: pre-commit==4.7.0; extra == "dev"
Requires-Dist: pydoc-markdown<5,>=4.8; extra == "dev"
Requires-Dist: docspec-python<3,>=2.2.2; extra == "dev"
Requires-Dist: pytest==9.2.0; extra == "dev"
Requires-Dist: pytest-timeout<3,>=2.3; extra == "dev"
Requires-Dist: pytest-benchmark<6,>=5; extra == "dev"
Requires-Dist: ruff==0.17.5; extra == "dev"
Requires-Dist: setuptools>=80; extra == "dev"
Requires-Dist: tomli<3,>=2; extra == "dev"
Requires-Dist: typer<1,>=0.15.4; extra == "dev"
Requires-Dist: click<9,>=8.1; extra == "dev"
Requires-Dist: rich<16,>=13; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Provides-Extra: perf
Requires-Dist: pytest-benchmark<6,>=5; extra == "perf"
Requires-Dist: tomli<3,>=2; extra == "perf"
Dynamic: license-file

# sasvi: an easy-to-use SDK for SAS Visual Investigator

## Overview

`sasvi` is a Python SDK for SAS Visual Investigator. It gives you task-oriented methods for the
common work of an investigation, plus raw wrappers over the REST API for everything else. Covered
today: documents and entities, alerts, search, workflows, attachments, workspaces, insight sheets,
reference lists, custom endpoints, indexing, and solution configuration.

The SAS Visual Investigator REST API is powerful but schema-driven. Callers assemble payload
shapes instead of calling a method named after the task. `sasvi` wraps the common tasks in named
methods and keeps the raw endpoint layer available for everything else.

> [!NOTE]
> **`sasvi` is in beta.** Releases are numbered `0.x`, and a minor release (`0.1` to `0.2`) may
> change or remove public API. Every such change is listed in [`CHANGELOG.md`](https://github.com/sassoftware/SASVI/blob/main/CHANGELOG.md).
> Patch releases only fix bugs, so pin with `sasvi~=0.1.0` to stay on one minor release.
> Please report what breaks or is missing through a
> [GitHub issue](https://github.com/sassoftware/SASVI/issues).

- [Overview](#overview)
  - [What you can do](#what-you-can-do)
  - [API layers](#api-layers)
  - [Architecture](#architecture)
  - [Prerequisites](#prerequisites)
  - [Compatibility](#compatibility)
- [Installation](#installation)
  - [Getting Started](#getting-started)
  - [Examples](#examples)
  - [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [License](#license)
- [Third-Party Dependencies](#third-party-dependencies)
- [Additional Resources](#additional-resources)

### What you can do

The main handwritten domains are:

- **`svi.documents`.** Read and update documents, attachments, child documents, workspaces, and
  insight sheets.
- **`svi.alerts`.** Work with alerts as first-class objects and combine alert APIs with Data
  Hub-backed document updates.
- **`svi.search`.** Search SAND with a more Pythonic query layer and use results as references in
  later operations.
- **`svi.workflows`.** Start processes, inspect tasks, claim or release work, complete actions, and
  work with bound workflow instances.
- **`svi.admin`.** Inspect and update entity metadata, reference lists, relationship types,
  workflows, queues, and other solution configuration, and move a whole solution between tenants
  with `svi.admin.config`.

### API layers

`SVIClient` exposes both the raw generated layer and the stable handwritten layer.

#### Raw generated layer

Use this for direct, service-shaped coverage of the published OpenAPI definitions:

- `svi.api.alerts`
- `svi.api.datahub`
- `svi.api.sand`
- `svi.api.workflows`
- `svi.api.files`
- `svi.api.folders`
- `svi.api.transport`

#### Handwritten capability layer

Use this for bound objects and task-shaped methods:

- `svi.admin`
- `svi.documents`
- `svi.alerts`
- `svi.search`
- `svi.workflows`

### Architecture

At a high level, `sasvi` has three layers:

- **Client foundation.** Auth, connection setup, retry-aware HTTP clients, and generated service
  clients.
- **Capability layer.** The handwritten public domains such as `documents`, `alerts`, `search`,
  `workflows`, and `admin`.
- **Runtime and model layer.** Bound handles, typed helpers, and normalization logic that make SAS
  Visual Investigator payloads behave consistently in Python.

```mermaid
flowchart TD
    app["Application code"] --> client["Client foundation<br/>SVIClient, auth providers, generated clients"]
    client --> domains["Capability layer<br/>documents, alerts, search, workflows, admin"]
    domains --> runtime["Runtime and model layer<br/>bound handles, typed helpers, payload normalization"]
    runtime --> generated["Generated API layer<br/>schema-driven clients and models"]
```

### Prerequisites

- Python 3.11, 3.12, 3.13, or 3.14.
- A SAS Viya environment with SAS Visual Investigator, and an account that can sign in to it.

### Compatibility

SAS Viya `Stable` releases ship monthly and `LTS` releases ship every 6 months. `sasvi` compatibility
is determined by the API versions of the endpoints it calls. For the SAS APIs themselves, see
[developer.sas.com](https://developer.sas.com).

To find the SAS Viya version you are on, run `%put &=SYSVIYAVERSION;` in a SAS session. See
[Find your SAS Viya version](https://github.com/sassoftware/SASVI/blob/main/website/docs/concepts/compatibility-and-viya-cadence.md#find-your-sas-viya-version).
To see what your installed `sasvi` was built against, run `sasvi version` or call
`sasvi.compatibility()`.

| sasvi package version | Viya Stable | Viya LTS | Notes |
| --- | --- | --- | --- |
| `0.1.0` | 2026.10 | None yet | Initial version, live-verified on Stable 2026.10, Python 3.11 to 3.14 |

Full matrix:
- [`website/docs/concepts/compatibility-and-viya-cadence.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/concepts/compatibility-and-viya-cadence.md)

## Installation

Install from PyPI:

```bash
pip install --upgrade pip
pip install sasvi
```

For the command-line interface too, install `sasvi[cli]`.

Supported Python versions for this release: 3.11, 3.12, 3.13, and 3.14.

To install the current `main` instead, pick the form that matches how you authenticate to GitHub.

HTTPS
```bash
pip install "git+https://github.com/sassoftware/SASVI.git"
```

SSH Keys
```bash
pip install "git+ssh://git@github.com/sassoftware/SASVI.git"
```

To check which one your git uses by default, run:
```bash
git remote -v
```
Output:
```bash
git@github.com:... → using SSH
https://github.com/... → using HTTPS
```

GitHub documents both:
- [Connecting to GitHub with SSH](https://docs.github.com/en/authentication/connecting-to-github-with-ssh)
- [Managing your personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)

Or install from a local copy of the repository:

```bash
python -m pip install .
```

<details>
  <summary><b style="font-size: 1.17em;">More about installation</b></summary>

  Pin a branch, tag, or commit when needed:
  ```bash
  python -m pip install "git+https://github.com/sassoftware/SASVI.git@main"
  ```

  Development install
  ```bash
  uv venv .venv
  uv pip install --python .venv/bin/python -e '.[dev]'
  ```

  For optional performance benchmarking:

  ```bash
  uv pip install --python .venv/bin/python -e '.[dev,perf]'
  ```

  Installing into the SAS Viya Python (`sas-pyconfig`)

  To make `sasvi` importable from PROC PYTHON, SAS Studio Python steps, and SAS
  Intelligent Decisioning, add it to the package list that SAS Configurator for
  Open Source installs. The build image has no `git`, so reference the
  **source archive URL** for a pinned commit rather than a `git+https://`
  requirement, and make the change durable in `site-config` rather than in the
  live ConfigMap.

  Full walkthrough:
  [`website/docs/Guides/sas-viya-python.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/Guides/sas-viya-python.md).
</details>

### Getting Started

Create a client:

```python
from sasvi import SVIClient
from sasvi.auth import AuthorizationCodeTokenProvider

svi = SVIClient(
    base_url="https://viya.example.com",
    auth=AuthorizationCodeTokenProvider(open_browser=True),
)

svi.verify_connection()
```

> The [authentication guide](https://github.com/sassoftware/SASVI/blob/main/website/docs/Guides/authentication.md) covers the other providers.

Use the handwritten capability layer for task-oriented workflows:

```python
# list alerts
alerts = svi.alerts.list(limit=5)

# take the first one
alert = alerts[0]

# read a property
alert.current_score

# add a comment
alert.comments.create(text="Test comment from sasvi.")
```

Use the raw generated layer when you want direct endpoint access:

```python
workflows = svi.api.workflows.get_workflows()
types = svi.api.sand.get_types(names_only=True)
```

### Examples

Notebook examples live in [`examples/`](https://github.com/sassoftware/SASVI/blob/main/examples/README.md):

- [`examples/documents_examples.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/documents_examples.ipynb)
- [`examples/insights_examples.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/insights_examples.ipynb)
- [`examples/workspaces_examples.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/workspaces_examples.ipynb)
- [`examples/alerts_examples.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/alerts_examples.ipynb)
- [`examples/admin_examples.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/admin_examples.ipynb)
- [`examples/bulk_examples.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/bulk_examples.ipynb)
- [`examples/custom_endpoints/custom_endpoints_cascading_data.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/custom_endpoints/custom_endpoints_cascading_data.ipynb)
- [`examples/custom_endpoints/custom_endpoints_entity_fields.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/custom_endpoints/custom_endpoints_entity_fields.ipynb)
- [`examples/search_examples.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/search_examples.ipynb)
- [`examples/workflows_examples.ipynb`](https://github.com/sassoftware/SASVI/blob/main/examples/workflows_examples.ipynb)

The companion docs page is [`website/docs/Guides/examples.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/Guides/examples.md).

### Troubleshooting

The [troubleshooting guide](https://github.com/sassoftware/SASVI/blob/main/website/docs/Guides/troubleshooting.md) maps each error to its cause and
fix. The [FAQ](https://github.com/sassoftware/SASVI/blob/main/website/docs/Guides/faq.md) covers the questions that come up most often.

## Contributing

Maintainers are accepting patches and contributions to this project.
Please read [CONTRIBUTING.md](https://github.com/sassoftware/SASVI/blob/main/CONTRIBUTING.md) for details about submitting contributions to this project.

To report a security issue, follow the [security policy](https://github.com/sassoftware/SASVI/blob/main/SECURITY.md). For help using the project,
see [SUPPORT.md](https://github.com/sassoftware/SASVI/blob/main/SUPPORT.md).

## License

This project is licensed under the [Apache 2.0 License](https://github.com/sassoftware/SASVI/blob/main/LICENSE).

## Third-Party Dependencies

This project requires the following dependencies.

| Dependency | License |
| ---------- | ------- |
| `attrs` | [MIT](https://github.com/python-attrs/attrs/blob/main/LICENSE) |
| `httpx2` | [BSD 3-Clause](https://github.com/pydantic/httpx2/blob/main/LICENSE.md) |
| `pydantic` | [MIT](https://github.com/pydantic/pydantic/blob/main/LICENSE) |

The optional command-line interface (`pip install "sasvi[cli]"`) adds the following dependencies.

| Dependency | License |
| ---------- | ------- |
| `typer` | [MIT](https://github.com/fastapi/typer/blob/master/LICENSE) |
| `click` | [BSD 3-Clause](https://github.com/pallets/click/blob/main/LICENSE.txt) |
| `rich` | [MIT](https://github.com/Textualize/rich/blob/master/LICENSE) |

## Additional Resources

The canonical long-form docs live in [`website/docs/`](https://github.com/sassoftware/SASVI/tree/main/website/docs) and are rendered by the
Docusaurus site in [`website/`](https://github.com/sassoftware/SASVI/blob/main/website/README.md).

Start here:

- [`website/docs/index.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/index.md)
- [`website/docs/before-you-start.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/before-you-start.md)
- [`website/docs/quickstart.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/quickstart.md)
- [`website/docs/Guides/index.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/Guides/index.md)
- [`website/docs/api/index.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/api/index.md)

Useful concept docs:

- [`website/docs/Guides/SVIClient-and-API-Layers.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/Guides/SVIClient-and-API-Layers.md)
- [`website/docs/concepts/runtime-architecture.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/concepts/runtime-architecture.md)
- [`website/docs/concepts/compatibility-and-viya-cadence.md`](https://github.com/sassoftware/SASVI/blob/main/website/docs/concepts/compatibility-and-viya-cadence.md)

- [`CHANGELOG.md`](https://github.com/sassoftware/SASVI/blob/main/CHANGELOG.md) for the changes in each release.
- [SAS Visual Investigator REST APIs](https://developer.sas.com) on developer.sas.com.
