Skip to content

Commit

Permalink
switch to uv, bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Oct 15, 2024
1 parent 84d4289 commit 078f616
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 36 deletions.
18 changes: 8 additions & 10 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
---

name: Setup - Install poetry, python, and dependencies
name: Setup - Install uv, python, and dependencies
description: This action contains some setup steps that are common to several workflows
runs:
using: "composite"
steps:
- name: Install poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry self add poetry-exec-plugin
shell: bash
- name: Install uv
uses: astral-sh/setup-uv@v2
with:
enable-cache: true
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.12
# attempt to restore dependencies from cache (if successful, the following `poetry install` will be a no-op)
cache: poetry
python-version-file: "pyproject.toml"
- name: Install Python dependencies
run: poetry install
run: uv sync --all-extras --dev
shell: bash
12 changes: 6 additions & 6 deletions .github/workflows/tests-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install poetry, python, and dependencies
- name: Install uv, python, and dependencies
uses: ./.github/actions/setup
- name: Linting with ruff
run: poetry run ruff check . --output-format=github
run: uvx ruff check . --output-format=github
- name: Check formatting with ruff
run: poetry run ruff format --check .
run: uvx ruff format --check .
- name: Linting with mypy
run: poetry run mypy .
run: uvx mypy .

tests:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install poetry, python, and dependencies
- name: Install uv, python, and dependencies
uses: ./.github/actions/setup
- name: unittests
run: poetry run pytest tests/
run: uvx pytest tests/
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.5
rev: v0.6.9
hooks:
- id: ruff
args: [
Expand All @@ -15,7 +15,7 @@ repos:
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ['--maxkb=1000']
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ Replace `your-pkg` / `your_pkg` at these places:
## Quick Start

```bash
curl -sSL https://install.python-poetry.org | python3 -
poetry self add poetry-exec-plugin
poetry install
poetry shell
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync --all-extras --dev
source .venv/bin/activate
pre-commit install
```
29 changes: 15 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
[tool.poetry]
[project]
name = "your-pkg"
version = "0.1.0"
description = "Add a description here"
authors = ["Johannes Nussbaum <[email protected]>"]
authors = [{name = "Johannes Nussbaum", email = "[email protected]"}]
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"loguru>=0.7.2",
]


[tool.poetry.dependencies]
python = "^3.12"
loguru = "^0.7.2"


[tool.poetry.group.dev.dependencies]
pytest = "^8.2.1"
mypy = "^1.10.0"
ruff = "^0.4.5"
pre-commit = "^3.7.0"
[tool.uv]
dev-dependencies = [
"pytest>=8.2.1",
"mypy>=1.11.2",
"ruff>=0.6.9",
"pre-commit>=3.8.0",
]


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"


[tool.pytest.ini_options]
Expand Down

0 comments on commit 078f616

Please sign in to comment.