Skip to content

Commit 3a89c57

Browse files
committed
Switch to uv
1 parent cbc4bec commit 3a89c57

12 files changed

+2498
-3482
lines changed

.ci/run-tests-for-ci.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ echo "OSTYPE: $OSTYPE"
99
if [[ "$OSTYPE" != msys ]]; then
1010
echo "i18n"
1111
# Make sure i18n literals marked correctly
12-
poetry run python manage.py makemessages --all
13-
poetry run python manage.py compilemessages
12+
uv run python manage.py makemessages --all
13+
uv run python manage.py compilemessages
1414
fi
1515

1616
staticfiles=(
@@ -29,7 +29,7 @@ for i in "${staticfiles[@]}"; do
2929
touch "frontend-dist/$i"
3030
done
3131

32-
poetry run python manage.py collectstatic
32+
uv run python manage.py collectstatic
3333

3434
rm local_settings.py
3535

@@ -50,7 +50,7 @@ fi
5050

5151
if [[ "$RL_CI_TEST" = "expensive" ]]; then
5252
echo "Expensive tests"
53-
poetry run python -m pytest "${PYTEST_COMMON_FLAGS[@]}" --slow
53+
uv run python -m pytest "${PYTEST_COMMON_FLAGS[@]}" --slow
5454
elif [[ "$RL_CI_TEST" = "postgres" ]]; then
5555
export PGPASSWORD=relatepgpass
5656

@@ -69,10 +69,10 @@ elif [[ "$RL_CI_TEST" = "postgres" ]]; then
6969
},
7070
}" >> local_settings_example.py
7171

72-
poetry run pip install psycopg2
72+
uv run pip install psycopg2
7373
echo "Database tests"
74-
poetry run python -m pytest "${PYTEST_COMMON_FLAGS[@]}"
74+
uv run python -m pytest "${PYTEST_COMMON_FLAGS[@]}"
7575
else
7676
echo "Base tests"
77-
poetry run python -m pytest "${PYTEST_COMMON_FLAGS[@]}"
77+
uv run python -m pytest "${PYTEST_COMMON_FLAGS[@]}"
7878
fi

.ci/test-command-line-tool.sh

-50
This file was deleted.

.github/workflows/ci.yml

+18-51
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ on:
77
schedule:
88
- cron: "17 3 * * 0"
99

10-
defaults:
11-
run:
12-
# required by https://github.com/snok/install-poetry#windows
13-
shell: bash
14-
1510
concurrency:
1611
group: ${{ github.head_ref || github.ref_name }}
1712
cancel-in-progress: true
@@ -25,38 +20,27 @@ jobs:
2520
- uses: actions/setup-python@v5
2621
with:
2722
python-version: '3.x'
28-
- name: Install Poetry
29-
uses: snok/[email protected]
30-
with:
31-
version: "1.8.2"
32-
virtualenvs-create: true
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v5
3325

34-
#- name: Cache python dependencies
35-
# uses: actions/cache@v2
36-
# id: cache
37-
# with:
38-
# path: ~/.cache/pypoetry
39-
# key: poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
40-
# restore-keys: |
41-
# poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
4226
- name: Install Dependencies
43-
run: poetry install
44-
# if: steps.cache.outputs.cache-hit != 'true'
27+
run: uv sync --frozen
28+
4529
- name: "Ruff"
4630
run: |
47-
poetry run ruff check
31+
uv run ruff check
4832
- uses: crate-ci/typos@master
4933
- name: "Set up local settings"
5034
run: cp local_settings_example.py local_settings.py
5135
- name: "Mypy"
52-
run: poetry run ./.ci/run-mypy.sh
36+
run: uv run ./.ci/run-mypy.sh
5337
- name: "Safety"
54-
run: poetry run ./.ci/run-safety.sh
38+
run: uv run ./.ci/run-safety.sh
5539
env:
5640
SAFETY_API_KEY: ${{ secrets.SAFETY_API_KEY }}
5741
- name: "Sphinx"
5842
run: |
59-
(cd doc; poetry run make html SPHINXOPTS="-W --keep-going -n")
43+
(cd doc; uv run make html SPHINXOPTS="-W --keep-going -n")
6044
6145
frontend:
6246
name: Lint JS/build frontend (Node ${{ matrix.node-version }})
@@ -103,23 +87,12 @@ jobs:
10387
- uses: actions/setup-python@v5
10488
with:
10589
python-version: ${{ matrix.python-version }}
106-
- name: Install Poetry
107-
uses: snok/[email protected]
108-
with:
109-
version: "1.8.2"
110-
virtualenvs-create: true
90+
- name: Install uv
91+
uses: astral-sh/setup-uv@v5
11192

112-
#- name: Cache python dependencies
113-
# uses: actions/cache@v2
114-
# id: cache
115-
# with:
116-
# path: ~/.cache/pypoetry
117-
# key: poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
118-
# restore-keys: |
119-
# poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
12093
- name: Install Dependencies
121-
run: poetry install
122-
# if: steps.cache.outputs.cache-hit != 'true'
94+
run: uv sync --frozen --extra postgres
95+
12396
- name: Install OS dependencies
12497
env:
12598
DEBIAN_FRONTEND: noninteractive
@@ -136,9 +109,9 @@ jobs:
136109
git clone https://github.com/inducer/relate-sample
137110
cd relate-sample
138111
139-
poetry run relate validate .
140-
poetry run relate test-code questions/autograded-python-example.yml
141-
poetry run relate expand-yaml flows/quiz-test.yml > /dev/null
112+
uv run relate validate .
113+
uv run relate test-code questions/autograded-python-example.yml
114+
uv run relate expand-yaml flows/quiz-test.yml > /dev/null
142115
143116
pytest-windows:
144117
name: Python - Windows
@@ -148,17 +121,11 @@ jobs:
148121
- uses: actions/setup-python@v5
149122
with:
150123
python-version: '3.x'
151-
- name: Install Poetry
152-
uses: snok/[email protected]
153-
with:
154-
version: "1.8.2"
155-
virtualenvs-create: true
156-
- name: Configure Poetry
157-
run: |
158-
poetry config virtualenvs.in-project true
124+
- name: Install uv
125+
uses: astral-sh/setup-uv@v5
159126
- name: Install Dependencies
160127
run: |
161-
poetry install
128+
uv sync --frozen
162129
- name: Run test suite
163130
run: |
164131
bash ./.ci/run-tests-for-ci.sh

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ local_settings.py
99
doc/_build
1010
node_modules
1111

12-
poetry.toml
13-
1412
setuptools-[0-9]*
1513
virtualenv-[0-9]*
1614

.gitlab-ci.yml

+10-26
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
variables:
2-
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
3-
POETRY_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pypoetry"
4-
POETRY_VIRTUALENVS_IN_PROJECT: "true"
5-
6-
cache:
7-
key:
8-
files:
9-
- .gitlab-ci.yml
10-
- poetry.lock
11-
prefix: relate
12-
paths:
13-
- ".cache/pypoetry"
14-
- ".cache/pip"
15-
- ".venv"
16-
171
stages:
182
- setup
193
- lint
@@ -25,9 +9,9 @@ stages:
259
tags:
2610
- docker-runner
2711
before_script:
28-
- curl -sSL https://install.python-poetry.org | python3 -
12+
- curl -LsSf https://astral.sh/uv/install.sh | sh
2913
- export PATH="$HOME/.local/bin:$PATH"
30-
- poetry install
14+
- uv sync --frozen
3115

3216
.quality-template: &quality
3317
<<: *install-deps
@@ -47,22 +31,22 @@ stages:
4731
setup:
4832
<<: *install-deps
4933
stage: setup
50-
script: poetry config --list
34+
script: "true"
5135

5236
ruff:
5337
<<: *quality
5438
script: |
55-
poetry run ruff check
39+
uv run ruff check
5640
5741
mypy:
5842
<<: *quality
5943
variables:
6044
RELATE_LOCAL_TEST_SETTINGS: './local_settings_example.py'
61-
script: poetry run ./.ci/run-mypy.sh
45+
script: uv run ./.ci/run-mypy.sh
6246

6347
safety:
6448
<<: *quality
65-
script: poetry run ./.ci/run-safety.sh
49+
script: uv run ./.ci/run-safety.sh
6650

6751
Python 3:
6852
<<: *test
@@ -79,9 +63,9 @@ Python 3 CLI Tool:
7963
script:
8064
- git clone https://github.com/inducer/relate-sample
8165
- cd relate-sample
82-
- poetry run relate validate .
83-
- poetry run relate test-code questions/autograded-python-example.yml
84-
- poetry run relate expand-yaml flows/quiz-test.yml > /dev/null
66+
- uv run relate validate .
67+
- uv run relate test-code questions/autograded-python-example.yml
68+
- uv run relate expand-yaml flows/quiz-test.yml > /dev/null
8569
needs: [setup]
8670

8771
Documentation:
@@ -90,5 +74,5 @@ Documentation:
9074
variables:
9175
RELATE_LOCAL_TEST_SETTINGS: './local_settings_example.py'
9276
script:
93-
- poetry run bash ./doc/build-docs.sh
77+
- uv run bash ./doc/build-docs.sh
9478
needs: [setup]

collectstatic.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#! /bin/bash
22

33
find node_modules/mathjax/es5 -name '*.js' -exec sed -i /sourceMappingURL=/d '{}' \;
4-
poetry run python manage.py collectstatic
4+
uv run python manage.py collectstatic

doc/build-docs.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
set -e
44

5-
# This whole script is being run inside of poetry, so no need to wrap move of
6-
# it in poetry calls.
7-
8-
python -m pip install docutils sphinx
5+
# This whole script is being run inside of uv, so no need to wrap move of
6+
# it in uv calls.
97

108
cp local_settings_example.py doc
119

0 commit comments

Comments
 (0)