summaryrefslogtreecommitdiff
blob: 75d26fc45fe47353224a8dc186d4219fbf81b1b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYPI_NO_NORMALIZE=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( pypy3 python3_{10..12} )

inherit distutils-r1 optfeature pypi

DESCRIPTION="Multi-Language Server WebSocket proxy for Jupyter Notebook/Lab"
HOMEPAGE="
	https://github.com/jupyter-lsp/jupyterlab-lsp
	https://pypi.org/project/jupyter-lsp/
"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm arm64 ~loong ppc64 ~riscv x86"

RDEPEND="
	dev-python/entrypoints[${PYTHON_USEDEP}]
	>=dev-python/jupyter-server-1.1.2[${PYTHON_USEDEP}]
"
BDEPEND="
	test? (
		dev-python/pytest-asyncio[${PYTHON_USEDEP}]
	)
"

distutils_enable_tests pytest

python_prepare_all() {
	# Do not depend on pytest-cov or flake8
	sed -i -e '/--cov/d' -e '/--flake8/d' setup.cfg || die

	distutils-r1_python_prepare_all
}

python_test() {
	local EPYTEST_DESELECT=(
		# hangs
		jupyter_lsp/tests/test_auth.py
		# Not packaged
		jupyter_lsp/tests/test_detect.py::test_r_package_detection
		"jupyter_lsp/tests/test_listener.py::test_listeners[bash-language-server]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[dockerfile-language-server-nodejs]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[pylsp]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[r-languageserver]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[sql-language-server]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[typescript-language-server]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[unified-language-server]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[vscode-css-languageserver-bin]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[vscode-html-languageserver-bin]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[vscode-json-languageserver-bin]"
		"jupyter_lsp/tests/test_listener.py::test_listeners[yaml-language-server]"
		"jupyter_lsp/tests/test_session.py::test_start_known[bash-language-server]"
		"jupyter_lsp/tests/test_session.py::test_start_known[dockerfile-language-server-nodejs]"
		"jupyter_lsp/tests/test_session.py::test_start_known[pylsp]"
		"jupyter_lsp/tests/test_session.py::test_start_known[r-languageserver]"
		"jupyter_lsp/tests/test_session.py::test_start_known[sql-language-server]"
		"jupyter_lsp/tests/test_session.py::test_start_known[typescript-language-server]"
		"jupyter_lsp/tests/test_session.py::test_start_known[unified-language-server]"
		"jupyter_lsp/tests/test_session.py::test_start_known[vscode-css-languageserver-bin]"
		"jupyter_lsp/tests/test_session.py::test_start_known[vscode-html-languageserver-bin]"
		"jupyter_lsp/tests/test_session.py::test_start_known[vscode-json-languageserver-bin]"
		"jupyter_lsp/tests/test_session.py::test_start_known[yaml-language-server]"

		# TODO
		'jupyter_lsp/tests/test_session.py::test_start_unknown[foo-language-server]'
		jupyter_lsp/tests/test_session.py::test_substitute_env
	)

	local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
	epytest -p asyncio
}

python_install_all() {
	distutils-r1_python_install_all
	mv "${ED}/usr/etc" "${ED}/etc" || die
}

pkg_postinst() {
	optfeature "Language server for Python" dev-python/python-lsp-server
}