Skip to content

Commit 1a24d9c

Browse files
[chore] Switch to uv (#107)
Why === Consistency with other tooling What changed ============ - Switched to uv from poetry Test plan ========= Does CI work? Does releasing publish a new version with the correct contents?
1 parent e00d75f commit 1a24d9c

File tree

7 files changed

+727
-1015
lines changed

7 files changed

+727
-1015
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,33 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
10+
11+
- name: Install uv
12+
uses: astral-sh/setup-uv@v3
13+
with:
14+
enable-cache: true
15+
1016
- name: Set up Python
11-
uses: actions/setup-python@v4
17+
uses: actions/setup-python@v5
1218
with:
1319
python-version: "3.11"
14-
- name: cache poetry install
15-
uses: actions/cache@v2
16-
with:
17-
path: ~/.local
18-
key: poetry-1.6.1-0
19-
- uses: snok/install-poetry@v1
20-
with:
21-
version: 1.6.1
22-
virtualenvs-create: true
23-
virtualenvs-in-project: true
24-
- name: cache deps
25-
id: cache-deps
26-
uses: actions/cache@v2
27-
with:
28-
path: .venv
29-
key: pydeps-${{ hashFiles('**/poetry.lock') }}
20+
3021
- name: Install dependencies
3122
run: |
32-
poetry install --no-interaction
23+
uv sync --locked
24+
3325
- name: Format check
3426
run: |
35-
poetry run black --check .
27+
uv run black --check .
28+
3629
- name: Lint check
3730
run: |
38-
poetry run ruff .
31+
uv run ruff check .
32+
3933
- name: Type check
4034
run: |
41-
poetry run mypy .
35+
uv run mypy .
36+
4237
- name: Test with pytest
4338
run: |
44-
poetry run pytest tests
39+
uv run pytest tests

.github/workflows/python-publish.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v2
2222

23-
- name: Set up Python
24-
uses: actions/setup-python@v2
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v3
2525
with:
26-
python-version: '3.x'
26+
enable-cache: true
2727

28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install --upgrade poetry
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: "3.11"
3232

3333
- name: Set release version
3434
run: |
@@ -38,12 +38,12 @@ jobs:
3838
fi
3939
version="${tag#v}" # Strip leading v
4040
41-
# Bump poetry tag
42-
poetry version "$version"
41+
# Bump library tag
42+
sed -i'' "s~0.0.0a0~$version~" pyproject.toml
4343
4444
- name: Build and publish
4545
run: |
46-
poetry install
47-
poetry build
48-
POETRY_PYPI_TOKEN_PYPI="${{ secrets.PYPI_TOKEN }}" \
49-
poetry publish
46+
uv sync --locked
47+
uv build
48+
UV_PUBLISH_TOKEN="${{ secrets.PYPI_TOKEN }}" \
49+
uv publish

Dockerfile

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

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
};
2020
packages = replitNixDeps ++ [
2121
pkgs.python311
22-
pkgs.poetry
22+
pkgs.uv
2323
];
2424
};
2525
in

poetry.lock

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

pyproject.toml

Lines changed: 30 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,41 @@
1-
[build-system]
2-
requires = ["poetry-core"]
3-
build-backend = "poetry.core.masonry.api"
4-
5-
[tool.poetry]
1+
[project]
62
name="replit-river"
73
version="0.0.0a0"
84
description="Replit river toolkit for Python"
9-
authors = ["Replit <[email protected]>"]
10-
license = "LICENSE"
5+
authors = [{ name = "Replit", email = "[email protected]" }]
6+
license = { file = "LICENSE" }
117
keywords = ["rpc", "websockets"]
128
readme = "README.md"
9+
requires-python = ">=3.11"
10+
dependencies = [
11+
"pydantic==2.9.2",
12+
"aiochannel>=1.2.1",
13+
"black>=23.11,<25.0",
14+
"grpcio-tools>=1.59.3",
15+
"grpcio>=1.59.3",
16+
"msgpack-types>=0.3.0",
17+
"msgpack>=1.0.7",
18+
"nanoid>=2.0.0",
19+
"protobuf>=4.24.4",
20+
"pydantic-core>=2.20.1",
21+
"websockets>=12.0",
22+
]
1323

14-
[tool.poetry.scripts]
15-
river-codegen-py = "replit_river.codegen.run:main"
16-
17-
[tool.poetry.dependencies]
18-
python = "^3.11"
19-
grpcio = "^1.59.3"
20-
grpcio-tools = "^1.59.3"
21-
protobuf = "^4.24.4"
22-
black = ">=23.11,<25.0"
23-
msgpack = "^1.0.7"
24-
aiochannel = "^1.2.1"
25-
nanoid = "^2.0.0"
26-
websockets = "^12.0"
27-
pydantic-core = "^2.20.1"
28-
msgpack-types = "^0.3.0"
29-
pydantic = "=2.9.2"
30-
31-
[tool.poetry.group.dev.dependencies]
32-
pytest = "^7.4.0"
33-
mypy = "^1.4.0"
34-
black = ">=23.3,<25.0"
35-
pytest-cov = "^4.1.0"
36-
ruff = "^0.0.278"
37-
38-
pytest-mock = "^3.11.1"
39-
pytest-asyncio = "^0.21.1"
40-
types-protobuf = "^4.24.0.20240311"
41-
mypy-protobuf = "^3.5.0"
42-
deptry = "^0.14.0"
24+
[tool.uv]
25+
dev-dependencies = [
26+
"deptry>=0.14.0",
27+
"mypy>=1.4.0",
28+
"mypy-protobuf>=3.5.0",
29+
"pytest>=7.4.0",
30+
"pytest-asyncio>=0.21.1",
31+
"pytest-cov>=4.1.0",
32+
"pytest-mock>=3.11.1",
33+
"ruff>=0.0.278",
34+
"types-protobuf>=4.24.0.20240311",
35+
]
4336

4437
[tool.ruff]
45-
select = ["F", "E", "W", "I001"]
38+
lint.select = ["F", "E", "W", "I001"]
4639

4740
# Should be kept in sync with mypy.ini in the project root.
4841
# The VSCode mypy extension can only read /mypy.ini.

0 commit comments

Comments
 (0)