Skip to content
Merged
Show file tree
Hide file tree
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
56 changes: 56 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish to PyPI
on:
push:
tags:
- '*'
jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Set up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.8.4

- name: Install dependencies
run: poetry install

- name: Build distribution
run: poetry build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tws-sdk
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish dists to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
3 changes: 3 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Install dependencies
run: poetry install

- name: Build distribution
run: poetry build

- name: Add Poetry Python binary to PATH
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH

Expand Down
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,64 @@

Python client for [TWS](https://www.tuneni.ai).

## Installation

```bash
pip install tws-sdk
```

## Usage

TBC
The library provides both synchronous and asynchronous clients for interacting with TWS.

The primary API is `run_workflow`, which executes a workflow configured via the TWS UI, waits for completion,
and returns the result.

### Synchronous Usage

```python
from tws import create_client

# Create a client instance
client = create_client(
public_key="your_public_key",
secret_key="your_secret_key",
api_url="your_api_url"
)

# Run a workflow and wait for completion
result = client.run_workflow(
workflow_definition_id="your_workflow_id",
workflow_args={
"param1": "value1",
"param2": "value2"
},
)
```

### Asynchronous Usage

The signatures are exactly the same for async usage, but the client is created using `create_async_client` and client
methods are awaited.

```python
from tws import create_async_client


async def main():
# Create an async client instance
client = await create_async_client(
public_key="your_public_key",
secret_key="your_secret_key",
api_url="your_api_url"
)

# Run a workflow and wait for completion
result = await client.run_workflow(
workflow_definition_id="your_workflow_id",
workflow_args={
"param1": "value1",
"param2": "value2"
},
)
```
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "tws"
name = "tws-sdk"
version = "0.1.0"
description = "TWS client for Python."
authors = ["Fireline Science <sean@firelinescience.com>"]
Expand All @@ -13,6 +13,9 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent"
]
packages = [
{include = "tws"}
]

[tool.poetry.dependencies]
python = "^3.9"
Expand Down
Loading