Skip to content

Commit

Permalink
[chore] Switch to uv (#107)
Browse files Browse the repository at this point in the history
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?
  • Loading branch information
blast-hardcheese authored Nov 7, 2024
1 parent e00d75f commit 1a24d9c
Show file tree
Hide file tree
Showing 7 changed files with 727 additions and 1,015 deletions.
39 changes: 17 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: cache poetry install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-1.6.1-0
- uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
run: |
poetry install --no-interaction
uv sync --locked
- name: Format check
run: |
poetry run black --check .
uv run black --check .
- name: Lint check
run: |
poetry run ruff .
uv run ruff check .
- name: Type check
run: |
poetry run mypy .
uv run mypy .
- name: Test with pytest
run: |
poetry run pytest tests
uv run pytest tests
26 changes: 13 additions & 13 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jobs:
steps:
- uses: actions/checkout@v2

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

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

- name: Set release version
run: |
Expand All @@ -38,12 +38,12 @@ jobs:
fi
version="${tag#v}" # Strip leading v
# Bump poetry tag
poetry version "$version"
# Bump library tag
sed -i'' "s~0.0.0a0~$version~" pyproject.toml
- name: Build and publish
run: |
poetry install
poetry build
POETRY_PYPI_TOKEN_PYPI="${{ secrets.PYPI_TOKEN }}" \
poetry publish
uv sync --locked
uv build
UV_PUBLISH_TOKEN="${{ secrets.PYPI_TOKEN }}" \
uv publish
20 changes: 0 additions & 20 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
};
packages = replitNixDeps ++ [
pkgs.python311
pkgs.poetry
pkgs.uv
];
};
in
Expand Down
922 changes: 0 additions & 922 deletions poetry.lock

This file was deleted.

67 changes: 30 additions & 37 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,48 +1,41 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
[project]
name="replit-river"
version="0.0.0a0"
description="Replit river toolkit for Python"
authors = ["Replit <[email protected]>"]
license = "LICENSE"
authors = [{ name = "Replit", email = "[email protected]" }]
license = { file = "LICENSE" }
keywords = ["rpc", "websockets"]
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"pydantic==2.9.2",
"aiochannel>=1.2.1",
"black>=23.11,<25.0",
"grpcio-tools>=1.59.3",
"grpcio>=1.59.3",
"msgpack-types>=0.3.0",
"msgpack>=1.0.7",
"nanoid>=2.0.0",
"protobuf>=4.24.4",
"pydantic-core>=2.20.1",
"websockets>=12.0",
]

[tool.poetry.scripts]
river-codegen-py = "replit_river.codegen.run:main"

[tool.poetry.dependencies]
python = "^3.11"
grpcio = "^1.59.3"
grpcio-tools = "^1.59.3"
protobuf = "^4.24.4"
black = ">=23.11,<25.0"
msgpack = "^1.0.7"
aiochannel = "^1.2.1"
nanoid = "^2.0.0"
websockets = "^12.0"
pydantic-core = "^2.20.1"
msgpack-types = "^0.3.0"
pydantic = "=2.9.2"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.0"
mypy = "^1.4.0"
black = ">=23.3,<25.0"
pytest-cov = "^4.1.0"
ruff = "^0.0.278"

pytest-mock = "^3.11.1"
pytest-asyncio = "^0.21.1"
types-protobuf = "^4.24.0.20240311"
mypy-protobuf = "^3.5.0"
deptry = "^0.14.0"
[tool.uv]
dev-dependencies = [
"deptry>=0.14.0",
"mypy>=1.4.0",
"mypy-protobuf>=3.5.0",
"pytest>=7.4.0",
"pytest-asyncio>=0.21.1",
"pytest-cov>=4.1.0",
"pytest-mock>=3.11.1",
"ruff>=0.0.278",
"types-protobuf>=4.24.0.20240311",
]

[tool.ruff]
select = ["F", "E", "W", "I001"]
lint.select = ["F", "E", "W", "I001"]

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

0 comments on commit 1a24d9c

Please sign in to comment.