Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 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
79 changes: 46 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,56 @@ name: CI
on: [push]

jobs:
lint:

static-checks:
runs-on: ubuntu-latest
name: lint
strategy: &python-matrix
matrix:
python-version:
- "3.11"
- "3.12"
- "3.13"
name: static-checks
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install poetry
run: pip install poetry
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
enable-cache: true

- name: Install project dependencies
run: poetry install --no-ansi --with=dev
run: uv sync --locked --all-extras --dev --all-packages

- name: Format
run: uv run format_check

- name: Lint
run: poetry run lint
- name: Check format
run: poetry run format_check
- name: Type checker
run: poetry run pyright

run: uv run lint

- name: Type check
run: uv run pyright

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
name: test
steps:
- uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.PACKAGE_ACCESS_TOKEN }}" | docker login ghcr.io -u USERNAME --password-stdin

- name: Run tests
run: docker compose -f docker-compose-test.yaml up test --exit-code-from test

- name: Tear down test containers
run: docker compose -f docker-compose-test.yaml down
runs-on: ubuntu-latest
strategy: *python-matrix
env:
PYTHON_VERSION: ${{ matrix.python-version }}
name: test
steps:
- uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.PACKAGE_ACCESS_TOKEN }}" | docker login ghcr.io -u USERNAME --password-stdin

- name: Run tests
run: docker compose -f docker-compose-test.yaml up test --exit-code-from test

- name: Tear down test containers
run: docker compose -f docker-compose-test.yaml down
30 changes: 18 additions & 12 deletions .github/workflows/main_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,39 @@ on:
workflow_dispatch:
inputs:
code_branch_tag:
description: 'The branch or tag to run the workflow from'
description: "The branch or tag to run the workflow from"
required: true
default: 'main'
default: "main"

jobs:
# Build the documentation and upload the static HTML files as an artifact.
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- uses: actions/setup-python@v4

- uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
- uses: abatilo/actions-poetry@v2
- run: poetry install
- run: poetry run generate_docs
python-version-file: "pyproject.toml"
enable-cache: true

- run: uv sync --locked
- run: uv run generate_docs
- run: git fetch origin gh-pages --depth=1
- run: git config user.name ci-bot
- run: git config user.email [email protected]
- run: poetry run mike deploy latest
- run: uv run mike deploy latest
- run: git checkout gh-pages

# Push changes to gh-pages branch
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
21 changes: 15 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@ on:
tags:
- "v*.*.*"
jobs:
build:
publish:
runs-on: ubuntu-latest
name: Publish to PyPI
steps:
- uses: actions/checkout@v3
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
- name: Checkout code
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Build package
run: uv build

- name: Publish package
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: uv publish
28 changes: 17 additions & 11 deletions .github/workflows/tag_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,29 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"

- uses: astral-sh/setup-uv@v6
with:
python-version: '3.9'
- uses: abatilo/actions-poetry@v2
- run: poetry install
- run: poetry run generate_docs
python-version-file: "pyproject.toml"
enable-cache: true

- run: uv sync --locked
- run: uv run generate_docs
- run: git fetch origin gh-pages --depth=1
- run: git config user.name ci-bot
- run: git config user.email [email protected]
- run: poetry run mike deploy ${{github.ref_name}}
- run: poetry run mike set-default ${{github.ref_name}}
- run: uv run mike deploy ${{ github.ref_name }}
- run: uv run mike set-default ${{ github.ref_name }}
- run: git checkout gh-pages

# Push changes to gh-pages branch
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
python 3.13.5
poetry 2.1.3
uv 0.8.12
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,48 +91,48 @@ asyncio.run(test_notifier())

## Local development

The project is managed using [poetry](https://python-poetry.org/). Make sure to have it installed first.
The project is managed using [uv](https://docs.astral.sh/uv/). Make sure to have it installed first.

Then install the dependencies

```console
poetry install
uv sync --all-packages
```

## Generating protobuf

To generate Python protobuf definitions run

```console
poetry run ./compile_proto.sh
uv run ./compile_proto.sh
```

## Testing

You can test the SDK by running

```console
poetry run ci_test
uv run ci_test
```

In local development you can use

```console
poetry run local_test
uv run local_test
```

## Format & Lint

You can format code by running

```console
poetry run format
uv run format
```

You can check linter by running

```console
poetry run lint
uv run lint
```

## Documentation
Expand All @@ -143,7 +143,7 @@ To update documentation you need to:

- Go to https://github.com/fishjam-cloud/fishjam/blob/main/openapi.yaml and open the raw file.
- Copy the URL.
- Run `poetry run update_client <copied-url>`
- Run `uv run update_client <copied-url>`

## License

Expand Down
7 changes: 4 additions & 3 deletions compile_proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ git submodule sync --recursive >>/dev/null
git submodule update --recursive --remote --init >>/dev/null
printf "DONE\n\n"

server_file="./protos/fishjam/server_notifications.proto"
printf "Compiling: file $server_file\n"
protoc -I . --python_betterproto_out=./fishjam/events/_protos $server_file
FILES=("protos/fishjam/agent_notifications.proto" "protos/fishjam/server_notifications.proto")

printf "Compiling file: %s\n" "${FILES[@]}"
protoc -I protos --python_betterproto_out="./fishjam/events/_protos" "${FILES[@]}"
printf "\tDONE\n"
8 changes: 4 additions & 4 deletions docker-compose-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ services:
FJ_SIP_IP: "127.0.0.1"
FJ_COMPONENTS_USED: "rtsp file hls recording sip"
FJ_BROADCASTING_ENABLED: "true"
FJ_BROADCASTER_URL: "http://broadcaster:4000"
FJ_BROADCASTER_TOKEN: "broadcaster_token"
FJ_BROADCASTER_URL: "http://broadcaster:4000"
FJ_BROADCASTER_TOKEN: "broadcaster_token"
FJ_BROADCASTER_WHIP_TOKEN: "whip_token"
ports:
- "5002:5002"
Expand All @@ -42,8 +42,8 @@ services:
context: .
dockerfile: tests/Dockerfile
args:
PYTHON_VERSION: ${PYTHON_VERSION:-3.10}
command: poetry run pytest
PYTHON_VERSION: ${PYTHON_VERSION:-3.11}
command: uv run pytest
environment:
DOCKER_TEST: "TRUE"
depends_on:
Expand Down
5 changes: 3 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Fishjam Room Manager

## Running (in dev mode)

All available options are defined in [arguments.py](room_manager/arguments.py).

```console
poetry install
poetry run room_manager # Room Manager has to be started in the project root directory
uv sync --all-packages
uv run room_manager # Room Manager has to be started in the project root directory
```

## How does it work?
Expand Down
1 change: 1 addition & 0 deletions examples/transcription/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
36 changes: 36 additions & 0 deletions examples/transcription/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Transcription demo

This directory contains a demo app, which uses [Fishjam](https://fishjam.io) and [Gemini Live API](https://ai.google.dev/gemini-api/docs/live)
for real-time transcription of ongoing calls.

The application contains an HTTP server written in [FastAPI](https://fastapi.tiangolo.com/)
and uses [uv](https://docs.astral.sh/uv/) for dependency management.

## Running

Make sure to [install uv](https://docs.astral.sh/uv/getting-started/installation/) if you don't have it already.

Once you have `uv` installed, fetch the dependencies with

```bash
uv sync --all-packages
```

To run the app, you will need 3 environment variables:

- `FISHJAM_ID`: Your Fishjam ID, which you can get on the [Fishjam website](https://fishjam.io/app)
- `FISHJAM_MANAGEMENT_TOKEN`: Your Fishjam managemen token, which you can get on the [Fishjam website](https://fishjam.io/app)
- `GEMINI_API_KEY`: An API key for the Gemini API. You can generate one on the [Gemini website](https://aistudio.google.com/app/apikey).

Once you have these variables, you can run the demo with

```bash
FISHJAM_ID=<your-fishjam-id> \
FISHJAM_MANAGEMENT_TOKEN=<your-management-token> \
GEMINI_API_KEY=<your-api-token> \
uv run fastapi dev
```

Now, you can create peer tokens by going to <http://localhost:3000>.
You can then use the [minimal-react](https://github.com/fishjam-cloud/web-client-sdk/tree/main/examples/react-client)
demo app to connect as these peers and see your transcriptions live in the console!
Loading