forked from zaclys/searxng
Merge pull request #783 from not-my-profile/pyrightconfig.json
[enh] add pyrightconfig.json and integrate pyright into CI
This commit is contained in:
commit
1f15d50aac
|
@ -32,6 +32,10 @@
|
|||
;; Jedi, flycheck & other python stuff should use the 'python-shell-interpreter'
|
||||
;; from the local py3 environment.
|
||||
;;
|
||||
;; For pyright support you need to install::
|
||||
;;
|
||||
;; M-x package-install lsp-pyright
|
||||
;;
|
||||
;; Other useful jedi stuff you might add to your ~/.emacs::
|
||||
;;
|
||||
;; (global-set-key [f6] 'flycheck-mode)
|
||||
|
@ -104,7 +108,10 @@
|
|||
|
||||
(python-mode
|
||||
. ((eval . (progn
|
||||
|
||||
;; use nodejs from the (local) NVM environment (see nvm-dir)
|
||||
(nvm-use-for-buffer)
|
||||
(if (featurep 'lsp-pyright)
|
||||
(lsp))
|
||||
(setq-local python-environment-virtualenv
|
||||
(list (expand-file-name "bin/virtualenv" python-shell-virtualenv-root)
|
||||
;;"--system-site-packages"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# to sync with .dockerignore
|
||||
# to sync with .dockerignore & pyrightconfig.json
|
||||
|
||||
*.pyc
|
||||
*/*.pyc
|
||||
|
@ -16,3 +16,6 @@ dist/
|
|||
local/
|
||||
gh-pages/
|
||||
*.egg-info/
|
||||
|
||||
/package-lock.json
|
||||
/node_modules/
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
# -*- coding: utf-8; mode: conf-unix -*-
|
||||
#
|
||||
# Developement tools pre-installed in NVM's node installation [1]
|
||||
#
|
||||
# [1] https://github.com/nvm-sh/nvm#default-global-packages-from-file-while-installing
|
||||
|
||||
eslint
|
||||
|
6
Makefile
6
Makefile
|
@ -50,8 +50,8 @@ search.checker.%: install
|
|||
$(Q)./manage pyenv.cmd searx-checker -v "$(subst _, ,$(patsubst search.checker.%,%,$@))"
|
||||
|
||||
PHONY += test ci.test test.shell
|
||||
ci.test: test.yamllint test.black test.pylint test.unit test.robot test.rst
|
||||
test: test.yamllint test.black test.pylint test.unit test.robot test.rst test.shell
|
||||
ci.test: test.yamllint test.black test.pyright test.pylint test.unit test.robot test.rst
|
||||
test: test.yamllint test.black test.pyright test.pylint test.unit test.robot test.rst test.shell
|
||||
test.shell:
|
||||
$(Q)shellcheck -x -s dash \
|
||||
dockerfiles/docker-entrypoint.sh
|
||||
|
@ -86,7 +86,7 @@ MANAGE += py.build py.clean
|
|||
MANAGE += pyenv pyenv.install pyenv.uninstall
|
||||
MANAGE += pypi.upload pypi.upload.test
|
||||
MANAGE += format.python
|
||||
MANAGE += test.yamllint test.pylint test.black test.unit test.coverage test.robot test.rst test.clean
|
||||
MANAGE += test.yamllint test.pylint test.pyright test.black test.unit test.coverage test.robot test.rst test.clean
|
||||
MANAGE += themes.all themes.oscar themes.simple themes.simple.test pygments.less
|
||||
MANAGE += static.build.commit static.build.drop static.build.restore
|
||||
MANAGE += nvm.install nvm.clean nvm.status nvm.nodejs
|
||||
|
|
19
manage
19
manage
|
@ -20,6 +20,8 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils/lib_go.sh"
|
|||
# shellcheck source=utils/lib_redis.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/utils/lib_redis.sh"
|
||||
|
||||
PATH="${REPO_ROOT}/node_modules/.bin:${PATH}"
|
||||
|
||||
# config
|
||||
|
||||
PYOBJECTS="searx"
|
||||
|
@ -103,6 +105,7 @@ format.:
|
|||
test.:
|
||||
yamllint : lint YAML files (YAMLLINT_FILES)
|
||||
pylint : lint PYLINT_FILES, searx/engines, searx & tests
|
||||
pyright : static type check of python sources
|
||||
black : check black code format
|
||||
unit : run unit tests
|
||||
coverage : run unit tests with coverage
|
||||
|
@ -558,6 +561,12 @@ node.env() {
|
|||
dump_return $?
|
||||
}
|
||||
|
||||
node.env.devtools() {
|
||||
nodejs.ensure
|
||||
build_msg INSTALL "package.json: developer and CI tools"
|
||||
npm install
|
||||
}
|
||||
|
||||
node.clean() {
|
||||
if ! required_commands npm 2>/dev/null; then
|
||||
build_msg CLEAN "npm is not installed / ignore npm dependencies"
|
||||
|
@ -682,6 +691,16 @@ test.pylint() {
|
|||
dump_return $?
|
||||
}
|
||||
|
||||
test.pyright() {
|
||||
build_msg TEST "[pyright] static type check of python sources"
|
||||
node.env.devtools
|
||||
# We run Pyright in the virtual environment because Pyright
|
||||
# executes "python" to determine the Python version.
|
||||
pyenv.cmd npx --no-install pyright -p pyrightconfig-ci.json
|
||||
dump_return $?
|
||||
}
|
||||
|
||||
|
||||
test.black() {
|
||||
build_msg TEST "[black] \$BLACK_TARGETS"
|
||||
pyenv.cmd black --check --diff "${BLACK_OPTIONS[@]}" "${BLACK_TARGETS[@]}"
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"eslint": "^8.7.0",
|
||||
"pyright": "^1.1.212"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"venvPath": "local",
|
||||
"venv": "py3",
|
||||
"include": [
|
||||
"searx",
|
||||
"searxng_extra",
|
||||
"tests"
|
||||
],
|
||||
"typeCheckingMode": "off"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"venvPath": "local",
|
||||
"venv": "py3",
|
||||
"include": [
|
||||
"searx",
|
||||
"searxng_extra",
|
||||
"tests"
|
||||
]
|
||||
}
|
|
@ -117,7 +117,9 @@ nvm.install() {
|
|||
info_msg "checkout ${NVM_VERSION_TAG}"
|
||||
git checkout "${NVM_VERSION_TAG}" 2>&1 | prefix_stdout " ${_Yellow}||${_creset} "
|
||||
popd &> /dev/null
|
||||
cp "${REPO_ROOT}/.nvm_packages" "${NVM_DIR}/default-packages"
|
||||
if [ -f "${REPO_ROOT}/.nvm_packages" ]; then
|
||||
cp "${REPO_ROOT}/.nvm_packages" "${NVM_DIR}/default-packages"
|
||||
fi
|
||||
nvm.env
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue