From 487925a4b940da360092fbfe255c7325e0b07333 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 18:27:17 +0100 Subject: [PATCH 01/13] CI improvements from pinning astroid version --- .github/workflows/ci.yaml | 43 ++++---------------------------------- requirements_test_pypy.txt | 2 +- tox.ini | 7 ++++--- 3 files changed, 9 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fa9cbeb8d6..5c59718d16 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,7 +8,7 @@ on: pull_request: ~ env: - CACHE_VERSION: 0 + CACHE_VERSION: 1 DEFAULT_PYTHON: 3.6 PRE_COMMIT_CACHE: ~/.cache/pre-commit @@ -18,7 +18,6 @@ jobs: name: Prepare base dependencies runs-on: ubuntu-latest outputs: - astroid-hash: ${{ steps.fetch-astroid-hash.outputs.hash }} python-key: ${{ steps.generate-python-key.outputs.key }} pre-commit-key: ${{ steps.generate-pre-commit-key.outputs.key }} steps: @@ -29,19 +28,12 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ env.DEFAULT_PYTHON }} - - name: Fetch astroid commit hash - id: fetch-astroid-hash - run: >- - echo "::set-output name=hash::"$( - curl -s https://api.github.com/repos/PyCQA/astroid/branches/master | - grep -E '^ "sha": "(\S*)' | awk '{print substr($0, 13, 40)}') - name: Generate partial Python venv restore key id: generate-python-key run: >- echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', - 'requirements_test_pypy.txt', 'requirements_docs.txt') }}-${{ - steps.fetch-astroid-hash.outputs.hash }}" + 'requirements_test_pypy.txt', 'requirements_docs.txt') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2 @@ -51,9 +43,6 @@ jobs: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', - 'requirements_test_pypy.txt', 'requirements_docs.txt') }}- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-base-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' @@ -61,7 +50,6 @@ jobs: python -m venv venv . venv/bin/activate python -m pip install -U pip setuptools wheel - pip uninstall -y astroid pip install -U -r requirements_test.txt pip install -U -r requirements_docs.txt pip install -e . @@ -193,7 +181,6 @@ jobs: matrix: python-version: [3.6, 3.7, 3.8, 3.9] outputs: - astroid-hash: ${{ steps.fetch-astroid-hash.outputs.hash }} python-key: ${{ steps.generate-python-key.outputs.key }} steps: - name: Check out code from GitHub @@ -203,19 +190,12 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Fetch astroid commit hash - id: fetch-astroid-hash - run: >- - echo "::set-output name=hash::"$( - curl -s https://api.github.com/repos/PyCQA/astroid/branches/master | - grep -E '^ "sha": "(\S*)' | awk '{print substr($0, 13, 40)}') - name: Generate partial Python venv restore key id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', - 'requirements_test_pypy.txt') }}-${{ - steps.fetch-astroid-hash.outputs.hash }}" + 'requirements_test_pypy.txt') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2 @@ -225,9 +205,6 @@ jobs: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', - 'requirements_test_pypy.txt') }}- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' @@ -235,7 +212,6 @@ jobs: python -m venv venv . venv/bin/activate python -m pip install -U pip setuptools wheel - pip uninstall -y astroid pip install -U -r requirements_test.txt pip install -e . @@ -416,7 +392,6 @@ jobs: matrix: python-version: ["pypy3"] outputs: - astroid-hash: ${{ steps.fetch-astroid-hash.outputs.hash }} python-key: ${{ steps.generate-python-key.outputs.key }} steps: - name: Check out code from GitHub @@ -426,18 +401,11 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - name: Fetch astroid commit hash - id: fetch-astroid-hash - run: >- - echo "::set-output name=hash::"$( - curl -s https://api.github.com/repos/PyCQA/astroid/branches/master | - grep -E '^ "sha": "(\S*)' | awk '{print substr($0, 13, 40)}') - name: Generate partial Python venv restore key id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}-${{ - steps.fetch-astroid-hash.outputs.hash }}" + hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2 @@ -447,8 +415,6 @@ jobs: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ steps.generate-python-key.outputs.key }} restore-keys: | - ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}- ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- - name: Create Python virtual environment if: steps.cache-venv.outputs.cache-hit != 'true' @@ -456,7 +422,6 @@ jobs: python -m venv venv . venv/bin/activate python -m pip install -U pip setuptools wheel - pip uninstall -y astroid pip install -U -r requirements_test_pypy.txt pip install -e . diff --git a/requirements_test_pypy.txt b/requirements_test_pypy.txt index b64d5cdf96..9ef5c75f4a 100644 --- a/requirements_test_pypy.txt +++ b/requirements_test_pypy.txt @@ -1,4 +1,4 @@ -astroid @ git+git://github.com/PyCQA/astroid.git@astroid-2.5 +astroid==2.5.0 coveralls coverage<5.0 pytest diff --git a/tox.ini b/tox.ini index 390e11b9dc..681e13a20d 100644 --- a/tox.ini +++ b/tox.ini @@ -6,7 +6,7 @@ skip_missing_interpreters = true [testenv:pylint] deps = - git+https://github.com/pycqa/astroid@master + astroid==2.5.0 pytest commands = # This would be greatly simplified by a solution for https://github.com/PyCQA/pylint/issues/352 @@ -56,7 +56,7 @@ commands = [testenv] deps = - https://github.com/PyCQA/astroid/tarball/master#egg=astroid + astroid==2.5.0 coverage<5.0 mccabe isort @@ -127,7 +127,7 @@ commands = [testenv:benchmark] deps = - https://github.com/PyCQA/astroid/tarball/master#egg=astroid + astroid==2.5.0 coverage<5.0 mccabe pytest @@ -149,6 +149,7 @@ commands = [testenv:profile_against_external] deps = + astroid==2.5.0 https://github.com/PyCQA/astroid/tarball/master#egg=astroid gprof2dot mccabe From 090a22d1df8e7fcca328764667a7314cd7f5926a Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 18:37:47 +0100 Subject: [PATCH 02/13] CI - Remove old windows job --- .github/workflows/ci.yaml | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5c59718d16..4273a07ac6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -346,45 +346,6 @@ jobs: path: .benchmarks/ - pytest-windows: - name: Run tests Python ${{ matrix.python-version }} (Windows) - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - include: - - python-version: 3.6 - tox-env: py36 - - python-version: 3.7 - tox-env: py37 - - python-version: 3.8 - tox-env: py38 - - python-version: 3.9 - tox-env: py39 - steps: - - name: Set temp directory - run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV - # Workaround to set correct temp directory on Windows - # https://github.com/actions/virtual-environments/issues/712 - - name: Check out code from GitHub - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - id: python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Create Python virtual environment - run: | - python -m venv venv - . venv\\Scripts\\activate - python -m pip install -U pip setuptools wheel - pip install tox - - name: Run tox - run: | - . venv\\Scripts\\activate - tox -e ${{ matrix.tox-env }} - - prepare-tests-pypy: name: Prepare tests for Python ${{ matrix.python-version }} runs-on: ubuntu-latest From d8c137e32b9b7ffc62a7162a9c6f0e89bc2c0073 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 20:23:14 +0100 Subject: [PATCH 03/13] CI - Add new windows jobs --- .github/workflows/ci.yaml | 78 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4273a07ac6..483894eb02 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -346,6 +346,84 @@ jobs: path: .benchmarks/ + prepare-tests-windows: + name: Prepare tests for Python ${{ matrix.python-version }} (Windows) + runs-on: windows-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + outputs: + python-key: ${{ steps.generate-python-key.outputs.key }} + steps: + - name: Check out code from GitHub + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Generate partial Python venv restore key + id: generate-python-key + run: >- + echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ + hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}" + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2 + with: + path: venv + key: >- + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + steps.generate-python-key.outputs.key }} + restore-keys: | + ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ env.CACHE_VERSION }}- + - name: Create Python virtual environment + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + python -m venv venv + . venv\\Scripts\\activate + python -m pip install -U pip setuptools wheel + pip install -U -r requirements_test_pypy.txt + pip install -e . + + pytest-windows: + name: Run tests Python ${{ matrix.python-version }} (Windows) + runs-on: windows-latest + needs: prepare-tests-windows + strategy: + fail-fast: false + matrix: + python-version: [3.6, 3.7, 3.8, 3.9] + steps: + - name: Set temp directory + run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV + # Workaround to set correct temp directory on Windows + # https://github.com/actions/virtual-environments/issues/712 + - name: Check out code from GitHub + uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + id: python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Restore Python virtual environment + id: cache-venv + uses: actions/cache@v2 + with: + path: venv + key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ + needs.prepare-tests-windows.outputs.python-key }} + - name: Fail job if Python cache restore failed + if: steps.cache-venv.outputs.cache-hit != 'true' + run: | + echo "Failed to restore Python venv from cache" + exit 1 + - name: Run pytest + run: | + . venv\\Scripts\\activate + pytest --benchmark-disable tests/ + + prepare-tests-pypy: name: Prepare tests for Python ${{ matrix.python-version }} runs-on: ubuntu-latest From cea38acd169ca7546445ae207021678b7b4b39f0 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 20:23:57 +0100 Subject: [PATCH 04/13] Fix tests --- tests/regrtest_data/duplicate_data_raw_strings/__init__.py | 0 tests/test_self.py | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 tests/regrtest_data/duplicate_data_raw_strings/__init__.py diff --git a/tests/regrtest_data/duplicate_data_raw_strings/__init__.py b/tests/regrtest_data/duplicate_data_raw_strings/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/test_self.py b/tests/test_self.py index 27bb342abe..5dad21948c 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -54,7 +54,7 @@ from pylint.utils import utils HERE = abspath(dirname(__file__)) -CLEAN_PATH = re.escape(dirname(dirname(__file__)) + "/") +CLEAN_PATH = re.escape(dirname(dirname(__file__)) + os.path.sep) @contextlib.contextmanager @@ -144,7 +144,8 @@ def _run_pylint(args, out, reporter=None): @staticmethod def _clean_paths(output): """Normalize path to the tests directory.""" - return re.sub(CLEAN_PATH, "", output.replace("\\", "/"), flags=re.MULTILINE) + output = re.sub(CLEAN_PATH, "", output, flags=re.MULTILINE) + return output.replace("\\", "/") def _test_output(self, args, expected_output): out = StringIO() From b583c0a0af5ec62015077b7f5f3221288b7df810 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 21:53:01 +0100 Subject: [PATCH 05/13] Github actions - use specific version tags --- .github/workflows/ci.yaml | 74 +++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 483894eb02..db84b929e0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,10 +22,10 @@ jobs: pre-commit-key: ${{ steps.generate-pre-commit-key.outputs.key }} steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Generate partial Python venv restore key @@ -36,7 +36,7 @@ jobs: 'requirements_test_pypy.txt', 'requirements_docs.txt') }}" - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: >- @@ -60,7 +60,7 @@ jobs: hashFiles('.pre-commit-config.yaml') }}" - name: Restore pre-commit environment id: cache-precommit - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: ${{ env.PRE_COMMIT_CACHE }} key: >- @@ -79,15 +79,15 @@ jobs: needs: prepare-base steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ @@ -99,7 +99,7 @@ jobs: exit 1 - name: Restore pre-commit environment id: cache-precommit - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: ${{ env.PRE_COMMIT_CACHE }} key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }} @@ -120,15 +120,15 @@ jobs: needs: prepare-base steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ @@ -149,15 +149,15 @@ jobs: needs: prepare-base steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ @@ -184,10 +184,10 @@ jobs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ matrix.python-version }} - name: Generate partial Python venv restore key @@ -198,7 +198,7 @@ jobs: 'requirements_test_pypy.txt') }}" - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: >- @@ -225,15 +225,15 @@ jobs: python-version: [3.6, 3.7, 3.8, 3.9] steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ @@ -248,7 +248,7 @@ jobs: . venv/bin/activate coverage run -m pytest --benchmark-disable tests/ - name: Upload coverage artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v2.2.2 with: name: coverage-${{ matrix.python-version }} path: .coverage @@ -264,15 +264,15 @@ jobs: COVERAGERC_FILE: .coveragerc steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ @@ -283,7 +283,7 @@ jobs: echo "Failed to restore Python venv from cache" exit 1 - name: Download all coverage artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v2.0.8 - name: Combine coverage results run: | . venv/bin/activate @@ -356,10 +356,10 @@ jobs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ matrix.python-version }} - name: Generate partial Python venv restore key @@ -369,7 +369,7 @@ jobs: hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}" - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: >- @@ -400,15 +400,15 @@ jobs: # Workaround to set correct temp directory on Windows # https://github.com/actions/virtual-environments/issues/712 - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ @@ -434,10 +434,10 @@ jobs: python-key: ${{ steps.generate-python-key.outputs.key }} steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ matrix.python-version }} - name: Generate partial Python venv restore key @@ -447,7 +447,7 @@ jobs: hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}" - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: >- @@ -474,15 +474,15 @@ jobs: python-version: ["pypy3"] steps: - name: Check out code from GitHub - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2.2.1 with: python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ From 71537f72aa917fe5dab3fcb29cfe3336b7ee2a11 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 22:14:15 +0100 Subject: [PATCH 06/13] Update requirements * Pin test and doc requirements to current versions * Rename requirements_test_pypy.txt to requirements_test_min.txt * Move some dependencies from min to test * Update coverage and sphinx versions * Update ci * Use pytest-cov --- .github/workflows/ci.yaml | 14 +++++++------- pylint/__pkginfo__.py | 2 +- requirements_docs.txt | 4 ++-- requirements_test.txt | 11 ++++++++--- requirements_test_min.txt | 3 +++ requirements_test_pypy.txt | 7 ------- 6 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 requirements_test_min.txt delete mode 100644 requirements_test_pypy.txt diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index db84b929e0..dc919e03c7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,7 +33,7 @@ jobs: run: >- echo "::set-output name=key::base-venv-${{ env.CACHE_VERSION }}-${{ hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', - 'requirements_test_pypy.txt', 'requirements_docs.txt') }}" + 'requirements_test_min.txt', 'requirements_docs.txt') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2.1.4 @@ -195,7 +195,7 @@ jobs: run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ hashFiles('pylint/__pkg_info__.py', 'requirements_test.txt', - 'requirements_test_pypy.txt') }}" + 'requirements_test_min.txt') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2.1.4 @@ -246,7 +246,7 @@ jobs: - name: Run pytest run: | . venv/bin/activate - coverage run -m pytest --benchmark-disable tests/ + pytest --benchmark-disable --cov --cov-report= tests/ - name: Upload coverage artifact uses: actions/upload-artifact@v2.2.2 with: @@ -366,7 +366,7 @@ jobs: id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}" + hashFiles('pylint/__pkg_info__.py', 'requirements_test_min.txt') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2.1.4 @@ -383,7 +383,7 @@ jobs: python -m venv venv . venv\\Scripts\\activate python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test_pypy.txt + pip install -U -r requirements_test_min.txt pip install -e . pytest-windows: @@ -444,7 +444,7 @@ jobs: id: generate-python-key run: >- echo "::set-output name=key::venv-${{ env.CACHE_VERSION }}-${{ - hashFiles('pylint/__pkg_info__.py', 'requirements_test_pypy.txt') }}" + hashFiles('pylint/__pkg_info__.py', 'requirements_test_min.txt') }}" - name: Restore Python virtual environment id: cache-venv uses: actions/cache@v2.1.4 @@ -461,7 +461,7 @@ jobs: python -m venv venv . venv/bin/activate python -m pip install -U pip setuptools wheel - pip install -U -r requirements_test_pypy.txt + pip install -U -r requirements_test_min.txt pip install -e . pytest-pypy: diff --git a/pylint/__pkginfo__.py b/pylint/__pkginfo__.py index 5d78adfea2..c3e63a1fdc 100644 --- a/pylint/__pkginfo__.py +++ b/pylint/__pkginfo__.py @@ -50,7 +50,7 @@ extras_require = {} extras_require[':sys_platform=="win32"'] = ["colorama"] -extras_require["docs"] = ["sphinx~=3.2", "python-docs-theme"] +extras_require["docs"] = ["sphinx==3.5.1", "python-docs-theme==2020.12"] license = "GPL" description = "python code static checker" diff --git a/requirements_docs.txt b/requirements_docs.txt index 10783d349a..a299f539fe 100644 --- a/requirements_docs.txt +++ b/requirements_docs.txt @@ -1,2 +1,2 @@ -sphinx~=3.2 -python-docs-theme +Sphinx==3.5.1 +python-docs-theme==2020.12 diff --git a/requirements_test.txt b/requirements_test.txt index c2bc9cecae..f30968e9b2 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,4 +1,9 @@ -r requirements_test_pre_commit.txt --r requirements_test_pypy.txt -pre-commit -pyenchant +-r requirements_test_min.txt +coveralls==3.0.0 +coverage==5.4.0 +pre-commit==2.10.1 +pyenchant==3.2.0 +pytest-cov==2.11.1 +pytest-profiling==1.7.0 +pytest-xdist==2.2.1 diff --git a/requirements_test_min.txt b/requirements_test_min.txt new file mode 100644 index 0000000000..3370e8c4c4 --- /dev/null +++ b/requirements_test_min.txt @@ -0,0 +1,3 @@ +astroid==2.5.0 +pytest==6.2.2 +pytest-benchmark==3.2.3 diff --git a/requirements_test_pypy.txt b/requirements_test_pypy.txt deleted file mode 100644 index 9ef5c75f4a..0000000000 --- a/requirements_test_pypy.txt +++ /dev/null @@ -1,7 +0,0 @@ -astroid==2.5.0 -coveralls -coverage<5.0 -pytest -pytest-xdist -pytest-benchmark -pytest-profiling From 8c216e43c41c64594b7b715dfc10d992bcb5b786 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 22:17:53 +0100 Subject: [PATCH 07/13] Add dependabot config --- .github/dependabot.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..c4d0ea891b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" + labels: + - "dependency" + open-pull-requests-limit: 10 + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + labels: + - "dependency" + open-pull-requests-limit: 10 From 0b870188a216acd2d1b45f28c06efb9ed2a0057e Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 23:17:11 +0100 Subject: [PATCH 08/13] Update mypy pre-commit hook --- .pre-commit-config.yaml | 2 +- requirements_test_pre_commit.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 298a4b5a01..c840044b99 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,7 +47,7 @@ repos: types: [python] exclude: tests/functional/|tests/input|tests/extensions/data|tests/regrtest_data/|tests/data/|doc/ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.800 + rev: v0.812 hooks: - id: mypy name: mypy diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index 1399e7d93b..1acddec25d 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -2,4 +2,4 @@ autoflake==1.4 black==20.8b1 flake8==3.8.4 isort==5.7.0 -mypy==0.800 +mypy==0.812 From ad7af4064bdaf964e0248eece3d62a8e32d7bebc Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 23:19:36 +0100 Subject: [PATCH 09/13] Update tox config --- tox.ini | 112 ++++++++++++++++---------------------------------------- 1 file changed, 31 insertions(+), 81 deletions(-) diff --git a/tox.ini b/tox.ini index 681e13a20d..69a1c5d74d 100644 --- a/tox.ini +++ b/tox.ini @@ -6,8 +6,7 @@ skip_missing_interpreters = true [testenv:pylint] deps = - astroid==2.5.0 - pytest + -r {toxinidir}/requirements_test_min.txt commands = # This would be greatly simplified by a solution for https://github.com/PyCQA/pylint/issues/352 pylint -rn --rcfile={toxinidir}/pylintrc --load-plugins=pylint.extensions.docparams, pylint.extensions.mccabe \ @@ -38,128 +37,79 @@ commands = [testenv:formatting] basepython = python3 deps = - pre-commit - sphinx - pytest + -r {toxinidir}/requirements_test_min.txt + pre-commit==2.10.1 commands = pre-commit run --all-files -changedir = {toxinidir} [testenv:mypy] basepython = python3 deps = - pre-commit + pre-commit==2.10.1 commands = pre-commit run mypy --all-files [testenv] -deps = - astroid==2.5.0 - coverage<5.0 - mccabe - isort - pytest - pytest-xdist - pytest-benchmark - pytest-profiling setenv = COVERAGE_FILE = {toxinidir}/.coverage.{envname} +deps = + -r {toxinidir}/requirements_test.txt commands = ; Run tests, ensuring all benchmark tests do not run - python -Wignore -m coverage run -m pytest --benchmark-disable {toxinidir}/tests/ {posargs:} - - ; Transform absolute path to relative path - ; for compatibility with coveralls.io and fix 'source not available' error. - ; If you can find a cleaner way is welcome - python -c "import os;cov_strip_abspath = open(os.environ['COVERAGE_FILE'], 'r').read().replace('.tox' + os.sep + os.path.relpath('{envsitepackagesdir}', '{toxworkdir}') + os.sep, '');open(os.environ['COVERAGE_FILE'], 'w').write(cov_strip_abspath)" -changedir = {toxworkdir} + pytest --benchmark-disable {toxinidir}/tests/ {posargs:} [testenv:spelling] deps = - https://github.com/PyCQA/astroid/tarball/master#egg=astroid - pytest - pytest-xdist - pyenchant -commands = - python -Wi -m pytest {toxinidir}/tests/ {posargs:} -k unittest_spelling -changedir = {toxworkdir} - - -[testenv:coveralls] -setenv = - COVERAGE_FILE = {toxinidir}/.coverage -passenv = - * -deps = - coverage<5.0 - coveralls -skip_install = true + -r {toxinidir}/requirements_test.txt commands = - python -m coverage combine - python -m coverage report --rcfile={toxinidir}/.coveragerc -m - - coveralls --rcfile={toxinidir}/.coveragerc -changedir = {toxinidir} + pytest {toxinidir}/tests/ {posargs:} -k unittest_spelling [testenv:coverage-html] setenv = COVERAGE_FILE = {toxinidir}/.coverage deps = - coverage<5 + -r {toxinidir}/requirements_test.txt skip_install = true commands = - python -m coverage combine - python -m coverage html --ignore-errors --rcfile={toxinidir}/.coveragerc -changedir = {toxinidir} + coverage combine + coverage html --ignore-errors --rcfile={toxinidir}/.coveragerc [testenv:docs] -usedevelop = True changedir = doc/ -extras = - docs +deps = + -r {toxinidir}/requirements_docs.txt +skip_install = true commands = - sphinx-build -W -b html -d _build/doctrees . _build/html + sphinx-build -W -b html -d _build/doctrees . _build/html [testenv:benchmark] deps = - astroid==2.5.0 - coverage<5.0 - mccabe - pytest - pytest-xdist - pygal - pytest-benchmark + -r {toxinidir}/requirements_test.txt + pygal commands = ; Run the only the benchmark tests, grouping output and forcing .json output so we ; can compare benchmark runs - python -Wi -m pytest --exitfirst \ - --failed-first \ - --benchmark-only \ - --benchmark-save=batch_files \ - --benchmark-save-data \ - --benchmark-autosave \ - {toxinidir}/tests \ - --benchmark-group-by="group" \ - {posargs:} + pytest --exitfirst \ + --failed-first \ + --benchmark-only \ + --benchmark-save=batch_files \ + --benchmark-save-data \ + --benchmark-autosave {toxinidir}/tests \ + --benchmark-group-by="group" \ + {posargs:} [testenv:profile_against_external] +setenv = + PYTEST_PROFILE_EXTERNAL = 1 deps = - astroid==2.5.0 - https://github.com/PyCQA/astroid/tarball/master#egg=astroid + -r {toxinidir}/requirements_test.txt gprof2dot - mccabe - pytest - pytest-profiling - pytest-xdist -setenv = - PYTEST_PROFILE_EXTERNAL = 1 commands = - python -Wi -m pytest --exitfirst \ - --profile-svg \ - {toxinidir}/tests/profile/test_profile_against_externals.py -changedir = {toxworkdir} + pytest --exitfirst \ + --profile-svg {toxinidir}/tests/profile/test_profile_against_externals.py From 61858e6881fd3aeee2047ba3cc657d0eef9bfee6 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 23:28:32 +0100 Subject: [PATCH 10/13] Use correct SPDX license tag --- pylint/__pkginfo__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylint/__pkginfo__.py b/pylint/__pkginfo__.py index c3e63a1fdc..a4f8d4e19f 100644 --- a/pylint/__pkginfo__.py +++ b/pylint/__pkginfo__.py @@ -52,7 +52,7 @@ extras_require[':sys_platform=="win32"'] = ["colorama"] extras_require["docs"] = ["sphinx==3.5.1", "python-docs-theme==2020.12"] -license = "GPL" +license = "GPL-2.0-or-later" description = "python code static checker" web = "https://github.com/PyCQA/pylint" mailinglist = "mailto:code-quality@python.org" From bb70da6ea80b459168d7bbe5d145faefb48a2a6a Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 21 Feb 2021 23:37:03 +0100 Subject: [PATCH 11/13] Add changelog entry --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index df57bcf571..126b2cec7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,8 @@ What's New in Pylint 2.7.1? Closes #4119 +* Workflow and packaging improvements + What's New in Pylint 2.7.0? =========================== From 8256389b4f277a6cf66d399910a74daa03eeb11b Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 22 Feb 2021 00:10:09 +0100 Subject: [PATCH 12/13] Update readme badge --- README.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 1ce0700e64..115a852dfb 100644 --- a/README.rst +++ b/README.rst @@ -2,12 +2,8 @@ README for Pylint - https://pylint.pycqa.org/ ============================================= -.. image:: https://travis-ci.org/PyCQA/pylint.svg?branch=master - :target: https://travis-ci.org/PyCQA/pylint - -.. image:: https://ci.appveyor.com/api/projects/status/rbvwhakyj1y09atb/branch/master?svg=true - :alt: AppVeyor Build Status - :target: https://ci.appveyor.com/project/PCManticore/pylint +.. image:: https://github.com/PyCQA/pylint/actions/workflows/ci.yaml/badge.svg?branch=master + :target: https://github.com/PyCQA/pylint/actions .. image:: https://coveralls.io/repos/github/PyCQA/pylint/badge.svg?branch=master :target: https://coveralls.io/github/PyCQA/pylint?branch=master From 2711cda1db1e9b1eede023e16736178112939811 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 23 Feb 2021 22:29:07 +0100 Subject: [PATCH 13/13] Move changelog entry to 2.8.0 --- ChangeLog | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 126b2cec7a..a74175e6f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ What's New in Pylint 2.8.0? .. Put new features here +* Workflow and packaging improvements + + What's New in Pylint 2.7.2? =========================== .. @@ -22,8 +25,6 @@ What's New in Pylint 2.7.1? Closes #4119 -* Workflow and packaging improvements - What's New in Pylint 2.7.0? ===========================