Skip to content

Commit

Permalink
Install dependencies with uv
Browse files Browse the repository at this point in the history
We've been installing Python dependencies with Pip, and not tracking
their versions. Since we've started using uv in some other Python
projects it probably makes sense to add here so that speech-to-text can
be tracked by infra-team's weekly dependency update process.

Closes #80
Refs #65
  • Loading branch information
edsu committed Jan 31, 2025
1 parent 3b5d919 commit e2553aa
Show file tree
Hide file tree
Showing 7 changed files with 2,247 additions and 22 deletions.
17 changes: 17 additions & 0 deletions .autoupdate/preupdate
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

#!/bin/bash

# This script is called by our weekly dependency update job in Jenkins

pip3 install uv > was-pywb.txt &&
~/.local/bin/uv lock --upgrade >> speech-to-text.txt

retVal=$?

git add uv.lock &&
git commit -m "Update Python dependencies"

if [ $retVal -ne 0 ]; then
echo "ERROR UPDATING PYTHON (speech-to-text)"
cat speech-to-text.txt
fi
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.11]
steps:

- name: checkout
Expand All @@ -33,10 +33,10 @@ jobs:
- name: Install Python dependencies
run: |
pip install -r requirements.txt
pip install uv
- name: Run type checking
run: mypy .
run: uv run mypy .

- name: Download code coverage reporter and notify Code Climate of the build
run: |
Expand All @@ -45,7 +45,7 @@ jobs:
./cc-test-reporter before-build
- name: Run tests
run: pytest --cov-report=xml
run: uv run pytest --cov-report=xml

- name: Notify Code Climate that the build is done
env:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ ADD ./whisper_models whisper_models
ADD ./requirements.txt requirements.txt

RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install -r requirements.txt
RUN python3 -m pip install uv

ADD ./speech_to_text.py speech_to_text.py
RUN python3 -m py_compile speech_to_text.py
RUN uv run python3 -m py_compile speech_to_text.py

ENTRYPOINT ["python3", "speech_to_text.py"]
ENTRYPOINT ["uv", "run", "speech_to_text.py"]
9 changes: 4 additions & 5 deletions env-example
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
AWS_ACCESS_KEY_ID=CHANGE_ME
AWS_SECRET_ACCESS_KEY=CHANGE_ME
AWS_DEFAULT_REGION=us-west-2
AWS_ROLE_ARN=CHANGE_ME
SPEECH_TO_TEXT_S3_BUCKET=CHANGE_ME
SPEECH_TO_TEXT_BATCH_JOB_QUEUE=CHANGE_ME
SPEECH_TO_TEXT_BATCH_JOB_DEFINITION=CHANGE_ME
SPEECH_TO_TEXT_DONE_SQS_QUEUE=CHANGE_ME
SPEECH_TO_TEXT_S3_BUCKET=my-speech-to-text-development
SPEECH_TO_TEXT_BATCH_JOB_QUEUE=my-speech-to-text-development
SPEECH_TO_TEXT_BATCH_JOB_DEFINITION=my-speech-to-text-development
SPEECH_TO_TEXT_DONE_SQS_QUEUE=speech-to-text-development
HONEYBADGER_API_KEY=CHANGE_ME
HONEYBADGER_ENV=CHANGE_ME
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[project]
name = "speech-to-text"
version = "0.0.1"
description = ""
readme = "README.md"
requires-python = ">= 3.8"
dependencies = [
"boto3>=1.36.9",
"boto3-stubs[s3,sqs,sts]>=1.36.9",
"honeybadger>=0.20.3",
"moto[s3,sqs,sts]>=5.0.27",
"openai-whisper>=20240930",
"python-dotenv[cli]>=1.0.1",
]

[dependency-groups]
dev = [
"mypy>=1.14.1",
"pytest>=8.3.4",
"pytest-cov>=5.0.0",
"ruff>=0.9.4",
]
10 changes: 0 additions & 10 deletions requirements.txt

This file was deleted.

2,197 changes: 2,197 additions & 0 deletions uv.lock

Large diffs are not rendered by default.

0 comments on commit e2553aa

Please sign in to comment.