Skip to content

Commit 314635a

Browse files
update to use uv and improve CI
1 parent 89e4c00 commit 314635a

File tree

8 files changed

+5690
-6812
lines changed

8 files changed

+5690
-6812
lines changed

.github/workflows/test.yml

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ on:
1414

1515
env:
1616
PYTHON_VERSION: "3.11"
17-
POETRY_VERSION: "2.0.1"
17+
UV_VERSION: "0.7.13"
18+
DEFAULT_REDIS_IMAGE: "8.0.2"
1819

1920
jobs:
2021
service-tests:
@@ -24,11 +25,10 @@ jobs:
2425
HF_HOME: ${{ github.workspace }}/hf_cache
2526
steps:
2627
- name: Check out repository
27-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2829

2930
- name: Cache HuggingFace Models
30-
id: hf-cache
31-
uses: actions/cache@v3
31+
uses: actions/cache@v4
3232
with:
3333
path: hf_cache
3434
key: ${{ runner.os }}-hf-cache
@@ -38,20 +38,24 @@ jobs:
3838
mkdir -p ~/.huggingface
3939
echo '{"token":"${{ secrets.HF_TOKEN }}"}' > ~/.huggingface/token
4040
41-
- name: Set up Python 3.11
42-
uses: actions/setup-python@v4
41+
- name: Install Python
42+
uses: actions/setup-python@v5
4343
with:
4444
python-version: ${{ env.PYTHON_VERSION }}
45-
cache: pip
4645

47-
- name: Install Poetry
48-
uses: snok/install-poetry@v1
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@v6
4948
with:
50-
version: ${{ env.POETRY_VERSION }}
49+
version: ${{ env.UV_VERSION }}
50+
enable-cache: true
51+
python-version: ${{ env.PYTHON_VERSION }} # sets UV_PYTHON
52+
cache-dependency-glob: |
53+
pyproject.toml
54+
uv.lock
5155
5256
- name: Install dependencies
5357
run: |
54-
poetry install --all-extras
58+
uv sync --group test --frozen
5559
5660
- name: Authenticate to Google Cloud
5761
uses: google-github-actions/auth@v1
@@ -61,7 +65,6 @@ jobs:
6165
- name: Run full test suite and prime the HF cache
6266
env:
6367
HF_TOKEN: ${{ secrets.HF_TOKEN }}
64-
HF_HOME: ${{ github.workspace }}/hf_cache
6568
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
6669
GCP_LOCATION: ${{ secrets.GCP_LOCATION }}
6770
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
@@ -87,45 +90,48 @@ jobs:
8790
fail-fast: false
8891
matrix:
8992
# 3.11 tests are run in the service-tests job
90-
python-version: ["3.9", "3.10", 3.12, 3.13]
93+
python-version: ["3.9", "3.10", "3.12", "3.13"]
9194
redis-py-version: ["5.x", "6.x"]
92-
redis-version: ["6.2.6-v9", "latest", "8.0.1"]
93-
95+
redis-version: ["6.2.6-v9", "latest", "${{ env.DEFAULT_REDIS_IMAGE }}"]
9496
steps:
9597
- name: Check out repository
96-
uses: actions/checkout@v3
98+
uses: actions/checkout@v4
9799

98100
- name: Cache HuggingFace Models
99-
uses: actions/cache@v3
101+
uses: actions/cache@v4
100102
with:
101103
path: hf_cache
102104
key: ${{ runner.os }}-hf-cache
103105

104-
- name: Set up Python ${{ matrix.python-version }}
105-
uses: actions/setup-python@v4
106+
- name: Install Python
107+
uses: actions/setup-python@v5
106108
with:
107109
python-version: ${{ matrix.python-version }}
108-
cache: pip
109110

110-
- name: Install Poetry
111-
uses: snok/install-poetry@v1
111+
- name: Install uv
112+
uses: astral-sh/setup-uv@v6
112113
with:
113-
version: ${{ env.POETRY_VERSION }}
114+
version: ${{ env.UV_VERSION }}
115+
enable-cache: true
116+
python-version: ${{ matrix.python-version }} # sets UV_PYTHON
117+
cache-dependency-glob: |
118+
pyproject.toml
119+
uv.lock
114120
115121
- name: Install dependencies
116122
run: |
117-
poetry install --all-extras
123+
uv sync --group test --frozen
118124
119125
# Install right redis version based on redis py
120126
if [[ "${{ matrix.redis-py-version }}" == "5.x" ]]; then
121-
poetry run pip install "redis>=5.0.0,<6.0.0"
127+
uv pip install "redis>=5,<6"
122128
else
123-
poetry run pip install "redis>=6.0.0,<7.0.0"
129+
uv pip install "redis>=6,<7"
124130
fi
125131
126132
- name: Set Redis image name
127133
run: |
128-
if [[ "${{ matrix.redis-version }}" == "8.0.1" ]]; then
134+
if [[ "${{ matrix.redis-version }}" == "${{ env.DEFAULT_REDIS_IMAGE }}" ]]; then
129135
echo "REDIS_IMAGE=redis:${{ matrix.redis-version }}" >> $GITHUB_ENV
130136
else
131137
echo "REDIS_IMAGE=redis/redis-stack-server:${{ matrix.redis-version }}" >> $GITHUB_ENV
@@ -138,7 +144,6 @@ jobs:
138144

139145
- name: Run tests
140146
env:
141-
HF_HOME: ${{ github.workspace }}/hf_cache
142147
GCP_LOCATION: ${{ secrets.GCP_LOCATION }}
143148
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
144149
run: |
@@ -147,7 +152,6 @@ jobs:
147152
- name: Run notebooks
148153
if: matrix.redis-py-version == '6.x' && matrix.redis-version == 'latest'
149154
env:
150-
HF_HOME: ${{ github.workspace }}/hf_cache
151155
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
152156
GCP_LOCATION: ${{ secrets.GCP_LOCATION }}
153157
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
@@ -171,20 +175,24 @@ jobs:
171175
- name: Check out repository
172176
uses: actions/checkout@v3
173177

174-
- name: Set up Python
175-
uses: actions/setup-python@v4
178+
- name: Install Python
179+
uses: actions/setup-python@v5
176180
with:
177181
python-version: ${{ env.PYTHON_VERSION }}
178-
cache: pip
179182

180-
- name: Install Poetry
181-
uses: snok/install-poetry@v1
183+
- name: Install uv
184+
uses: astral-sh/setup-uv@v6
182185
with:
183-
version: ${{ env.POETRY_VERSION }}
184-
186+
version: ${{ env.UV_VERSION }}
187+
enable-cache: true
188+
python-version: ${{ env.PYTHON_VERSION }} # sets UV_PYTHON
189+
cache-dependency-glob: |
190+
pyproject.toml
191+
uv.lock
192+
185193
- name: Install dependencies
186194
run: |
187-
poetry install --all-extras
195+
uv sync --group docs --frozen
188196
189197
- name: Build docs
190198
run: |

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
repos:
22
- repo: local
33
hooks:
4-
- id: poetry-checks
4+
- id: code-quality-checks
55
name: Run pre-commit checks (format, sort-imports, check-mypy)
6-
entry: bash -c 'poetry run format && poetry run sort-imports && poetry run check-mypy'
6+
entry: bash -c 'make format && make check-sort-imports && make check-types'
77
language: system
8-
pass_filenames: false
8+
pass_filenames: false

0 commit comments

Comments
 (0)