Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 63 additions & 15 deletions packages/setuav-studio-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,77 @@
# Setuav Studio SDK

This package defines the Python contracts used by third-party Setuav Studio
plugins. The source and API reference are kept together for versioned releases.
The Setuav Studio SDK defines the public Python contracts used by third-party
plugins. It provides the plugin lifecycle, `StudioAPI`, contribution
descriptors, and provider callback types without exposing application
implementation details.

## Developer documentation

From this directory:
## Installation

```bash
doxygen Doxyfile
pip install setuav-studio-sdk
```

The SDK supports Python 3.11 and newer.

## Plugin lifecycle

A plugin exposes a stable reverse-domain ID, registers its contributions in
`activate`, and removes them in `deactivate`:

```python
from PySide6.QtWidgets import QLabel

from setuav_studio_sdk import PanelContribution, StudioAPI


class HelloPlugin:
id = "com.example.hello"
priority = 100

def activate(self, api: StudioAPI) -> None:
api.add_panel(
PanelContribution(
id="com.example.hello.panel",
title="Hello Plugin",
factory=lambda: QLabel("Hello from a Setuav Studio plugin"),
)
)

def deactivate(self, api: StudioAPI) -> None:
api.remove_panel("com.example.hello.panel")
```

Open `docs/html/index.html` in a browser.
Plugins are discovered through the `setuav_studio.plugins` Python entry-point
group. Contribution and entry-point IDs must be unique; use a reverse-domain
prefix owned by your project.

The generated reference documents only public SDK modules. Application
implementation modules are deliberately excluded.
Declare the plugin entry point in `pyproject.toml`:

```toml
[project.entry-points."setuav_studio.plugins"]
"com.example.hello" = "my_plugin.plugin:HelloPlugin"
```

## Example plugin
## API reference

The [`packages/example-plugin`](../example-plugin) project shows the
smallest installable plugin: it declares the SDK dependency, publishes an
entry point, and cleans up its workspace and panel during deactivation.
Read the [online SDK API reference](https://setuav.github.io/Studio/developer/sdk-api-reference/)
for the complete public contract documentation.

Run the SDK and example-plugin tests from the repository root:
The [example plugin](https://github.com/Setuav/Studio/tree/main/packages/example-plugin)
contains package metadata, an entry point, lifecycle implementation, and
tests that can be used as a starting point for a new plugin.

## Development

To regenerate the API reference or run the contract tests, clone the
[Setuav Studio repository](https://github.com/Setuav/Studio) and run these
commands from its root:

```bash
python scripts/sdk_contract_tests.py
cd packages/setuav-studio-sdk
doxygen Doxyfile
cd ../..
uv run --locked python scripts/sdk_contract_tests.py
```

The generated reference documents only public `setuav_studio_sdk` modules.