Skip to content

Switch to using uv for project tooling #437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: eifinger/setup-rye@v2
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

Expand All @@ -41,4 +41,4 @@ jobs:

- name: Lint
run: ./script/lint


4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ git interpret-trailers --if-exists doNothing --trailer \

## Development

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

```console
./script/setup
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ dependencies = [
homepage = "https://replicate.com"
repository = "https://github.com/replicate/replicate-python"

[tool]
rye = { dev-dependencies = [
[tool.uv]
dev-dependencies = [
"pytest>=8.1.1",
"pylint>=3.1.0",
"pyright>=1.1.358",
"pytest-asyncio>=0.23.6",
"pytest-recording>=0.13.1",
"respx>=0.21.1",
"ruff>=0.3.7",
] }
]

[tool.pytest.ini_options]
asyncio_mode = "auto"
Expand Down
83 changes: 0 additions & 83 deletions requirements-dev.lock

This file was deleted.

41 changes: 0 additions & 41 deletions requirements.lock

This file was deleted.

2 changes: 1 addition & 1 deletion script/format
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

exec rye fmt .
exec uv run -- ruff format "$@"
12 changes: 6 additions & 6 deletions script/lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ set -e
STATUS=0

echo "Running pyright"
rye run pyright replicate || STATUS=$?
uv run pyright replicate || STATUS=$?
echo ""

echo "Running pylint"
rye run pylint --exit-zero replicate || STATUS=$?
uv run pylint --exit-zero replicate || STATUS=$?
echo ""

echo "Running rye lint"
rye lint . || STATUS=$?
echo "Running ruff check"
uv run ruff check . || STATUS=$?
echo ""

echo "Running rye fmt --check"
rye fmt --check || STATUS=$?
echo "Running ruff format --check"
uv run ruff format --check || STATUS=$?
echo ""

exit $STATUS
18 changes: 9 additions & 9 deletions script/setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

set -eu

: "${RYE_INSTALL_OPTION:='--yes'}"
: "${RYE_VERSION:='latest'}"
: "${UV_INSTALL_OPTION:='--yes'}"
: "${UV_VERSION:='latest'}"

if ! command -v rye > /dev/null 2>&1
if ! command -v uv > /dev/null 2>&1
then
echo "rye is not installed."
printf "Do you want to install rye? (y/n) "
echo "uv is not installed."
printf "Do you want to install uv? (y/n) "
read -r REPLY
echo # move to a new line
case "$REPLY" in
[yY])
echo "Installing rye..."
curl -sSf https://rye.astral.sh/get | sh
echo "Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "rye has been successfully installed."
;;
*)
exit 1
;;
esac
else
echo "rye is already installed."
echo "uv is already installed."
fi

exec rye sync
exec uv sync
2 changes: 1 addition & 1 deletion script/test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -e

exec rye test -v
exec uv run -- pytest -v "$@"
Loading