Skip to content

Commit 7c7a5e0

Browse files
authored
RTC 386 (#15)
* Add handle_json * Added usage of webhook_notifier in test_notifier * Update poetry.lock * Move linter to test_commands * Add type_hint in handle_json * Add step for checking formatting to CI * Fix lint issues * Changes after code review * Fix issues with betterproto * Return to static IP in docker-compose * Run formatter (#16) * Remove static IP from docker-compose * Fix tests * Improve poetry commands * Fix lint and formatter issues
1 parent 318c310 commit 7c7a5e0

53 files changed

Lines changed: 2268 additions & 1324 deletions

Some content is hidden

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

.circleci/config.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ jobs:
1616
- checkout
1717
- run:
1818
name: Install project dependencies
19-
command: poetry install --no-ansi
19+
command: poetry install --no-ansi --with=dev
2020
- run:
2121
name: Lint
22-
command: ./pylint.sh
22+
command: poetry run lint
23+
- run:
24+
name: Check code formatting
25+
command: poetry run check_format
2326
- persist_to_workspace:
2427
root: ~/project
2528
paths:
@@ -29,7 +32,7 @@ jobs:
2932
executor: machine_executor_amd64
3033
steps:
3134
- checkout
32-
- run: docker compose -f docker-compose-test.yaml run test
35+
- run: docker compose -f docker-compose-test.yaml up test --exit-code-from test
3336

3437

3538
workflows:

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,20 @@ asyncio.run(test_notifier())
9191

9292
## Testing
9393

94-
You can test the SDK against a local instance of Jellyfish by running
94+
You can test the SDK by running
9595
```console
96-
pytest
96+
poetry run ci_test
9797
```
9898

99-
Make sure to use the default configuration for Jellyfish
100-
101-
Alternatively you can test using Docker
99+
## Format&Lint
100+
You can format code by running
102101
```console
103-
docker-compose -f docker-compose-test.yaml run test
102+
poetry run format
103+
```
104+
105+
You can check linter by running
106+
```
107+
poetry run lint
104108
```
105109

106110
## Copyright and License

docker-compose-test.yaml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,17 @@ services:
2525
- "5002:5002"
2626
- "49999:49999"
2727
- "50000-50050:50000-50050/udp"
28-
networks:
29-
- network
3028

3129
test:
30+
container_name: test
3231
image: cimg/python:3.8
33-
command: sh -c "cd /app && \
34-
poetry config virtualenvs.in-project false && \
35-
poetry install --no-ansi && \
36-
poetry run pytest -s"
32+
command: sh -c "cd /app && \ poetry config virtualenvs.in-project false && \ poetry install --no-ansi && \ poetry run pytest -s"
3733
environment:
3834
DOCKER_TEST: "TRUE"
35+
ports:
36+
- "5000:5000"
3937
volumes:
4038
- .:/app
41-
networks:
42-
- network
4339
depends_on:
4440
jellyfish:
4541
condition: service_healthy
46-
47-
networks:
48-
network:
49-
driver: bridge

jellyfish/__init__.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,52 @@
88

99
# API
1010
from jellyfish._room_api import RoomApi
11-
from jellyfish._notifier import Notifier
11+
from jellyfish._ws_notifier import Notifier
12+
from jellyfish._webhook_notifier import receive_json
1213

1314
# Models
1415
from jellyfish._openapi_client import (
15-
Room, RoomConfig, Peer, Component, ComponentHLS, ComponentRTSP, ComponentOptions,
16-
ComponentOptionsRTSP, ComponentOptionsHLS, PeerOptionsWebRTC)
16+
Room,
17+
RoomConfig,
18+
Peer,
19+
Component,
20+
ComponentHLS,
21+
ComponentRTSP,
22+
ComponentOptions,
23+
ComponentOptionsRTSP,
24+
ComponentOptionsHLS,
25+
PeerOptionsWebRTC,
26+
)
1727

1828
# Server Messages
1929
from jellyfish import events
2030

2131
# Exceptions
2232
from jellyfish._openapi_client.exceptions import (
23-
UnauthorizedException, NotFoundException, BadRequestException)
33+
UnauthorizedException,
34+
NotFoundException,
35+
BadRequestException,
36+
)
2437

2538

2639
__all__ = [
27-
'RoomApi', 'Notifier', 'Room', 'Peer', 'Component', 'ComponentHLS', 'ComponentRTSP',
28-
'ComponentOptionsHLS', 'RoomConfig', 'ComponentOptions', 'ComponentOptionsRTSP',
29-
'PeerOptionsWebRTC', 'events', 'UnauthorizedException', 'NotFoundException',
30-
'BadRequestException']
40+
"RoomApi",
41+
"Notifier",
42+
"receive_json",
43+
"Room",
44+
"Peer",
45+
"Component",
46+
"ComponentHLS",
47+
"ComponentRTSP",
48+
"ComponentOptionsHLS",
49+
"RoomConfig",
50+
"ComponentOptions",
51+
"ComponentOptionsRTSP",
52+
"PeerOptionsWebRTC",
53+
"events",
54+
"UnauthorizedException",
55+
"NotFoundException",
56+
"BadRequestException",
57+
]
3158

3259
__docformat__ = "restructuredtext"

jellyfish/_openapi_client/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
from jellyfish._openapi_client.models.add_component_request import AddComponentRequest
3434
from jellyfish._openapi_client.models.add_peer_request import AddPeerRequest
3535
from jellyfish._openapi_client.models.component import Component
36-
from jellyfish._openapi_client.models.component_details_response import ComponentDetailsResponse
36+
from jellyfish._openapi_client.models.component_details_response import (
37+
ComponentDetailsResponse,
38+
)
3739
from jellyfish._openapi_client.models.component_hls import ComponentHLS
3840
from jellyfish._openapi_client.models.component_metadata_hls import ComponentMetadataHLS
3941
from jellyfish._openapi_client.models.component_options import ComponentOptions
@@ -44,13 +46,19 @@
4446
from jellyfish._openapi_client.models.hls_skip import HlsSkip
4547
from jellyfish._openapi_client.models.peer import Peer
4648
from jellyfish._openapi_client.models.peer_details_response import PeerDetailsResponse
47-
from jellyfish._openapi_client.models.peer_details_response_data import PeerDetailsResponseData
49+
from jellyfish._openapi_client.models.peer_details_response_data import (
50+
PeerDetailsResponseData,
51+
)
4852
from jellyfish._openapi_client.models.peer_options import PeerOptions
4953
from jellyfish._openapi_client.models.peer_options_web_rtc import PeerOptionsWebRTC
5054
from jellyfish._openapi_client.models.peer_status import PeerStatus
5155
from jellyfish._openapi_client.models.room import Room
5256
from jellyfish._openapi_client.models.room_config import RoomConfig
53-
from jellyfish._openapi_client.models.room_create_details_response import RoomCreateDetailsResponse
54-
from jellyfish._openapi_client.models.room_create_details_response_data import RoomCreateDetailsResponseData
57+
from jellyfish._openapi_client.models.room_create_details_response import (
58+
RoomCreateDetailsResponse,
59+
)
60+
from jellyfish._openapi_client.models.room_create_details_response_data import (
61+
RoomCreateDetailsResponseData,
62+
)
5563
from jellyfish._openapi_client.models.room_details_response import RoomDetailsResponse
5664
from jellyfish._openapi_client.models.rooms_listing_response import RoomsListingResponse

jellyfish/_openapi_client/api/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
# import apis into api package
44
from jellyfish._openapi_client.api.default_api import DefaultApi
55
from jellyfish._openapi_client.api.room_api import RoomApi
6-

0 commit comments

Comments
 (0)