Skip to content

Commit

Permalink
Fix dynamic version
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvonthenen committed Dec 12, 2023
1 parent 9e85f25 commit 536831f
Show file tree
Hide file tree
Showing 20 changed files with 199 additions and 969 deletions.
16 changes: 12 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
*.egg-info
__pycache__
dist/
# general

# environment artifacts
.venv
.env
venv/
venv.bak/
.vscode/

# python artifacts
__pycache__
*.egg-info
dist/

# build
build/
.vscode/
poetry.lock
22 changes: 15 additions & 7 deletions deepgram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,33 @@
__version__ = "0.0.0"

# entry point for the deepgram python sdk
from .client import DeepgramClient, DeepgramApiKeyError
from .client import DeepgramClient
from .options import DeepgramClientOptions

# live
from .clients.live.enums import LiveTranscriptionEvents
from .clients.live.client import LiveClient, AsyncLiveClient, LiveOptions
from .clients import LiveTranscriptionEvents
from .clients import LiveClient, AsyncLiveClient, LiveOptions

# onprem
from .clients.onprem.client import (
from .clients import (
OnPremClient,
AsyncOnPremClient,
)

# prerecorded
from .clients.prerecorded.client import (
from .clients import (
PreRecordedClient,
AsyncPreRecordedClient,
PrerecordedOptions,
PrerecordedSource,
FileSource,
UrlSource,
BufferSource,
ReadStreamSource,
)

# manage
from .clients.manage.client import (
from .clients import (
ManageClient,
AsyncManageClient,
ProjectOptions,
Expand All @@ -43,4 +45,10 @@
)

# utilities
from .audio.microphone.microphone import Microphone
from .audio import Microphone
from .audio import (
LOGGING,
CHANNELS,
RATE,
CHUNK,
)
6 changes: 6 additions & 0 deletions deepgram/audio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .microphone import Microphone
from .microphone import LOGGING, CHANNELS, RATE, CHUNK
6 changes: 6 additions & 0 deletions deepgram/audio/microphone/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .microphone import Microphone
from .constants import LOGGING, CHANNELS, RATE, CHUNK
10 changes: 10 additions & 0 deletions deepgram/audio/microphone/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

import logging, verboselogs

LOGGING = logging.WARNING
CHANNELS = 1
RATE = 16000
CHUNK = 8194
14 changes: 5 additions & 9 deletions deepgram/audio/microphone/microphone.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
import inspect
import asyncio
import threading
import pyaudio
from array import array
import logging, verboselogs

from .errors import DeepgramMicrophoneError

FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 16000
CHUNK = 8194
from .constants import LOGGING, CHANNELS, RATE, CHUNK


class Microphone:
Expand All @@ -25,20 +20,21 @@ class Microphone:
def __init__(
self,
push_callback,
verbose=logging.WARNING,
format=FORMAT,
verbose=LOGGING,
rate=RATE,
chunk=CHUNK,
channels=CHANNELS,
):
import pyaudio

self.logger = logging.getLogger(__name__)
self.logger.addHandler(logging.StreamHandler())
self.logger.setLevel(verbose)

self.audio = pyaudio.PyAudio()
self.chunk = chunk
self.rate = rate
self.format = format
self.format = pyaudio.paInt16
self.channels = channels
self.push_callback = push_callback
self.stream = None
Expand Down
42 changes: 42 additions & 0 deletions deepgram/clients/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

# live
from .live import LiveClient
from .live import AsyncLiveClient
from .live import LiveOptions
from .live import LiveTranscriptionEvents
from ..options import DeepgramClientOptions

# prerecorded
from .prerecorded import PreRecordedClient
from .prerecorded import AsyncPreRecordedClient
from .prerecorded import PrerecordedOptions
from .prerecorded import (
PrerecordedSource,
FileSource,
UrlSource,
BufferSource,
ReadStreamSource,
)
from ..options import DeepgramClientOptions

# onprem
from .onprem import OnPremClient
from .onprem import AsyncOnPremClient
from ..options import DeepgramClientOptions

# manage
from .manage import ManageClient
from .manage import AsyncManageClient
from .manage import (
ProjectOptions,
KeyOptions,
ScopeOptions,
InviteOptions,
UsageRequestOptions,
UsageSummaryOptions,
UsageFieldsOptions,
)
from ..options import DeepgramClientOptions
9 changes: 9 additions & 0 deletions deepgram/clients/live/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .v1.client import LiveClient
from .v1.async_client import AsyncLiveClient
from .v1.options import LiveOptions
from .enums import LiveTranscriptionEvents
from ...options import DeepgramClientOptions
8 changes: 8 additions & 0 deletions deepgram/clients/live/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .client import LiveClient
from .async_client import AsyncLiveClient
from .options import LiveOptions
from ....options import DeepgramClientOptions
16 changes: 16 additions & 0 deletions deepgram/clients/manage/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .v1.client import ManageClient
from .v1.async_client import AsyncManageClient
from .v1.options import (
ProjectOptions,
KeyOptions,
ScopeOptions,
InviteOptions,
UsageRequestOptions,
UsageSummaryOptions,
UsageFieldsOptions,
)
from ...options import DeepgramClientOptions
16 changes: 16 additions & 0 deletions deepgram/clients/manage/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .client import ManageClient
from .async_client import AsyncManageClient
from .options import (
ProjectOptions,
KeyOptions,
ScopeOptions,
InviteOptions,
UsageRequestOptions,
UsageSummaryOptions,
UsageFieldsOptions,
)
from ....options import DeepgramClientOptions
7 changes: 7 additions & 0 deletions deepgram/clients/onprem/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .v1.client import OnPremClient
from .v1.async_client import AsyncOnPremClient
from ...options import DeepgramClientOptions
7 changes: 7 additions & 0 deletions deepgram/clients/onprem/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .client import OnPremClient
from .async_client import AsyncOnPremClient
from ....options import DeepgramClientOptions
16 changes: 16 additions & 0 deletions deepgram/clients/prerecorded/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .v1.client import PreRecordedClient
from .v1.async_client import AsyncPreRecordedClient
from .v1.options import PrerecordedOptions
from .source import (
PrerecordedSource,
FileSource,
UrlSource,
BufferSource,
ReadStreamSource,
)

from ...options import DeepgramClientOptions
8 changes: 8 additions & 0 deletions deepgram/clients/prerecorded/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2023 Deepgram SDK contributors. All Rights Reserved.
# Use of this source code is governed by a MIT license that can be found in the LICENSE file.
# SPDX-License-Identifier: MIT

from .client import PreRecordedClient
from .async_client import AsyncPreRecordedClient
from .options import PrerecordedOptions
from ....options import DeepgramClientOptions
7 changes: 7 additions & 0 deletions examples/requirements-examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pip install -r requirements-examples.txt

# general
python-dotenv

# streaming libs
pyaudio
Loading

0 comments on commit 536831f

Please sign in to comment.