Skip to content

Commit

Permalink
Makes dependencies optional, adds to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
norman-codes committed Sep 6, 2024
1 parent 8b296ab commit 975d55b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install
run: poetry install -E microphone
- name: Compile
run: poetry run mypy .
test:
Expand All @@ -31,12 +31,15 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install system dependencies for audio
run: |
sudo apt-get --yes update
sudo apt-get --yes install libasound2-dev libportaudio2 ffmpeg
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
- name: Install dependencies
run: poetry install

run: poetry install -E microphone
- name: Install Fern
run: npm install -g fern-api
- name: Test
Expand Down
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ httpx = ">=0.21.2"
jupyter = { version="^1.0.0", optional = true}
pydantic = ">= 1.9.2"
pydantic-core = "^2.18.2"
pydub = "^0.25.1"
simpleaudio = "^1.0.4"
sounddevice = "^0.4.6"
pydub = { version="^0.25.1", optional = true}
simpleaudio = { version="^1.0.4", optional = true}
sounddevice = { version="^0.4.6", optional = true}
typing_extensions = ">= 4.0.0"
websockets = "12.0"

Expand Down Expand Up @@ -94,12 +94,11 @@ plugins = ["pydantic.mypy"]
[tool.ruff]
line-length = 120


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.extras]
examples=["jupyter"]
microphone=["simpleaudio", "sounddevice"]
legacy=["pydub"]
microphone=["pydub", "simpleaudio", "sounddevice"]
legacy=["pydub", "simpleaudio", "sounddevice"]
4 changes: 2 additions & 2 deletions src/hume/empathic_voice/chat/audio/microphone.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from hume.empathic_voice.chat.audio.asyncio_utilities import Stream

try:
import _cffi_backend as cffi_backend
import sounddevice
import _cffi_backend as cffi_backend # type: ignore
import sounddevice # type: ignore
from _cffi_backend import \
_CDataBase as CDataBase # pylint: disable=no-name-in-module
from sounddevice import CallbackFlags, RawInputStream
Expand Down

0 comments on commit 975d55b

Please sign in to comment.