Skip to content
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

Migrate to uv's preview APIs #443

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
24 changes: 7 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

env:
RUFF_UNRELEASED_REF: "main"
UV_SYSTEM_PYTHON: "true"

on:
push:
Expand All @@ -21,13 +22,9 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: |
pyproject.toml
requirements.txt
requirements-dev.txt
- uses: hynek/setup-cached-uv@v1
- name: Install dependencies
run: just install
run: just sync
- name: Run checks
run: just check
ruff-versions:
Expand Down Expand Up @@ -89,28 +86,21 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
pyproject.toml
requirements.txt
requirements-dev.txt
- uses: hynek/setup-cached-uv@v1

- name: Install dependencies
run: |
pip install -U pip
just install
run: just sync

- name: Install test Ruff version from PyPI
if: ${{ matrix.ruff-version != env.RUFF_UNRELEASED_REF }}
run: |
pip install ruff==${{ matrix.ruff-version }}
uv pip install --reinstall ruff==${{ matrix.ruff-version }}
ruff --version

- name: "Install test Ruff version from GitHub"
if: ${{ matrix.ruff-version == env.RUFF_UNRELEASED_REF }}
run: |
pip install --force-reinstall git+https://github.com/astral-sh/ruff@${{ matrix.ruff-version }}
pip show ruff
uv pip install --reinstall "ruff @ git+https://github.com/astral-sh/ruff@${{ matrix.ruff-version }}"
ruff version

- name: Run tests
Expand Down
23 changes: 12 additions & 11 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
default: fmt check

lock:
pip-compile --resolver=backtracking --generate-hashes --upgrade -o requirements.txt pyproject.toml
pip-compile --resolver=backtracking --generate-hashes --upgrade --extra dev -o requirements-dev.txt pyproject.toml
uv lock

install:
pip install --no-deps -r requirements.txt
pip install --no-deps -r requirements-dev.txt
upgrade:
uv lock --upgrade

sync:
uv sync --dev

fmt:
ruff check --fix-only ./ruff_lsp ./tests
ruff format ./ruff_lsp ./tests
uv run --dev -- ruff check --fix-only ./ruff_lsp ./tests
uv run --dev -- ruff format ./ruff_lsp ./tests

check:
ruff check ./ruff_lsp ./tests
ruff format --check ./ruff_lsp ./tests
mypy ./ruff_lsp ./tests
uv run --dev -- ruff check ./ruff_lsp ./tests
uv run --dev -- ruff format --check ./ruff_lsp ./tests
uv run --dev -- mypy ./ruff_lsp ./tests

test:
pytest
uv run --dev --verbose -- pytest
15 changes: 5 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ build-backend = "hatchling.build"

[project]
name = "ruff-lsp"
dynamic = ["version"]
version = "0.0.53"
description = "A Language Server Protocol implementation for Ruff."
authors = [
{ name = "Charlie Marsh", email = "[email protected]" },
]
maintainers = [
{ name = "Charlie Marsh", email = "[email protected]" },
]
requires-python = ">=3.7"
requires-python = ">=3.7.9"
license = "MIT"
keywords = ["ruff", "lsp", "language-server", "language-server-protocol", "python"]
classifiers = [
Expand All @@ -34,6 +34,7 @@ classifiers = [
"Topic :: Utilities",
]
urls = { repository = "https://github.com/astral-sh/ruff-lsp" }
scripts = { ruff-lsp = "ruff_lsp.__main__:main" }
dependencies = [
"packaging>=23.1",
"pygls>=1.1.0",
Expand All @@ -42,21 +43,15 @@ dependencies = [
"typing_extensions",
]

[project.optional-dependencies]
dev = [
[tool.uv]
dev-dependencies = [
"mypy==1.4.1",
"pip-tools>=6.13.0,<7.0.0",
"pytest>=7.3.1,<8.0.0",
"pytest-asyncio==0.21.2",
"python-lsp-jsonrpc==1.0.0",
]

[project.scripts]
ruff-lsp = "ruff_lsp.__main__:main"

[tool.hatch.version]
path = "ruff_lsp/__init__.py"

[tool.ruff]
line-length = 88
target-version = "py37"
Expand Down
Loading
Loading