Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move protocol to livekit-protocol package #89

Merged
merged 6 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
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
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
9 changes: 9 additions & 0 deletions livekit-protocol/livekit/protocol/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from . import livekit_agent_pb2 as agent

Check failure on line 1 in livekit-protocol/livekit/protocol/__init__.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

livekit-protocol/livekit/protocol/__init__.py:1:36: F401 `.livekit_agent_pb2` imported but unused
from . import livekit_egress_pb2 as egress

Check failure on line 2 in livekit-protocol/livekit/protocol/__init__.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

livekit-protocol/livekit/protocol/__init__.py:2:37: F401 `.livekit_egress_pb2` imported but unused
from . import livekit_ingress_pb2 as ingress

Check failure on line 3 in livekit-protocol/livekit/protocol/__init__.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

livekit-protocol/livekit/protocol/__init__.py:3:38: F401 `.livekit_ingress_pb2` imported but unused
from . import livekit_models_pb2 as models

Check failure on line 4 in livekit-protocol/livekit/protocol/__init__.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

livekit-protocol/livekit/protocol/__init__.py:4:37: F401 `.livekit_models_pb2` imported but unused
from . import livekit_room_pb2 as room

Check failure on line 5 in livekit-protocol/livekit/protocol/__init__.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

livekit-protocol/livekit/protocol/__init__.py:5:35: F401 `.livekit_room_pb2` imported but unused
from . import livekit_webhook_pb2 as webhook

Check failure on line 6 in livekit-protocol/livekit/protocol/__init__.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

livekit-protocol/livekit/protocol/__init__.py:6:38: F401 `.livekit_webhook_pb2` imported but unused

from .version import __version__

Check failure on line 8 in livekit-protocol/livekit/protocol/__init__.py

View workflow job for this annotation

GitHub Actions / build

Ruff (F401)

livekit-protocol/livekit/protocol/__init__.py:8:22: F401 `.version.__version__` imported but unused

Loading
Loading