Skip to content

Commit 734d7c3

Browse files
Add agents to room api and add Agent class (#36)
* Add agents to room api and add Agent class * Fix imports * Organize imports * Don't use python 3.12 features * Imports * Update old tests * Export PeerType * Migrate to uv * Update GH Actions * Update openapi * Openapi changes * Add transcription example * Update openapi client * Update README * Remove redundant files * Review changes * Fix typo * Update readme * Update protos
1 parent 7d445a8 commit 734d7c3

File tree

92 files changed

+3780
-3094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+3780
-3094
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,56 @@ name: CI
33
on: [push]
44

55
jobs:
6-
lint:
7-
6+
static-checks:
87
runs-on: ubuntu-latest
9-
name: lint
8+
strategy: &python-matrix
9+
matrix:
10+
python-version:
11+
- "3.11"
12+
- "3.12"
13+
- "3.13"
14+
name: static-checks
1015
steps:
11-
- uses: actions/checkout@v4
12-
- name: Set up Python 3.10
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
1320
uses: actions/setup-python@v5
1421
with:
15-
python-version: '3.10'
16-
- name: Install poetry
17-
run: pip install poetry
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v6
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
enable-cache: true
29+
1830
- name: Install project dependencies
19-
run: poetry install --no-ansi --with=dev
31+
run: uv sync --locked --all-extras --dev --all-packages
32+
33+
- name: Format
34+
run: uv run format_check
35+
2036
- name: Lint
21-
run: poetry run lint
22-
- name: Check format
23-
run: poetry run format_check
24-
- name: Type checker
25-
run: poetry run pyright
26-
37+
run: uv run lint
38+
39+
- name: Type check
40+
run: uv run pyright
41+
2742
test:
28-
runs-on: ubuntu-latest
29-
strategy:
30-
matrix:
31-
python-version: ["3.10", "3.11", "3.12"]
32-
env:
33-
PYTHON_VERSION: ${{ matrix.python-version }}
34-
name: test
35-
steps:
36-
- uses: actions/checkout@v4
37-
38-
- name: Log in to GitHub Container Registry
39-
run: echo "${{ secrets.PACKAGE_ACCESS_TOKEN }}" | docker login ghcr.io -u USERNAME --password-stdin
40-
41-
- name: Run tests
42-
run: docker compose -f docker-compose-test.yaml up test --exit-code-from test
43-
44-
- name: Tear down test containers
45-
run: docker compose -f docker-compose-test.yaml down
43+
runs-on: ubuntu-latest
44+
strategy: *python-matrix
45+
env:
46+
PYTHON_VERSION: ${{ matrix.python-version }}
47+
name: test
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Log in to GitHub Container Registry
52+
run: echo "${{ secrets.PACKAGE_ACCESS_TOKEN }}" | docker login ghcr.io -u USERNAME --password-stdin
53+
54+
- name: Run tests
55+
run: docker compose -f docker-compose-test.yaml up test --exit-code-from test
56+
57+
- name: Tear down test containers
58+
run: docker compose -f docker-compose-test.yaml down

.github/workflows/main_docs.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,39 @@ on:
88
workflow_dispatch:
99
inputs:
1010
code_branch_tag:
11-
description: 'The branch or tag to run the workflow from'
11+
description: "The branch or tag to run the workflow from"
1212
required: true
13-
default: 'main'
13+
default: "main"
1414

1515
jobs:
1616
# Build the documentation and upload the static HTML files as an artifact.
1717
build:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121
with:
2222
ref: ${{ github.event.inputs.ref }}
23-
- uses: actions/setup-python@v4
23+
24+
- uses: actions/setup-python@v5
25+
with:
26+
python-version-file: "pyproject.toml"
27+
28+
- uses: astral-sh/setup-uv@v6
2429
with:
25-
python-version: '3.12'
26-
- uses: abatilo/actions-poetry@v2
27-
- run: poetry install
28-
- run: poetry run generate_docs
30+
python-version-file: "pyproject.toml"
31+
enable-cache: true
32+
33+
- run: uv sync --locked
34+
- run: uv run generate_docs
2935
- run: git fetch origin gh-pages --depth=1
3036
- run: git config user.name ci-bot
3137
- run: git config user.email [email protected]
32-
- run: poetry run mike deploy latest
38+
- run: uv run mike deploy latest
3339
- run: git checkout gh-pages
34-
40+
3541
# Push changes to gh-pages branch
3642
- name: Push changes
3743
uses: ad-m/github-push-action@master
3844
with:
39-
github_token: ${{ secrets.GITHUB_TOKEN }}
40-
branch: gh-pages
45+
github_token: ${{ secrets.GITHUB_TOKEN }}
46+
branch: gh-pages

.github/workflows/publish.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,20 @@ on:
55
tags:
66
- "v*.*.*"
77
jobs:
8-
build:
8+
publish:
99
runs-on: ubuntu-latest
10+
name: Publish to PyPI
1011
steps:
11-
- uses: actions/checkout@v3
12-
- name: Build and publish to pypi
13-
uses: JRubics/[email protected]
14-
with:
15-
pypi_token: ${{ secrets.PYPI_TOKEN }}
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Install uv
16+
uses: astral-sh/setup-uv@v6
17+
18+
- name: Build package
19+
run: uv build
20+
21+
- name: Publish package
22+
env:
23+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
24+
run: uv publish

.github/workflows/tag_docs.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,29 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
14-
- uses: actions/setup-python@v4
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version-file: "pyproject.toml"
18+
19+
- uses: astral-sh/setup-uv@v6
1520
with:
16-
python-version: '3.9'
17-
- uses: abatilo/actions-poetry@v2
18-
- run: poetry install
19-
- run: poetry run generate_docs
21+
python-version-file: "pyproject.toml"
22+
enable-cache: true
23+
24+
- run: uv sync --locked
25+
- run: uv run generate_docs
2026
- run: git fetch origin gh-pages --depth=1
2127
- run: git config user.name ci-bot
2228
- run: git config user.email [email protected]
23-
- run: poetry run mike deploy ${{github.ref_name}}
24-
- run: poetry run mike set-default ${{github.ref_name}}
29+
- run: uv run mike deploy ${{ github.ref_name }}
30+
- run: uv run mike set-default ${{ github.ref_name }}
2531
- run: git checkout gh-pages
26-
32+
2733
# Push changes to gh-pages branch
2834
- name: Push changes
2935
uses: ad-m/github-push-action@master
3036
with:
31-
github_token: ${{ secrets.GITHUB_TOKEN }}
32-
branch: gh-pages
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
branch: gh-pages

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
python 3.13.5
2-
poetry 2.1.3
2+
uv 0.8.12

DEVELOPMENT.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Local development
2+
3+
The project is managed using [uv](https://docs.astral.sh/uv/). Make sure to have it installed first.
4+
5+
Then install the dependencies
6+
7+
```console
8+
uv sync --all-packages
9+
```
10+
11+
## Generating protobuf
12+
13+
To generate Python protobuf definitions run
14+
15+
```console
16+
uv run ./compile_proto.sh
17+
```
18+
19+
## Testing
20+
21+
You can test the SDK by running
22+
23+
```console
24+
uv run ci_test
25+
```
26+
27+
In local development you can use
28+
29+
```console
30+
uv run local_test
31+
```
32+
33+
## Format & Lint
34+
35+
You can format code by running
36+
37+
```console
38+
uv run format
39+
```
40+
41+
You can check linter by running
42+
43+
```console
44+
uv run lint
45+
```
46+
47+
## Documentation
48+
49+
Documentation is generated via openapi-python-client.
50+
51+
To update documentation you need to:
52+
53+
- Go to https://github.com/fishjam-cloud/fishjam/blob/main/openapi.yaml and open the raw file.
54+
- Copy the URL.
55+
- Run `uv run update_client <copied-url>`

README.md

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The SDK exports two main classes for interacting with Fishjam server:
1919

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

22-
#### FishjamClient
22+
### FishjamClient
2323

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

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

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

49-
#### FishjamNotifier
49+
### FishjamNotifier
5050

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

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

92-
## Local development
93-
94-
The project is managed using [poetry](https://python-poetry.org/). Make sure to have it installed first.
95-
96-
Then install the dependencies
97-
98-
```console
99-
poetry install
100-
```
101-
102-
## Generating protobuf
103-
104-
To generate Python protobuf definitions run
105-
106-
```console
107-
poetry run ./compile_proto.sh
108-
```
109-
110-
## Testing
111-
112-
You can test the SDK by running
113-
114-
```console
115-
poetry run ci_test
116-
```
117-
118-
In local development you can use
119-
120-
```console
121-
poetry run local_test
122-
```
123-
124-
## Format & Lint
125-
126-
You can format code by running
127-
128-
```console
129-
poetry run format
130-
```
131-
132-
You can check linter by running
133-
134-
```console
135-
poetry run lint
136-
```
137-
138-
## Documentation
139-
140-
Documentation is generated via openapi-python-client.
141-
142-
To update documentation you need to:
143-
144-
- Go to https://github.com/fishjam-cloud/fishjam/blob/main/openapi.yaml and open the raw file.
145-
- Copy the URL.
146-
- Run `poetry run update_client <copied-url>`
147-
14892
## License
14993

15094
Licensed under the [Apache License, Version 2.0](LICENSE)

compile_proto.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ git submodule sync --recursive >>/dev/null
88
git submodule update --recursive --remote --init >>/dev/null
99
printf "DONE\n\n"
1010

11-
server_file="./protos/fishjam/server_notifications.proto"
12-
printf "Compiling: file $server_file\n"
13-
protoc -I . --python_betterproto_out=./fishjam/events/_protos $server_file
11+
FILES=("protos/fishjam/agent_notifications.proto" "protos/fishjam/server_notifications.proto")
12+
13+
printf "Compiling file: %s\n" "${FILES[@]}"
14+
protoc -I protos --python_betterproto_out="./fishjam/events/_protos" "${FILES[@]}"
1415
printf "\tDONE\n"

docker-compose-test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ services:
1818
FJ_SIP_IP: "127.0.0.1"
1919
FJ_COMPONENTS_USED: "rtsp file hls recording sip"
2020
FJ_BROADCASTING_ENABLED: "true"
21-
FJ_BROADCASTER_URL: "http://broadcaster:4000"
22-
FJ_BROADCASTER_TOKEN: "broadcaster_token"
21+
FJ_BROADCASTER_URL: "http://broadcaster:4000"
22+
FJ_BROADCASTER_TOKEN: "broadcaster_token"
2323
FJ_BROADCASTER_WHIP_TOKEN: "whip_token"
2424
ports:
2525
- "5002:5002"
@@ -42,8 +42,8 @@ services:
4242
context: .
4343
dockerfile: tests/Dockerfile
4444
args:
45-
PYTHON_VERSION: ${PYTHON_VERSION:-3.10}
46-
command: poetry run pytest
45+
PYTHON_VERSION: ${PYTHON_VERSION:-3.11}
46+
command: uv run pytest
4747
environment:
4848
DOCKER_TEST: "TRUE"
4949
depends_on:

examples/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Fishjam Room Manager
22

33
## Running (in dev mode)
4+
45
All available options are defined in [arguments.py](room_manager/arguments.py).
56

67
```console
7-
poetry install
8-
poetry run room_manager # Room Manager has to be started in the project root directory
8+
uv sync --all-packages
9+
uv run room_manager # Room Manager has to be started in the project root directory
910
```
1011

1112
## How does it work?

0 commit comments

Comments
 (0)