Skip to content

Commit

Permalink
Merge pull request #489 from krassowski/v3.2.0
Browse files Browse the repository at this point in the history
Release 3.2.0 and 1.1.1; improve integrity check for install_requires
  • Loading branch information
krassowski authored Jan 24, 2021
2 parents 864efd3 + 8b731da commit d8b6705
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 17 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## CHANGELOG

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

- features:

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

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

- bug fixes:

Expand Down
15 changes: 10 additions & 5 deletions packages/completion-theme/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
protected themes: Map<string, ICompletionTheme>;
private current_theme_id: string;
private icons_cache: Map<string, LabIcon>;
private icon_overrides: Record<string, CompletionItemKindStrings>;
private icon_overrides: Map<string, CompletionItemKindStrings>;

constructor(protected themeManager: IThemeManager) {
this.themes = new Map();
this.icons_cache = new Map();
this.icon_overrides = {};
this.icon_overrides = new Map();
themeManager.themeChanged.connect(this.update_icons_set, this);
}

Expand Down Expand Up @@ -81,8 +81,8 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
}
let options = this.current_theme.icons.options || {};
if (type) {
if (type in this.icon_overrides) {
type = this.icon_overrides[type];
if (this.icon_overrides.has(type.toLowerCase())) {
type = this.icon_overrides.get(type.toLowerCase());
}
type =
type.substring(0, 1).toUpperCase() + type.substring(1).toLowerCase();
Expand Down Expand Up @@ -155,7 +155,12 @@ export class CompletionThemeManager implements ILSPCompletionThemeManager {
set_icons_overrides(
iconOverrides: Record<string, CompletionItemKindStrings>
) {
this.icon_overrides = iconOverrides;
this.icon_overrides = new Map(
Object.keys(iconOverrides).map(kernelType => [
kernelType.toLowerCase(),
iconOverrides[kernelType]
])
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/jupyterlab-lsp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@krassowski/jupyterlab-lsp",
"version": "3.1.0",
"version": "3.2.0",
"description": "Language Server Protocol integration for JupyterLab",
"keywords": [
"jupyter",
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyterlab-lsp/schema/completion.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"typesMap": {
"title": "Mapping of custom kernel types to valid completion kind names",
"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.",
"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.",
"type": "object",
"default": {
"<unknown>": "Kernel",
Expand Down
2 changes: 1 addition & 1 deletion packages/metapackage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@krassowski/jupyterlab-lsp-metapackage",
"version": "3.1.0",
"version": "3.2.0",
"description": "JupyterLab LSP - Meta Package. All of the packages used by JupyterLab LSP",
"homepage": "https://github.com/krassowski/jupyterlab-lsp",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion python_packages/jupyter_lsp/jupyter_lsp/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
""" single source of truth for jupyter_lsp version
"""
__version__ = "1.1.0"
__version__ = "1.1.1"
35 changes: 29 additions & 6 deletions scripts/integrity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
import tempfile
from configparser import ConfigParser
from importlib.util import find_spec
from typing import Dict
from warnings import warn

import jsonschema
import nbformat
import pytest
from nbconvert.preprocessors import ExecutePreprocessor
from packaging.requirements import Requirement
from packaging.specifiers import SpecifierSet
from packaging.version import Version

try:
Expand Down Expand Up @@ -225,18 +229,37 @@ def test_contributing_versions(the_contributing_doc, the_binder_env, pkg):


@pytest.mark.parametrize(
"pkg,requirement,spec",
"pkg,requirement,version,has_specifier",
[
[PY_FRONT_PATH, "jupyter_lsp", f">={PY_SERVER_VERSION}"],
[PY_FRONT_PATH, "jupyterlab", LAB_SPEC],
[PY_SERVER_PATH, "jupyter_server", REQUIRED_JUPYTER_SERVER],
[PY_FRONT_PATH, "jupyter_lsp", PY_SERVER_VERSION, False],
[PY_FRONT_PATH, "jupyterlab", LAB_SPEC, True],
[PY_SERVER_PATH, "jupyter_server", REQUIRED_JUPYTER_SERVER, True],
],
)
def test_install_requires(pkg, requirement, spec):
def test_install_requires(pkg, requirement: str, version: str, has_specifier: bool):
"""are python packages requirements consistent with other versions?"""
config = ConfigParser()
config.read(pkg / "setup.cfg")
assert f"{requirement} {spec}" in config["options"]["install_requires"]
requirements: Dict[str, Requirement] = {
requirement.name: requirement
for line in config["options"]["install_requires"].splitlines()
if line.strip()
for requirement in [Requirement(line)]
}
assert requirement in requirements
parsed_specifier = str(requirements[requirement].specifier)
raw_specifier = version if has_specifier else f">={version}"
expected_specifier = str(SpecifierSet(raw_specifier))

if has_specifier:
assert expected_specifier == parsed_specifier
else:
assert Version(version) in requirements[requirement].specifier
if expected_specifier != parsed_specifier:
warn(
f"Version matches, but specifier might need updating:"
f" {requirement} {parsed_specifier}; version: {version}"
)


def check_integrity():
Expand Down

0 comments on commit d8b6705

Please sign in to comment.