From b217549ed0b1aa2a87fb47b49402b1b7c5a478cf Mon Sep 17 00:00:00 2001 From: Marko Toplak Date: Fri, 22 Dec 2023 13:51:39 +0100 Subject: [PATCH 1/4] update tests to orange-ci-cd --- .github/workflows/test.yml | 110 ++++--------------------------------- tox.ini | 14 ++--- 2 files changed, 17 insertions(+), 107 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b23ba0a03..9183e0bf0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,104 +7,16 @@ on: pull_request: branches: - master - workflow_dispatch: - schedule: - - cron: '0 6 1 * *' jobs: - build: - runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.experimental }} - timeout-minutes: 20 - name: ${{ matrix.name }} (${{ matrix.os }}, ${{ matrix.python-version }}) - strategy: - fail-fast: false - matrix: - os: [ubuntu-20.04, macos-11, windows-2019] - python-version: [3.8, 3.9] - tox_env: [py-orange-released] - experimental: [false] - name: [Released] - include: - - os: ubuntu-20.04 - python-version: 3.9 - tox_env: py-orange-dask - name: Dask - experimental: false - - - os: windows-2019 - python-version: 3.8 - tox_env: py-orange-oldest - experimental: false - name: Oldest - - os: macos-11 - python-version: 3.8 - tox_env: py-orange-oldest - name: Oldest - experimental: false - - os: ubuntu-20.04 - python-version: 3.8 - tox_env: py-orange-oldest - name: Oldest - experimental: false - - - os: windows-2019 - python-version: 3.9 - tox_env: py-orange-latest - experimental: false - name: Latest - - os: macos-11 - python-version: 3.9 - tox_env: py-orange-latest - experimental: false - name: Latest - - os: ubuntu-20.04 - python-version: 3.9 - tox_env: py-orange-latest - experimental: false - name: Latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install linux system dependencies - if: | - matrix.os == 'ubuntu-20.04' - run: | - sudo apt-get update - sudo apt-get install -y libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libegl1-mesa libxcb-shape0 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install --upgrade tox - - - name: Set environment variable - # this step sets QT_QPA_PLATFORM env which is required on Ubuntu and - # it is skipped on Windows - QLabel font issues - if: runner.os != 'Windows' - run: | - echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV - - - name: Test with Tox - run: | - tox -e ${{ matrix.tox_env }} - env: - # Raise deprecations as errors in our tests only when testing orange-oldest and orange-released. - ORANGE_DEPRECATIONS_ERROR: "${{ matrix.tox_env != 'py-orange-latest' && '1' || '' }}" - # Need this otherwise unittest installs a warning filter that overrides - # our desire to have OrangeDeprecationWarnings raised - PYTHONWARNINGS: module - - - name: Upload code coverage - if: | - matrix.python-version == '3.9' && - matrix.os == 'ubuntu-20.04' && - matrix.tox_env == 'py-orange-dask' - uses: codecov/codecov-action@v3 - with: - fail_ci_if_error: true + normal: + name: Usual + uses: biolab/orange-ci-cd/.github/workflows/test-addons.yml@master + dask: + name: Dask + uses: biolab/orange-ci-cd/.github/workflows/test-job.yml@master + with: + os: ubuntu-latest + python-version: '3.10' + tox_env: dask + pyqt: '5.15.*' diff --git a/tox.ini b/tox.ini index 9e59a56a4..663cec2a1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,12 @@ [tox] envlist = - py{38,39}-orange-{oldest, latest, released} + orange-{oldest, latest, released} pylint-ci skip_missing_interpreters = true isolated_build = true -toxworkdir={env:TOX_WORK_DIR:.tox} [testenv] -# must use latest pip (version 20.3.1 enables Big Sur support - https://github.com/pypa/pip/issues/9138) -pip_version = pip +download = true extras = test passenv = * # we MUST changedir to avoid installed being shadowed by working dir @@ -21,8 +19,8 @@ setenv = COVERAGE_FILE = {toxinidir}/.coverage COVERAGE_RCFILE = {toxinidir}/.coveragerc deps = - pyqt5==5.12.* - pyqtwebengine==5.12.* + {env:PYQT_PYPI_NAME:PyQt5}=={env:PYQT_PYPI_VERSION:5.15.*} + {env:WEBENGINE_PYPI_NAME:PyQtWebEngine}=={env:WEBENGINE_PYPI_VERSION:5.15.*} oldest: orange3==3.34.0 oldest: orange-canvas-core==0.1.28 oldest: orange-widget-base==4.19.0 @@ -37,10 +35,10 @@ deps = latest: https://github.com/biolab/orange-canvas-core/archive/refs/heads/master.zip#egg=orange-canvas-core latest: https://github.com/biolab/orange-widget-base/archive/refs/heads/master.zip#egg=orange-widget-base opusFC - # temporary util the new Orange is released - pandas<2.1 dask: https://github.com/biolab/orange3/archive/refs/heads/dask.zip#egg=orange3 commands_pre = + # check pip version in virtualenv + pip --version # Verify installed packages have compatible dependencies pip check # freeze environment From 5d77cf488efc93e8c6a9c8304591498cf8405907 Mon Sep 17 00:00:00 2001 From: Marko Toplak Date: Wed, 10 Jan 2024 13:15:26 +0100 Subject: [PATCH 2/4] simplify lint action --- .github/workflows/lint_workflow.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint_workflow.yml b/.github/workflows/lint_workflow.yml index 65b8c62d6..e977eff1c 100644 --- a/.github/workflows/lint_workflow.yml +++ b/.github/workflows/lint_workflow.yml @@ -1,7 +1,6 @@ name: Lint workflow on: - # Trigger the workflow on push or pull request, but only for the master branch push: branches: - master @@ -11,13 +10,7 @@ on: jobs: build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: False - matrix: - python: [3.8] - os: [ubuntu-20.04] - + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: @@ -25,7 +18,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v1 with: - python-version: ${{ matrix.python }} + python-version: '3.10' - name: Install Tox run: pip install tox From 7823881dfbb9405fe8a592093b760b8bb6888246 Mon Sep 17 00:00:00 2001 From: Marko Toplak Date: Wed, 10 Jan 2024 13:19:41 +0100 Subject: [PATCH 3/4] update check_pylint_diff.sh to orange3 version --- .github/workflows/check_pylint_diff.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_pylint_diff.sh b/.github/workflows/check_pylint_diff.sh index 0306be4e8..b53aae6eb 100755 --- a/.github/workflows/check_pylint_diff.sh +++ b/.github/workflows/check_pylint_diff.sh @@ -15,7 +15,7 @@ UNCOMMITED_PATCH="$TMP_REPO/uncommited.patch" SCRIPT=$(basename "$0") PYLINT="$(command -v pylint 2>/dev/null || true)" RADON="$(command -v radon 2>/dev/null || true)" -PYLINT_ARGS="--output-format=parseable" +PYLINT_ARGS="--msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}'" RADON_ARGS='cc --min C --no-assert --show-closures --show-complexity --average' trap "status=\$?; cd '$GIT_REPO'; rm -rf '$TMP_REPO'; exit \$status" EXIT @@ -127,7 +127,7 @@ Number_of_issues () cached="$1" { cat "$cached" 2>/dev/null || echo "$CHANGED_FILES" | - xargs "$PYLINT" $PYLINT_ARGS | + xargs "$PYLINT" "$PYLINT_ARGS" | tee "$cached" } | awk -F'[\\. ]' '/^Your code has been rated at /{ print $7 }' || true } From c5cf987bc36fc54d76500f4590b93abfda98a61c Mon Sep 17 00:00:00 2001 From: Marko Toplak Date: Wed, 10 Jan 2024 13:26:26 +0100 Subject: [PATCH 4/4] update pylintrc to orange3 version --- pylintrc | 75 +++++++++++--------------------------------------------- 1 file changed, 14 insertions(+), 61 deletions(-) diff --git a/pylintrc b/pylintrc index b74f71413..02e76ac05 100644 --- a/pylintrc +++ b/pylintrc @@ -16,7 +16,7 @@ persistent=yes # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. -load-plugins= +load-plugins=pylint.extensions.eq_without_hash # Use multiple processes to speed up Pylint. jobs=0 @@ -28,16 +28,7 @@ unsafe-load-any-extension=no # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code -extension-pkg-whitelist= - -# Allow optimization of some AST trees. This will activate a peephole AST -# optimizer, which will apply various small optimizations. For instance, it can -# be used to obtain the result of joining multiple strings with the addition -# operator. Joining a lot of strings can lead to a maximum recursion error in -# Pylint and this flag can prevent that. It has one side effect, the resulting -# AST will be different than the one from reality. -optimize-ast=no - +extension-pkg-whitelist=Orange.distance._distance,Orange.data._variable,numpy.random.mtrand [MESSAGES CONTROL] @@ -60,19 +51,12 @@ confidence= # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" disable= - global-statement,unnecessary-lambda,arguments-differ,unused-argument, - no-self-use,fixme,no-name-in-module,no-member, - round-builtin,next-method-called,cmp-builtin,filter-builtin-not-iterating, - nonzero-method,old-division,input-builtin,intern-builtin, - map-builtin-not-iterating,suppressed-message,buffer-builtin, - unpacking-in-except,no-absolute-import,range-builtin-not-iterating, - coerce-method,zip-builtin-not-iterating,reload-builtin, - standarderror-builtin,import-star-module-level,old-octal-literal, - metaclass-assignment,reduce-builtin,indexing-exception, - parameter-unpacking,long-suffix,cmp-method,using-cmp-argument, - useless-suppression,import-error, - empty-docstring,missing-docstring,redefined-outer-name,redefined-builtin, - attribute-defined-outside-init, no-else-return, len-as-condition, invalid-sequence-index + missing-docstring, # I guess not + no-name-in-module, no-member, # too many false positives from Qt + import-error, # false positives, and we don't expect any true positives + too-many-ancestors, # I don't think this is a problem + no-else-return, # else's may actually improve readability + duplicate-code # too strict; we're disciplined and don't do this by mistake [REPORTS] @@ -82,11 +66,6 @@ disable= # mypackage.mymodule.MyReporterClass. output-format=text -# Put messages in a separate file for each module / package specified on the -# command line instead of printing them on stdout. Reports (if any) will be -# written in a file name "pylint_global.[txt|html]". -files-output=no - # Tells whether to display a full report or only the messages reports=yes @@ -114,12 +93,6 @@ ignore-long-lines=^\s*(# )??$ # else. single-line-if-stmt=yes -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma,dict-separator - # Maximum number of lines in a module max-module-lines=1000 @@ -170,7 +143,7 @@ ignore-comments=yes ignore-docstrings=yes # Ignore imports when computing similarities. -ignore-imports=no +ignore-imports=yes [VARIABLES] @@ -193,9 +166,6 @@ callbacks=cb_,_cb,on_,_on_ [BASIC] -# List of builtins function names that should not be used, separated by a comma -bad-functions=print - # Good variable names which should always be accepted, separated by a comma good-names=ex,Run,_,a,c,d,e,i,j,k,m,n,o,p,t,u,v,w,x,y,A,X,Y,M @@ -212,53 +182,33 @@ include-naming-hint=yes # Regular expression matching correct method names # TODO: find a better way to allow long method names in test classes. method-rgx=[a-z_][a-zA-Z0-9_]{2,80}$ -# Naming hint for method names -method-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$ # Regular expression matching correct class names class-rgx=[A-Z_][a-zA-Z0-9]{2,30}$ -# Naming hint for class names -class-name-hint=[A-Z_][a-zA-Z0-9]{2,30}$ # Regular expression matching correct module names module-rgx=([a-z_][a-z0-9_]{2,30})$ -# Naming hint for module names -module-name-hint=([a-z_][a-z0-9_]{2,30})$ # Regular expression matching correct class attribute names class-attribute-rgx=[A-Za-z_][A-Za-z0-9_]{2,30}$ -# Naming hint for class attribute names -class-attribute-name-hint=[A-Za-z_][A-Za-z0-9_]{2,30}$ # Regular expression matching correct constant names const-rgx=[A-Za-z_][A-Za-z0-9_]+$ -# Naming hint for constant names -const-name-hint=[A-Za-z_][A-Za-z0-9_]+$ # Regular expression matching correct function names function-rgx=[a-z_][a-zA-Z0-9_]{2,30}$ -# Naming hint for function names -function-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$ # Regular expression matching correct variable names variable-rgx=[a-zA-Z_][a-zA-Z0-9_]{0,30}$ -# Naming hint for variable names -variable-name-hint=[a-zA-Z_][a-zA-Z0-9_]{0,30}$ # Regular expression matching correct attribute names attr-rgx=[a-z_][a-zA-Z0-9_]*$ -# Naming hint for attribute names -attr-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$ # Regular expression matching correct inline iteration names inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ -# Naming hint for inline iteration names -inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ # Regular expression matching correct argument names argument-rgx=[a-z_][a-zA-Z0-9_]*$ -# Naming hint for argument names -argument-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$ # Regular expression which should only match function or class names that do # not require a docstring. @@ -279,7 +229,7 @@ max-nested-blocks=5 # Tells whether missing members accessed in mixin class should be ignored. A # mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes +ignored-checks-for-mixins=no-member # List of module names for which member attributes should not be checked # (useful for modules/projects where namespaces are manipulated during runtime @@ -379,4 +329,7 @@ int-import-graph= # Exceptions that will emit a warning when being caught. Defaults to # "Exception" -overgeneral-exceptions=Exception +overgeneral-exceptions=builtins.Exception + +[isort] +known-standard-library=