Skip to content

Commit 2388830

Browse files
committed
Release 3.2.0 and 1.1.1; improve integrity check for install_requires
1 parent 864efd3 commit 2388830

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

packages/jupyterlab-lsp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@krassowski/jupyterlab-lsp",
3-
"version": "3.1.0",
3+
"version": "3.2.0",
44
"description": "Language Server Protocol integration for JupyterLab",
55
"keywords": [
66
"jupyter",

packages/metapackage/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@krassowski/jupyterlab-lsp-metapackage",
3-
"version": "3.1.0",
3+
"version": "3.2.0",
44
"description": "JupyterLab LSP - Meta Package. All of the packages used by JupyterLab LSP",
55
"homepage": "https://github.com/krassowski/jupyterlab-lsp",
66
"bugs": {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
""" single source of truth for jupyter_lsp version
22
"""
3-
__version__ = "1.1.0"
3+
__version__ = "1.1.1"

scripts/integrity.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@
1010
import tempfile
1111
from configparser import ConfigParser
1212
from importlib.util import find_spec
13+
from typing import Dict
14+
from warnings import warn
1315

1416
import jsonschema
1517
import nbformat
1618
import pytest
1719
from nbconvert.preprocessors import ExecutePreprocessor
20+
from packaging.requirements import Requirement
21+
from packaging.specifiers import SpecifierSet
1822
from packaging.version import Version
1923

2024
try:
@@ -225,18 +229,37 @@ def test_contributing_versions(the_contributing_doc, the_binder_env, pkg):
225229

226230

227231
@pytest.mark.parametrize(
228-
"pkg,requirement,spec",
232+
"pkg,requirement,version,has_specifier",
229233
[
230-
[PY_FRONT_PATH, "jupyter_lsp", f">={PY_SERVER_VERSION}"],
231-
[PY_FRONT_PATH, "jupyterlab", LAB_SPEC],
232-
[PY_SERVER_PATH, "jupyter_server", REQUIRED_JUPYTER_SERVER],
234+
[PY_FRONT_PATH, "jupyter_lsp", PY_SERVER_VERSION, False],
235+
[PY_FRONT_PATH, "jupyterlab", LAB_SPEC, True],
236+
[PY_SERVER_PATH, "jupyter_server", REQUIRED_JUPYTER_SERVER, True],
233237
],
234238
)
235-
def test_install_requires(pkg, requirement, spec):
239+
def test_install_requires(pkg, requirement: str, version: str, has_specifier: bool):
236240
"""are python packages requirements consistent with other versions?"""
237241
config = ConfigParser()
238242
config.read(pkg / "setup.cfg")
239-
assert f"{requirement} {spec}" in config["options"]["install_requires"]
243+
requirements: Dict[str, Requirement] = {
244+
requirement.name: requirement
245+
for line in config["options"]["install_requires"].splitlines()
246+
if line.strip()
247+
for requirement in [Requirement(line)]
248+
}
249+
assert requirement in requirements
250+
parsed_specifier = str(requirements[requirement].specifier)
251+
raw_specifier = version if has_specifier else f">={version}"
252+
expected_specifier = str(SpecifierSet(raw_specifier))
253+
254+
if has_specifier:
255+
assert expected_specifier == parsed_specifier
256+
else:
257+
assert Version(version) in requirements[requirement].specifier
258+
if expected_specifier != parsed_specifier:
259+
warn(
260+
f"Version matches, but specifier might need updating:"
261+
f" {requirement} {parsed_specifier}; version: {version}"
262+
)
240263

241264

242265
def check_integrity():

0 commit comments

Comments
 (0)