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
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
55 changes: 55 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Local development

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

Then install the dependencies

```console
uv sync --all-packages
```

## Generating protobuf

To generate Python protobuf definitions run

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

## Testing

You can test the SDK by running

```console
uv run ci_test
```

In local development you can use

```console
uv run local_test
```

## Format & Lint

You can format code by running

```console
uv run format
```

You can check linter by running

```console
uv run lint
```

## Documentation

Documentation is generated via openapi-python-client.

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 `uv run update_client <copied-url>`
60 changes: 2 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The SDK exports two main classes for interacting with Fishjam server:

`FishjamClient` wraps http REST api calls, while `FishjamNotifier` is responsible for receiving real-time updates from the server.

#### FishjamClient
### FishjamClient

Create a `FishjamClient` instance, providing the fishjam server address and api token

Expand All @@ -46,7 +46,7 @@ peer, token = fishjam_client.create_peer(room.id)

All methods in `FishjamClient` may raise one of the exceptions deriving from `fishjam.errors.HTTPError`. They are defined in `fishjam.errors`.

#### FishjamNotifier
### FishjamNotifier

FishjamNotifier allows for receiving real-time updates from the Fishjam Server.

Expand Down Expand Up @@ -89,62 +89,6 @@ asyncio.run(test_notifier())
# Received a notification: ServerMessageRoomCreated(room_id='69a3fd1a-6a4d-47bc-ae54-0c72b0d05e29')
```

## Local development

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

Then install the dependencies

```console
poetry install
```

## Generating protobuf

To generate Python protobuf definitions run

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

## Testing

You can test the SDK by running

```console
poetry run ci_test
```

In local development you can use

```console
poetry run local_test
```

## Format & Lint

You can format code by running

```console
poetry run format
```

You can check linter by running

```console
poetry run lint
```

## Documentation

Documentation is generated via openapi-python-client.

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>`

## License

Licensed under the [Apache License, Version 2.0](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
Loading