Skip to content

Commit 0110c2c

Browse files
authored
Switch to using uv for project tooling (#437)
This migrates the project from using `rye` to `uv`, both tools provided by astral.sh but the latter is deemed to be the successor: https://lucumr.pocoo.org/2024/2/15/rye-grows-with-uv/ The scripts should all work as before.
1 parent 42ba2f7 commit 0110c2c

File tree

10 files changed

+1844
-148
lines changed

10 files changed

+1844
-148
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
steps:
3131
- uses: actions/checkout@v4
32-
- uses: eifinger/setup-rye@v2
32+
- uses: astral-sh/setup-uv@v5
3333
with:
3434
enable-cache: true
3535

@@ -41,4 +41,4 @@ jobs:
4141

4242
- name: Lint
4343
run: ./script/lint
44-
44+

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ git interpret-trailers --if-exists doNothing --trailer \
8686

8787
## Development
8888

89-
The Python project is managed using [`rye`](https://rye.astral.sh).
90-
Run the setup script to install Rye and install the project's dependencies.
89+
The Python project is managed using [`uv`](https://uv.astral.sh).
90+
Run the setup script to install uv and install the project's dependencies.
9191

9292
```console
9393
./script/setup

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ dependencies = [
2121
homepage = "https://replicate.com"
2222
repository = "https://github.com/replicate/replicate-python"
2323

24-
[tool]
25-
rye = { dev-dependencies = [
24+
[tool.uv]
25+
dev-dependencies = [
2626
"pytest>=8.1.1",
2727
"pylint>=3.1.0",
2828
"pyright>=1.1.358",
2929
"pytest-asyncio>=0.23.6",
3030
"pytest-recording>=0.13.1",
3131
"respx>=0.21.1",
3232
"ruff>=0.3.7",
33-
] }
33+
]
3434

3535
[tool.pytest.ini_options]
3636
asyncio_mode = "auto"

requirements-dev.lock

Lines changed: 0 additions & 83 deletions
This file was deleted.

requirements.lock

Lines changed: 0 additions & 41 deletions
This file was deleted.

script/format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -e
44

5-
exec rye fmt .
5+
exec uv run -- ruff format "$@"

script/lint

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ set -e
55
STATUS=0
66

77
echo "Running pyright"
8-
rye run pyright replicate || STATUS=$?
8+
uv run pyright replicate || STATUS=$?
99
echo ""
1010

1111
echo "Running pylint"
12-
rye run pylint --exit-zero replicate || STATUS=$?
12+
uv run pylint --exit-zero replicate || STATUS=$?
1313
echo ""
1414

15-
echo "Running rye lint"
16-
rye lint . || STATUS=$?
15+
echo "Running ruff check"
16+
uv run ruff check . || STATUS=$?
1717
echo ""
1818

19-
echo "Running rye fmt --check"
20-
rye fmt --check || STATUS=$?
19+
echo "Running ruff format --check"
20+
uv run ruff format --check || STATUS=$?
2121
echo ""
2222

2323
exit $STATUS

script/setup

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22

33
set -eu
44

5-
: "${RYE_INSTALL_OPTION:='--yes'}"
6-
: "${RYE_VERSION:='latest'}"
5+
: "${UV_INSTALL_OPTION:='--yes'}"
6+
: "${UV_VERSION:='latest'}"
77

8-
if ! command -v rye > /dev/null 2>&1
8+
if ! command -v uv > /dev/null 2>&1
99
then
10-
echo "rye is not installed."
11-
printf "Do you want to install rye? (y/n) "
10+
echo "uv is not installed."
11+
printf "Do you want to install uv? (y/n) "
1212
read -r REPLY
1313
echo # move to a new line
1414
case "$REPLY" in
1515
[yY])
16-
echo "Installing rye..."
17-
curl -sSf https://rye.astral.sh/get | sh
16+
echo "Installing uv..."
17+
curl -LsSf https://astral.sh/uv/install.sh | sh
1818
echo "rye has been successfully installed."
1919
;;
2020
*)
2121
exit 1
2222
;;
2323
esac
2424
else
25-
echo "rye is already installed."
25+
echo "uv is already installed."
2626
fi
2727

28-
exec rye sync
28+
exec uv sync

script/test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -e
44

5-
exec rye test -v
5+
exec uv run -- pytest -v "$@"

0 commit comments

Comments
 (0)