Skip to content

Commit

Permalink
Migrate to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jun 26, 2024
1 parent e9e6363 commit 99c15a3
Show file tree
Hide file tree
Showing 6 changed files with 631 additions and 385 deletions.
23 changes: 6 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,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 +85,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 -- 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

0 comments on commit 99c15a3

Please sign in to comment.