chore(lsprotocol): migrate to 2025.0.0 and cleanup artifacts
The changes align the project with the 2025.0.0 lsprotocol release, removing the old backport and updating type hints in the protocol hooks to use Sequence where appropriate. The dist-info and packaging metadata for older lsprotocol versions are replaced with the new 2025.0.0 artifacts. - Remove exceptiongroup backport used on Python <3.11 - Use Sequence instead of List in LS protocol hooks - Replace old dist-info with 2025.0.0 metadata
This commit is contained in:
+34
-8
@@ -8,7 +8,6 @@ import pathlib
|
||||
import sys
|
||||
import tomllib
|
||||
import urllib.request as url_lib
|
||||
from typing import List
|
||||
|
||||
import nox # pylint: disable=import-error
|
||||
|
||||
@@ -17,7 +16,7 @@ import nox # pylint: disable=import-error
|
||||
nox.options.default_venv_backend = "uv"
|
||||
|
||||
|
||||
def _read_dependencies() -> List[str]:
|
||||
def _read_dependencies() -> list[str]:
|
||||
"""Read project dependencies from pyproject.toml."""
|
||||
pyproject = tomllib.loads(pathlib.Path("pyproject.toml").read_text())
|
||||
return list(pyproject.get("project", {}).get("dependencies", []))
|
||||
@@ -33,16 +32,18 @@ def _install_bundle(session: nox.Session) -> None:
|
||||
"./libs",
|
||||
"--no-cache-dir",
|
||||
"--upgrade",
|
||||
"--overrides",
|
||||
"./uv-overrides.txt",
|
||||
*deps,
|
||||
external=True,
|
||||
)
|
||||
|
||||
|
||||
def _check_files(names: List[str]) -> None:
|
||||
def _check_files(names: list[str]) -> None:
|
||||
root_dir = pathlib.Path(__file__).parent
|
||||
for name in names:
|
||||
file_path = root_dir / name
|
||||
lines: List[str] = file_path.read_text().splitlines()
|
||||
lines: list[str] = file_path.read_text().splitlines()
|
||||
if any(line for line in lines if line.startswith("# TODO:")):
|
||||
raise Exception(f"Please update {os.fspath(file_path)}.")
|
||||
|
||||
@@ -101,7 +102,17 @@ def setup(session: nox.Session) -> None:
|
||||
def tests(session: nox.Session) -> None:
|
||||
"""Runs all the tests for the extension."""
|
||||
deps = _read_dependencies()
|
||||
session.run("uv", "pip", "install", "--python", sys.executable, *deps, external=True)
|
||||
session.run(
|
||||
"uv",
|
||||
"pip",
|
||||
"install",
|
||||
"--python",
|
||||
sys.executable,
|
||||
"--overrides",
|
||||
"./uv-overrides.txt",
|
||||
*deps,
|
||||
external=True,
|
||||
)
|
||||
session.run("uv", "pip", "install", "--python", sys.executable, "pytest", external=True)
|
||||
session.run("pytest", "tests/python_tests")
|
||||
|
||||
@@ -110,7 +121,17 @@ def tests(session: nox.Session) -> None:
|
||||
def lint(session: nox.Session) -> None:
|
||||
"""Runs linter and formatter checks on python files."""
|
||||
deps = _read_dependencies()
|
||||
session.run("uv", "pip", "install", "--python", sys.executable, *deps, external=True)
|
||||
session.run(
|
||||
"uv",
|
||||
"pip",
|
||||
"install",
|
||||
"--python",
|
||||
sys.executable,
|
||||
"--overrides",
|
||||
"./uv-overrides.txt",
|
||||
*deps,
|
||||
external=True,
|
||||
)
|
||||
session.run(
|
||||
"uv",
|
||||
"pip",
|
||||
@@ -161,7 +182,12 @@ def _update_uv_lock(session: nox.Session) -> None:
|
||||
|
||||
|
||||
@nox.session()
|
||||
def update_packages(session: nox.Session) -> None:
|
||||
"""Update Python and npm packages."""
|
||||
def update_python_packages(session: nox.Session) -> None:
|
||||
"""Update Python packages."""
|
||||
_update_uv_lock(session)
|
||||
|
||||
|
||||
@nox.session()
|
||||
def update_npm_packages(session: nox.Session) -> None:
|
||||
"""Update npm packages."""
|
||||
_update_npm_packages(session)
|
||||
|
||||
Reference in New Issue
Block a user