Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 1f15d50a authored by Martin Fischer's avatar Martin Fischer Committed by GitHub
Browse files

Merge pull request #783 from not-my-profile/pyrightconfig.json

[enh] add pyrightconfig.json and integrate pyright into CI
parents 61853aa0 309147d8
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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"
+4 −1
Original line number Diff line number Diff line
# 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/

.nvm_packages

deleted100644 → 0
+0 −8
Original line number Diff line number Diff line
# -*- 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
+3 −3
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
@@ -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[@]}"
Loading