Skip to content

Commit

Permalink
move protocol to livekit-protocol package (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom authored Nov 7, 2023
1 parent 1f7ce70 commit ba26dcc
Show file tree
Hide file tree
Showing 49 changed files with 691 additions and 6,568 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ jobs:
run: |
pip3 install build wheel
python3 -m build --wheel
env:
CIBW_ARCHS: ${{ matrix.archs }}
CIBW_SKIP: "*-musllinux_*"
- name: Build SDist
run: pipx run build --sdist
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/build-protocol.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build Protocol

on:
push:
paths:
- livekit-protocol/**
pull_request:
paths:
- livekit-protocol/**
workflow_dispatch:

env:
PACKAGE_DIR: ./livekit-protocol

jobs:
build_wheels:
name: Build Protocol wheel/sdist
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.PACKAGE_DIR }}
steps:
- uses: actions/checkout@v3
with:
submodules: true

- uses: actions/setup-python@v4

- name: Build wheel
run: |
pip3 install build wheel
python3 -m build --wheel
- name: Build SDist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
name: protocol-release
path: |
livekit-protocol/dist/*.whl
livekit-protocol/dist/*.tar.gz
publish:
name: Publish Protocol release
needs: build_wheels
runs-on: ubuntu-latest
permissions:
id-token: write
if: startsWith(github.ref, 'refs/tags/protocol-v')
steps:
- uses: actions/download-artifact@v3
with:
name: protocol-release
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
path = livekit-rtc/rust-sdks
url = https://github.com/livekit/rust-sdks
[submodule "livekit-api/protocol"]
path = livekit-api/protocol
path = livekit-protocol/protocol
url = https://github.com/livekit/protocol
1 change: 1 addition & 0 deletions examples/e2ee.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

WIDTH, HEIGHT = 1280, 720


async def draw_cube(source: rtc.VideoSource):
MID_W, MID_H = 640, 360
cube_size = 60
Expand Down
1 change: 1 addition & 0 deletions examples/publish_hue.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

WIDTH, HEIGHT = 1280, 720


async def draw_color_cycle(source: rtc.VideoSource):
argb_frame = rtc.ArgbFrame.create(rtc.VideoFormatType.FORMAT_ARGB, WIDTH, HEIGHT)
arr = np.frombuffer(argb_frame.data, dtype=np.uint8)
Expand Down
11 changes: 6 additions & 5 deletions livekit-api/livekit/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
"""

# flake8: noqa
from ._proto.livekit_egress_pb2 import *
from ._proto.livekit_models_pb2 import *
from ._proto.livekit_room_pb2 import *
from ._proto.livekit_ingress_pb2 import *
from .version import __version__
from livekit.protocol.egress import *
from livekit.protocol.ingress import *
from livekit.protocol.models import *
from livekit.protocol.room import *

from .access_token import VideoGrants, AccessToken
from .room_service import RoomService
from .version import __version__
Empty file.
106 changes: 0 additions & 106 deletions livekit-api/livekit/api/_proto/livekit_models_pb2.py

This file was deleted.

4 changes: 2 additions & 2 deletions livekit-api/livekit/api/room_service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ._proto import livekit_models_pb2 as proto_models
from ._proto import livekit_room_pb2 as proto_room
from livekit.protocol import room as proto_room
from livekit.protocol import models as proto_models
from ._service import Service
from .access_token import VideoGrants

Expand Down
1 change: 0 additions & 1 deletion livekit-api/protocol
Submodule protocol deleted from 525419
3 changes: 2 additions & 1 deletion livekit-api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@
"aiohttp>=3.8.0",
"protobuf>=3.1.0",
"types-protobuf>=3.1.0",
"livekit-protocol>=0.1.0",
],
package_data={
"livekit.api": ["_proto/*.py", "py.typed", "*.pyi", "**/*.pyi"],
"livekit.api": ["py.typed", "*.pyi", "**/*.pyi"],
},
project_urls={
"Documentation": "https://docs.livekit.io",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
# This script requires protobuf-compiler and https://github.com/nipunn1313/mypy-protobuf

API_PROTOCOL=./protocol
API_OUT_PYTHON=./livekit/api/_proto
API_OUT_PYTHON=./livekit/protocol

# api

protoc \
-I=$API_PROTOCOL \
--python_out=$API_OUT_PYTHON \
Expand All @@ -29,11 +27,12 @@ protoc \
$API_PROTOCOL/livekit_room.proto \
$API_PROTOCOL/livekit_webhook.proto \
$API_PROTOCOL/livekit_ingress.proto \
$API_PROTOCOL/livekit_models.proto
$API_PROTOCOL/livekit_models.proto \
$API_PROTOCOL/livekit_agent.proto


touch -a "$API_OUT_PYTHON/__init__.py"

for f in "$API_OUT_PYTHON"/*.py "$API_OUT_PYTHON"/*.pyi; do
perl -i -pe 's|^(import (livekit_egress_pb2\|livekit_room_pb2\|livekit_webhook_pb2\|livekit_ingress_pb2\|livekit_models_pb2))|from . $1|g' "$f"
perl -i -pe 's|^(import (livekit_egress_pb2\|livekit_room_pb2\|livekit_webhook_pb2\|livekit_ingress_pb2\|livekit_models_pb2\|livekit_agent_pb2))|from . $1|g' "$f"
done
Loading

0 comments on commit ba26dcc

Please sign in to comment.