Skip to content

Commit d8b6705

Browse files
authored
Merge pull request #489 from krassowski/v3.2.0
Release 3.2.0 and 1.1.1; improve integrity check for install_requires
2 parents 864efd3 + 8b731da commit d8b6705

File tree

7 files changed

+45
-17
lines changed

7 files changed

+45
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## CHANGELOG
22

3-
### `@krassowski/jupyterlab-lsp 3.2.0` (unreleased)
3+
### `@krassowski/jupyterlab-lsp 3.2.0` (2021-01-24)
44

55
- features:
66

@@ -13,7 +13,7 @@
1313
- workaround was added to enable `jedi-language-server` diagnostics ([#485])
1414
- Julia language server will not crash when saving a non-Julia file: fixed sendSaved notification scope ([#491])
1515

16-
### `jupyter-lsp 1.1.1` (unreleased)
16+
### `jupyter-lsp 1.1.1` (2021-01-24)
1717

1818
- bug fixes:
1919

packages/completion-theme/src/index.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
2323
protected themes: Map<string, ICompletionTheme>;
2424
private current_theme_id: string;
2525
private icons_cache: Map<string, LabIcon>;
26-
private icon_overrides: Record<string, CompletionItemKindStrings>;
26+
private icon_overrides: Map<string, CompletionItemKindStrings>;
2727

2828
constructor(protected themeManager: IThemeManager) {
2929
this.themes = new Map();
3030
this.icons_cache = new Map();
31-
this.icon_overrides = {};
31+
this.icon_overrides = new Map();
3232
themeManager.themeChanged.connect(this.update_icons_set, this);
3333
}
3434

@@ -81,8 +81,8 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
8181
}
8282
let options = this.current_theme.icons.options || {};
8383
if (type) {
84-
if (type in this.icon_overrides) {
85-
type = this.icon_overrides[type];
84+
if (this.icon_overrides.has(type.toLowerCase())) {
85+
type = this.icon_overrides.get(type.toLowerCase());
8686
}
8787
type =
8888
type.substring(0, 1).toUpperCase() + type.substring(1).toLowerCase();
@@ -155,7 +155,12 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
155155
set_icons_overrides(
156156
iconOverrides: Record<string, CompletionItemKindStrings>
157157
) {
158-
this.icon_overrides = iconOverrides;
158+
this.icon_overrides = new Map(
159+
Object.keys(iconOverrides).map(kernelType => [
160+
kernelType.toLowerCase(),
161+
iconOverrides[kernelType]
162+
])
163+
);
159164
}
160165
}
161166

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/jupyterlab-lsp/schema/completion.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"typesMap": {
3636
"title": "Mapping of custom kernel types to valid completion kind names",
37-
"description": "Mapping used for icon selection. Accepted values are the names of CompletionItemKind and 'Kernel' literal. The defaults aim to provide good initial experience for Julia, Python and R kernels.",
37+
"description": "Mapping used for icon selection. The kernel types (keys) are case-insensitive. Accepted values are the names of CompletionItemKind and 'Kernel' literal. The defaults aim to provide good initial experience for Julia, Python and R kernels.",
3838
"type": "object",
3939
"default": {
4040
"<unknown>": "Kernel",

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)