From 8d991d844af052f18271cb43005a8473f0c8f260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:05:58 +0100 Subject: [PATCH 01/37] use composite actions --- action.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 0771b3f..4a38fee 100644 --- a/action.yml +++ b/action.yml @@ -80,14 +80,14 @@ inputs: runs: using: "composite" steps: + - name: + uses: actions/setup-python@v2 + with: + python-version: {{ inputs.conda-python-version }} + architecture: x64 - run: | - $CONDA/bin/conda --version - $CONDA/bin/conda install python=${{ inputs.conda-python-version }} - shell: bash - name: Install lintners - - run: | - $CONDA/bin/python --version - $CONDA/bin/pip install -r ${{ github.action_path }}/requirements.txt + python --version + pip install -r ${{ github.action_path }}/requirements.txt shell: bash name: Install lintners - run: > From 4ed95c97c324a82c2bcb97de8b372c1b8d9f024d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:08:05 +0100 Subject: [PATCH 02/37] bugfix --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4a38fee..541d1b4 100644 --- a/action.yml +++ b/action.yml @@ -83,7 +83,7 @@ runs: - name: uses: actions/setup-python@v2 with: - python-version: {{ inputs.conda-python-version }} + python-version: ${{ inputs.conda-python-version }} architecture: x64 - run: | python --version From e93d512da8d918dff4c7d3b62f3d6c4629543aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:20:01 +0100 Subject: [PATCH 03/37] bugfix --- .github/workflows/all-lints.yml | 2 +- action.yml | 4 +++- entrypoint.sh | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index d812331..39fb20b 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -20,5 +20,5 @@ jobs: use-pylint: false use-flake8: false use-vulture: true - conda-python-version: "3.6" + python-version: "3.6" diff --git a/action.yml b/action.yml index 541d1b4..c51d153 100644 --- a/action.yml +++ b/action.yml @@ -83,8 +83,10 @@ runs: - name: uses: actions/setup-python@v2 with: - python-version: ${{ inputs.conda-python-version }} + python-version: ${{ inputs.python-version }} architecture: x64 + cache: pip + cache-dependency-path: ${{ github.action_path }}/requirements.txt - run: | python --version pip install -r ${{ github.action_path }}/requirements.txt diff --git a/entrypoint.sh b/entrypoint.sh index ef1596a..018b8cb 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -51,7 +51,7 @@ if [ "$2" = true ] ; then echo Running: pylint ${10} $1 - $CONDA/bin/pylint --output-format="colorized" ${10} $1 + pylint --output-format="colorized" ${10} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -66,7 +66,7 @@ if [ "$3" = true ] ; then echo Running: pycodestyle ${11} $1 - $CONDA/bin/pycodestyle ${11} $1 + pycodestyle ${11} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -81,7 +81,7 @@ if [ "$4" = true ] ; then echo Running: flake8 ${12} $1 - $CONDA/bin/flake8 ${12} $1 + flake8 ${12} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -96,7 +96,7 @@ if [ "$5" = true ] ; then echo Running: black --check ${13} $1 - $CONDA/bin/black --check ${13} $1 + black --check ${13} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -111,7 +111,7 @@ if [ "$6" = true ] ; then echo Running: mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 - $CONDA/bin/mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 + mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -126,7 +126,7 @@ if [ "$7" = true ] ; then echo Running: isort ${15} $1 -c --diff - $CONDA/bin/isort ${15} $1 -c --diff + isort ${15} $1 -c --diff exit_code=$? if [ "$exit_code" = "0" ]; then @@ -141,7 +141,7 @@ if [ "$8" = true ] ; then echo Running: vulture ${16} $1 - $CONDA/bin/vulture ${16} $1 + vulture ${16} $1 exit_code=$? if [ "$exit_code" = "0" ]; then @@ -156,7 +156,7 @@ if [ "$9" = true ] ; then echo Running: pydocstyle ${17} $1 - $CONDA/bin/pydocstyle ${17} $1 + pydocstyle ${17} $1 exit_code=$? if [ "$exit_code" = "0" ]; then From d4096d2c7f185b730edef0529b4d1d1351dc8dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:23:10 +0100 Subject: [PATCH 04/37] bugfix --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index c51d153..ed441d5 100644 --- a/action.yml +++ b/action.yml @@ -72,8 +72,8 @@ inputs: description: "Extra options: pydocstyle $(extra-pydocstyle-options) $(python-root-list)" required: false default: "" - conda-python-version: - description: "Tests are run in Conda environment, set desired python version with this keyword" + python-version: + description: "Set desired python version with this keyword" required: false default: "3.8" From 24b8a314fd3f39e5103cfafd4f52744d0cb34201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:27:01 +0100 Subject: [PATCH 05/37] bugfix --- action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yml b/action.yml index ed441d5..9a5dac3 100644 --- a/action.yml +++ b/action.yml @@ -86,7 +86,6 @@ runs: python-version: ${{ inputs.python-version }} architecture: x64 cache: pip - cache-dependency-path: ${{ github.action_path }}/requirements.txt - run: | python --version pip install -r ${{ github.action_path }}/requirements.txt From dc0eb5f3ee4c7043ba8ffa0ca5741f62a4e6b444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 10:30:07 +0100 Subject: [PATCH 06/37] text if python is not changed --- .github/workflows/all-lints.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 39fb20b..8fc822f 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -7,6 +7,12 @@ jobs: name: Lint Python runs-on: ubuntu-20.04 steps: + - name: + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: | + python --version - uses: actions/checkout@v1 - uses: marian-code/pyaction@master with: @@ -21,4 +27,6 @@ jobs: use-flake8: false use-vulture: true python-version: "3.6" + - run: | + python --version From 1f6b6af15bf19a4071f1fab76878ccd134cdeaff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:03:05 +0100 Subject: [PATCH 07/37] test more os --- .github/workflows/all-lints.yml | 17 +++++++--------- README.md | 35 ++++++++++++++++++++++----------- action.yml | 2 +- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 8fc822f..5759280 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -5,14 +5,12 @@ name: Lint Python jobs: lintpython: name: Lint Python - runs-on: ubuntu-20.04 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ['3.7', '3.8', '3.9', '3.10'] steps: - - name: - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - run: | - python --version - uses: actions/checkout@v1 - uses: marian-code/pyaction@master with: @@ -26,7 +24,6 @@ jobs: use-pylint: false use-flake8: false use-vulture: true - python-version: "3.6" - - run: | - python --version + python-version: ${{ matrix.python-version }} + diff --git a/README.md b/README.md index ac79752..2152cf3 100644 --- a/README.md +++ b/README.md @@ -46,14 +46,14 @@ steps: use-mypy: false use-vulture: true extra-pylint-options: "--output-format="colorized" - conda-python-version: "3.7" + python-version: "3.7" ``` ## Details -Uses conda environment with user selected python version. Only python `3.6` - `3.9` -version are tested since they are by far most common now. Other python `3.x` versions -should also work. Any python `2.x` versions are unsupported! +Uses `actions/setup-python@v2`. Only python `3.6` - `3.10` version are tested since +they are by far most common now. Other python `3.x` versions should also work. +Any python `2.x` versions are unsupported! The lintner versions are: @@ -70,12 +70,15 @@ isort==isort-5.7.0 ## IMPORTANT - test environment -The python version you set up in your action script with `actions/setup-python@v2` -or by other means will not affect the linting process. The python version used by -the linters can be set up only by `conda-python-version` argument! This also means -that if you modify the system conda environment it might affect the lintnig process. -So it is best to keep the lintnig action separated from others. It is also recomended -to run this on `ubuntu-latest`. Example: +The python version is set by `actions/setup-python@v2` using composite actions. This +means that the the action will change python you might have previously set with +`actions/setup-python@v2`. There are two ways to circumvent this. + +- Keep the lintnig action separated from others +- Use it at the and of your workflow when the change in python version will not + affect anything else + +Example: ```yml on: @@ -85,9 +88,15 @@ name: Lint Python jobs: lintpython: name: Lint Python - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 + - uses: actions/setup-python@v2 + with: + python-version: 3.9 + - run: | + python --version # this will output 3.9 now + run tests or other things using python ... - uses: marian-code/pyaction@v2 with: python-root-list: "./tests/*.py" @@ -100,7 +109,9 @@ jobs: use-pylint: false use-flake8: false use-vulture: true - conda-python-version: "3.8" + python-version: "3.7" + - run: | + python --version # this will output 3.7 now !!! ``` ## License diff --git a/action.yml b/action.yml index 9a5dac3..2790877 100644 --- a/action.yml +++ b/action.yml @@ -80,7 +80,7 @@ inputs: runs: using: "composite" steps: - - name: + - name: Setup python uses: actions/setup-python@v2 with: python-version: ${{ inputs.python-version }} From c0c616e9a0f5e9221214688d930ff212727f4dac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:17:53 +0100 Subject: [PATCH 08/37] bugfix --- action.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 2790877..5f5bd03 100644 --- a/action.yml +++ b/action.yml @@ -86,11 +86,17 @@ runs: python-version: ${{ inputs.python-version }} architecture: x64 cache: pip - - run: | - python --version - pip install -r ${{ github.action_path }}/requirements.txt + - run: python --version + - name: Is Windows + if: ${{ runner.os }} == "Windows" + run: pip install -r ${{ github.action_path }}\requirements.txt shell: bash - name: Install lintners + name: Install lintners on Win + - name: Is Posix + if: ${{ runner.os }} != "Windows" + run: pip install -r ${{ github.action_path }}/requirements.txt + shell: bash + name: Install lintners on Posix - run: > ${{ github.action_path }}/entrypoint.sh '${{ inputs.python-root-list }}' From 964451913482c757d606465713fbbcfa41ef96f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:21:11 +0100 Subject: [PATCH 09/37] bugfix --- action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 5f5bd03..4113fce 100644 --- a/action.yml +++ b/action.yml @@ -86,17 +86,19 @@ runs: python-version: ${{ inputs.python-version }} architecture: x64 cache: pip + - run: python --version + - name: Is Windows if: ${{ runner.os }} == "Windows" run: pip install -r ${{ github.action_path }}\requirements.txt shell: bash - name: Install lintners on Win + - name: Is Posix if: ${{ runner.os }} != "Windows" run: pip install -r ${{ github.action_path }}/requirements.txt shell: bash - name: Install lintners on Posix + - run: > ${{ github.action_path }}/entrypoint.sh '${{ inputs.python-root-list }}' From 53864e0c00ef77ff947e4176992101d597e126a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:23:40 +0100 Subject: [PATCH 10/37] bugfix --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 4113fce..40c006d 100644 --- a/action.yml +++ b/action.yml @@ -88,6 +88,7 @@ runs: cache: pip - run: python --version + shell: bash - name: Is Windows if: ${{ runner.os }} == "Windows" From 3761b4407a1d28c58677621d56067358aef10533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:26:24 +0100 Subject: [PATCH 11/37] bugfix --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 40c006d..01eefc8 100644 --- a/action.yml +++ b/action.yml @@ -91,12 +91,12 @@ runs: shell: bash - name: Is Windows - if: ${{ runner.os }} == "Windows" + if: ${{ runner.os }} == Windows run: pip install -r ${{ github.action_path }}\requirements.txt shell: bash - name: Is Posix - if: ${{ runner.os }} != "Windows" + if: ${{ runner.os }} != Windows run: pip install -r ${{ github.action_path }}/requirements.txt shell: bash From 1a824c8a250081abc86d8ef31915fc11d0925bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 11:30:52 +0100 Subject: [PATCH 12/37] bugfix --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 01eefc8..b154e7a 100644 --- a/action.yml +++ b/action.yml @@ -91,12 +91,12 @@ runs: shell: bash - name: Is Windows - if: ${{ runner.os }} == Windows + if: ${{ runner.os == 'Windows' }} run: pip install -r ${{ github.action_path }}\requirements.txt shell: bash - name: Is Posix - if: ${{ runner.os }} != Windows + if: ${{ runner.os != 'Windows' }} run: pip install -r ${{ github.action_path }}/requirements.txt shell: bash From 31f289dab360c8f9f6deefd2739a721e99ff9d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:10:41 +0100 Subject: [PATCH 13/37] bugfix --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b154e7a..f712ab4 100644 --- a/action.yml +++ b/action.yml @@ -93,7 +93,7 @@ runs: - name: Is Windows if: ${{ runner.os == 'Windows' }} run: pip install -r ${{ github.action_path }}\requirements.txt - shell: bash + shell: PowerShell - name: Is Posix if: ${{ runner.os != 'Windows' }} From ea84886b89484bcb3a94adb5397ed8b85645fac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:27:09 +0100 Subject: [PATCH 14/37] bugfix --- action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index f712ab4..86f099b 100644 --- a/action.yml +++ b/action.yml @@ -92,8 +92,10 @@ runs: - name: Is Windows if: ${{ runner.os == 'Windows' }} - run: pip install -r ${{ github.action_path }}\requirements.txt - shell: PowerShell + run: | + pip install -r ${{ github.action_path }}\requirements.txt + echo "path_sep=" >> $GITHUB_ENV + shell: pwsh - name: Is Posix if: ${{ runner.os != 'Windows' }} From afe1cb4e79f65c81052b6a7cef164d4ab490e50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:47:55 +0100 Subject: [PATCH 15/37] bugfix --- action.yml | 36 ++++++++++++++++++++++++++++++------ entrypoint.sh | 13 ++++++++++--- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index 86f099b..c9823cf 100644 --- a/action.yml +++ b/action.yml @@ -86,23 +86,48 @@ runs: python-version: ${{ inputs.python-version }} architecture: x64 cache: pip - + - run: python --version shell: bash - - name: Is Windows + - name: Windows install dependencies if: ${{ runner.os == 'Windows' }} run: | pip install -r ${{ github.action_path }}\requirements.txt echo "path_sep=" >> $GITHUB_ENV shell: pwsh - - name: Is Posix + - name: Posix install dependencies if: ${{ runner.os != 'Windows' }} run: pip install -r ${{ github.action_path }}/requirements.txt shell: bash - - run: > + - name: Lint on Windows + if: ${{ runner.os == 'Windows' }} + run: > + ${{ github.action_path }}\entrypoint.sh + '${{ inputs.python-root-list }}' + ${{ inputs.use-pylint }} + ${{ inputs.use-pycodestyle }} + ${{ inputs.use-flake8 }} + ${{ inputs.use-black }} + ${{ inputs.use-mypy }} + ${{ inputs.use-isort }} + ${{ inputs.use-vulture }} + ${{ inputs.use-pydocstyle }} + '${{ inputs.extra-pylint-options }}' + '${{ inputs.extra-pycodestyle-options }}' + '${{ inputs.extra-flake8-options }}' + '${{ inputs.extra-black-options }}' + '${{ inputs.extra-mypy-options }}' + '${{ inputs.extra-isort-options }}' + '${{ inputs.extra-vulture-options }}' + '${{ inputs.extra-pydocstyle-options }}' + shell: pwsh + + - name: Lint on Linux + if: ${{ runner.os == 'Linux' }} + run: > ${{ github.action_path }}/entrypoint.sh '${{ inputs.python-root-list }}' ${{ inputs.use-pylint }} @@ -121,5 +146,4 @@ runs: '${{ inputs.extra-isort-options }}' '${{ inputs.extra-vulture-options }}' '${{ inputs.extra-pydocstyle-options }}' - shell: bash - name: Lint + shell: pwsh diff --git a/entrypoint.sh b/entrypoint.sh index 018b8cb..16426b5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,3 @@ -#!/bin/sh -l - # Parameters # # $1 - python-root-list @@ -39,7 +37,16 @@ echo extra-vulture-options: ${16} echo extra-pydocstyle-options: ${17} # actions path has the copy of this actions repo -for matcher in $GITHUB_ACTION_PATH/matchers/*.json +echo $RUNNER_OS +if [ $RUNNER_OS = 'Windows' ] +then + MATCHERS=$GITHUB_ACTION_PATH\matchers\*.json +else + MATCHERS=$GITHUB_ACTION_PATH/matchers/*.json +fi +echo $MATCHERS + +for matcher in $MATCHERS do echo adding matcher $matcher echo "::add-matcher::${matcher}" From 6b3be0767811ae5bcd094492f93d12218747d4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:54:43 +0100 Subject: [PATCH 16/37] bugfix --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c9823cf..e05b9c2 100644 --- a/action.yml +++ b/action.yml @@ -146,4 +146,4 @@ runs: '${{ inputs.extra-isort-options }}' '${{ inputs.extra-vulture-options }}' '${{ inputs.extra-pydocstyle-options }}' - shell: pwsh + shell: bash From a2f413d441a78b6b3dbecea1cb439c7722c5a214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 12:58:23 +0100 Subject: [PATCH 17/37] test python 3.6 --- .github/workflows/all-lints.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 5759280..357a36a 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v1 - uses: marian-code/pyaction@master From 5e6579fd24a1a851b2ec5cb5ccb0cf185445f677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 13:06:34 +0100 Subject: [PATCH 18/37] update lintners --- README.md | 14 +++++++------- requirements.txt | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2152cf3..27d3735 100644 --- a/README.md +++ b/README.md @@ -52,17 +52,17 @@ steps: ## Details Uses `actions/setup-python@v2`. Only python `3.6` - `3.10` version are tested since -they are by far most common now. Other python `3.x` versions should also work. -Any python `2.x` versions are unsupported! +they are by far most common now. Other python `3.x` versions should also work. +Any python `2.x` versions are unsupported! You can lint on Linux, Windows and MacOS. The lintner versions are: ```bash -pycodestyle==2.6.0 -pydocstyle==5.1.1 -pylint==2.6.0 -mypy==0.800 -black==20.8b1 +pycodestyle==2.8.0 # from 3.5 +pydocstyle==6.1.1 +pylint==2.12.1 +mypy==0.910 +black==21.11b1 flake8==3.8.4 vulture==2.3 isort==isort-5.7.0 diff --git a/requirements.txt b/requirements.txt index e5fd10b..e2793cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -black==20.8b1 -flake8==3.8.4 -isort==5.7.0 -mypy==0.800 -pycodestyle==2.6.0 -pydocstyle==5.1.1 -pylint==2.6.0 +black==21.11b1 +flake8==4.0.1 +isort==5.10.1 +mypy==0.910 +pycodestyle==2.8.0 +pydocstyle==6.1.1 +pylint==2.12.1 vulture==2.3 \ No newline at end of file From 1e82ddd4c3c6348781247a96e6de91d20d3abeea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 13:09:28 +0100 Subject: [PATCH 19/37] update lintners --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 27d3735..92432b8 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ Any python `2.x` versions are unsupported! You can lint on Linux, Windows and Ma The lintner versions are: ```bash -pycodestyle==2.8.0 # from 3.5 +pycodestyle==2.8.0 pydocstyle==6.1.1 pylint==2.12.1 mypy==0.910 black==21.11b1 -flake8==3.8.4 +flake8==4.0.1 vulture==2.3 -isort==isort-5.7.0 +isort==5.10.1 ``` ## IMPORTANT - test environment From e7dbdce1a47b324330abe2b14a962c40280a0316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 13:17:13 +0100 Subject: [PATCH 20/37] small doc update --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92432b8..94b9389 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Basic: ```yml steps: - uses: actions/checkout@v1 - - uses: marian-code/python-lint-annotate@v2 + - uses: marian-code/python-lint-annotate@v3 ``` Options: @@ -39,7 +39,7 @@ Options: ```yml steps: - uses: actions/checkout@v1 - - uses: marian-code/python-lint-annotate@v2 + - uses: marian-code/python-lint-annotate@v3 with: python-root-list: "src/ tests/*" # accepts wildcards use-pycodestyle: false From 7f19b98ec2d3bc661c4fbfc9ac5120e975adbf36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mari=C3=A1n=20Rynik?= Date: Fri, 3 Dec 2021 13:18:18 +0100 Subject: [PATCH 21/37] bugfix --- .github/workflows/all-lints.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 357a36a..4b90a36 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -12,7 +12,7 @@ jobs: python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v1 - - uses: marian-code/pyaction@master + - uses: marian-code/python-lint-annotate@master with: python-root-list: "./tests/*.py ./tests/subtest/*.py" use-black: true From 9b1801a87c0736d9d7ab5777a60e1ae1ef3778e7 Mon Sep 17 00:00:00 2001 From: marian-code Date: Mon, 6 Dec 2021 12:27:17 +0100 Subject: [PATCH 22/37] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94b9389..a40bf74 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ jobs: - run: | python --version # this will output 3.9 now run tests or other things using python ... - - uses: marian-code/pyaction@v2 + - uses: marian-code/python-lint-annotate@v3 with: python-root-list: "./tests/*.py" use-black: true From e0561900a46684b41ef853a43c995a28a0bcb230 Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Tue, 7 Jun 2022 19:31:08 -0400 Subject: [PATCH 23/37] Going back to default value before e3b43b1d9e0375a47832a23ef26db7765def80db --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e05b9c2..5ec2538 100644 --- a/action.yml +++ b/action.yml @@ -7,7 +7,7 @@ inputs: python-root-list: description: "A list of all paths to test" required: false - default: "'./**/*.py'" + default: "." use-pylint: description: "Use Pylint" required: false From d8109ec07ec3d6ebb6f57ecd030f60c0d63995ec Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Wed, 8 Jun 2022 13:08:43 -0400 Subject: [PATCH 24/37] Added an example actions.yml file --- README.md | 3 +++ examples/actions-only_changed_files.yml | 26 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 examples/actions-only_changed_files.yml diff --git a/README.md b/README.md index a40bf74..f1b3a49 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ steps: python-version: "3.7" ``` +### Examples +* [Only lint changed files, and ignore missing docstrings](examples/actions-only_changed_files.yml) + ## Details Uses `actions/setup-python@v2`. Only python `3.6` - `3.10` version are tested since diff --git a/examples/actions-only_changed_files.yml b/examples/actions-only_changed_files.yml new file mode 100644 index 0000000..02209e4 --- /dev/null +++ b/examples/actions-only_changed_files.yml @@ -0,0 +1,26 @@ +name: Lint only files changed in Pull Request, and ignore Missing docstrings +on: + pull_request: + types: [ opened, reopened, synchronize, edited ] +jobs: + lint: + runs-on: ubuntu-latest + name: Lint + steps: + - name: Check out source repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 # This is necessary to get the commits + - name: Set up Python environment + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Get changed python files between base and head + run: > + echo "CHANGED_FILES=$(echo $(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- | grep \.py))" >> $GITHUB_ENV + - if: ${{ env.CHANGED_FILES }} + uses: marian-code/python-lint-annotate@v3 + with: + python-root-list: ${{ env.CHANGED_FILES }} + extra-pylint-options: "--disable=C0114,C0116" # Missing doctrings + extra-pydocstyle-options: "--ignore=D1" # Missing doctrings http://www.pydocstyle.org/en/stable/error_codes.html#grouping From cc4c8be195333803fa78f6bdf712fd7aa845ae38 Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Wed, 15 Jun 2022 13:39:53 -0400 Subject: [PATCH 25/37] Updated mypy --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e2793cb..73b61ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ black==21.11b1 flake8==4.0.1 isort==5.10.1 -mypy==0.910 +mypy~=0.961 pycodestyle==2.8.0 pydocstyle==6.1.1 pylint==2.12.1 From 11921337226ca5658c685dc55eaefc4a4d2e31a0 Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Wed, 15 Jun 2022 14:08:46 -0400 Subject: [PATCH 26/37] Install stubs --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 16426b5..a18ead5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -116,9 +116,9 @@ fi if [ "$6" = true ] ; then - echo Running: mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 + echo Running: mypy --install-types --non-interactive --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 - mypy --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 + mypy --install-types --non-interactive --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 exit_code=$? if [ "$exit_code" = "0" ]; then From d6e7ca40ef185a810aef8f656461ea49a7fc5284 Mon Sep 17 00:00:00 2001 From: Nicolas Menard-Guy Date: Wed, 15 Jun 2022 14:26:13 -0400 Subject: [PATCH 27/37] Multiline command for readability --- entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index a18ead5..0e84798 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -118,7 +118,11 @@ if [ "$6" = true ] ; then echo Running: mypy --install-types --non-interactive --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 - mypy --install-types --non-interactive --ignore-missing-imports --follow-imports=silent --show-column-numbers ${14} $1 + mypy \ + --install-types --non-interactive \ + --ignore-missing-imports \ + --follow-imports=silent \ + --show-column-numbers ${14} $1 exit_code=$? if [ "$exit_code" = "0" ]; then From d282401697a2563c89d834c7ab602903b9915364 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Mon, 25 Mar 2024 16:26:15 -0400 Subject: [PATCH 28/37] Remove Python 3.6 from tests to fix tests Python 3.6 is not available on ubuntu-latest (22.04). It was available when ubuntu-latest was 20.04. --- .github/workflows/all-lints.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 4b90a36..d86b0bd 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v1 - uses: marian-code/python-lint-annotate@master diff --git a/README.md b/README.md index f1b3a49..fc0beb3 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ steps: ## Details -Uses `actions/setup-python@v2`. Only python `3.6` - `3.10` version are tested since +Uses `actions/setup-python@v2`. Only python `3.7` - `3.10` version are tested since they are by far most common now. Other python `3.x` versions should also work. Any python `2.x` versions are unsupported! You can lint on Linux, Windows and MacOS. From cb8a0a6aa9921094ce1a252aa2eda134d2d04fb9 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Tue, 26 Mar 2024 19:14:20 -0400 Subject: [PATCH 29/37] Drop Python 3.7 and support only Python 3.8+ Python 3.7 is EOL, and updated versions of some dependencies, such as pylint 3, only support Python 3.8+. Drop Python 3.7 in preparation to update those dependencies, which in turn should enable support for Python 3.11 and 3.12. --- .github/workflows/all-lints.yml | 2 +- README.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index d86b0bd..e7fafc8 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v1 - uses: marian-code/python-lint-annotate@master diff --git a/README.md b/README.md index fc0beb3..d1939d9 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ steps: use-mypy: false use-vulture: true extra-pylint-options: "--output-format="colorized" - python-version: "3.7" + python-version: "3.8" ``` ### Examples @@ -54,7 +54,7 @@ steps: ## Details -Uses `actions/setup-python@v2`. Only python `3.7` - `3.10` version are tested since +Uses `actions/setup-python@v2`. Only python `3.8` - `3.10` version are tested since they are by far most common now. Other python `3.x` versions should also work. Any python `2.x` versions are unsupported! You can lint on Linux, Windows and MacOS. @@ -112,9 +112,9 @@ jobs: use-pylint: false use-flake8: false use-vulture: true - python-version: "3.7" + python-version: "3.8" - run: | - python --version # this will output 3.7 now !!! + python --version # this will output 3.8 now !!! ``` ## License From c45c0d642d328e0c32da119cf2ad70abd13d11d8 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Tue, 26 Mar 2024 19:21:04 -0400 Subject: [PATCH 30/37] Update first-party GitHub Actions Update first-party GitHub Actions to avoid warnings about node12 and node16. * Update actions/checkout from v1 to v4 * Update actions/setup-python from v2/v3 to v5 --- .github/workflows/all-lints.yml | 2 +- README.md | 14 +++++++------- action.yml | 2 +- examples/actions-only_changed_files.yml | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index d86b0bd..8785996 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -11,7 +11,7 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ['3.7', '3.8', '3.9', '3.10'] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - uses: marian-code/python-lint-annotate@master with: python-root-list: "./tests/*.py ./tests/subtest/*.py" diff --git a/README.md b/README.md index fc0beb3..6c74656 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Basic: ```yml steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - uses: marian-code/python-lint-annotate@v3 ``` @@ -38,7 +38,7 @@ Options: ```yml steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - uses: marian-code/python-lint-annotate@v3 with: python-root-list: "src/ tests/*" # accepts wildcards @@ -54,7 +54,7 @@ steps: ## Details -Uses `actions/setup-python@v2`. Only python `3.7` - `3.10` version are tested since +Uses `actions/setup-python@v5`. Only python `3.7` - `3.10` version are tested since they are by far most common now. Other python `3.x` versions should also work. Any python `2.x` versions are unsupported! You can lint on Linux, Windows and MacOS. @@ -73,9 +73,9 @@ isort==5.10.1 ## IMPORTANT - test environment -The python version is set by `actions/setup-python@v2` using composite actions. This +The python version is set by `actions/setup-python@v5` using composite actions. This means that the the action will change python you might have previously set with -`actions/setup-python@v2`. There are two ways to circumvent this. +`actions/setup-python@v5`. There are two ways to circumvent this. - Keep the lintnig action separated from others - Use it at the and of your workflow when the change in python version will not @@ -93,8 +93,8 @@ jobs: name: Lint Python runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: python-version: 3.9 - run: | diff --git a/action.yml b/action.yml index 5ec2538..74232d0 100644 --- a/action.yml +++ b/action.yml @@ -81,7 +81,7 @@ runs: using: "composite" steps: - name: Setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} architecture: x64 diff --git a/examples/actions-only_changed_files.yml b/examples/actions-only_changed_files.yml index 02209e4..3bb23bd 100644 --- a/examples/actions-only_changed_files.yml +++ b/examples/actions-only_changed_files.yml @@ -8,11 +8,11 @@ jobs: name: Lint steps: - name: Check out source repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 # This is necessary to get the commits - name: Set up Python environment - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.8" - name: Get changed python files between base and head From e8f67172cd843b95039135dd37ac5940a0aead2d Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Tue, 26 Mar 2024 19:57:32 -0400 Subject: [PATCH 31/37] Update pylint from 2.12.1 to 3.1.0 When trying to add Python 3.11 and 3.12, tests failed due to a dependency chain issue with the chain starting at pylint and ending at an outdated version of wrapt that did not support Python 3.11+. The earliest version of pylint with an updated version of wrapt is pylint 2.15. However, pylint 3.1.0 is the current version, so use that instead. --- README.md | 2 +- requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ac9c894..0d33b4e 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ The lintner versions are: ```bash pycodestyle==2.8.0 pydocstyle==6.1.1 -pylint==2.12.1 +pylint==3.1.0 mypy==0.910 black==21.11b1 flake8==4.0.1 diff --git a/requirements.txt b/requirements.txt index 73b61ff..80c2ceb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,5 @@ isort==5.10.1 mypy~=0.961 pycodestyle==2.8.0 pydocstyle==6.1.1 -pylint==2.12.1 -vulture==2.3 \ No newline at end of file +pylint==3.1.0 +vulture==2.3 From f1cd2e3629c083429414fa6d20b19fa9f4f02fc2 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Mon, 25 Mar 2024 16:04:03 -0400 Subject: [PATCH 32/37] Add Python 3.11 and 3.12 --- .github/workflows/all-lints.yml | 2 +- README.md | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 6f82fb2..ceea1c6 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 - uses: marian-code/python-lint-annotate@master diff --git a/README.md b/README.md index ac9c894..0d0379c 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,8 @@ steps: ## Details - -Uses `actions/setup-python@v5`. Only python `3.8` - `3.10` versions prior to `3.8` -are not tested since they are EOL now. +Uses `actions/setup-python@v5`. Only python `3.8` - `3.12` versions are tested. +Python `3.x` versions prior to `3.8` are not tested since they are EOL now. Any python `2.x` versions are unsupported! You can lint on Linux, Windows and MacOS. The lintner versions are: From ffe24b32a33241b668ab6d34150d7d8e1ad744ec Mon Sep 17 00:00:00 2001 From: marian-code Date: Wed, 3 Apr 2024 19:25:49 +0000 Subject: [PATCH 33/37] docs: Update Readme for the v4 release --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e65d0ce..7a522d0 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Basic: ```yml steps: - uses: actions/checkout@v4 - - uses: marian-code/python-lint-annotate@v3 + - uses: marian-code/python-lint-annotate@v4 ``` Options: @@ -39,7 +39,7 @@ Options: ```yml steps: - uses: actions/checkout@v4 - - uses: marian-code/python-lint-annotate@v3 + - uses: marian-code/python-lint-annotate@v4 with: python-root-list: "src/ tests/*" # accepts wildcards use-pycodestyle: false @@ -100,7 +100,7 @@ jobs: - run: | python --version # this will output 3.9 now run tests or other things using python ... - - uses: marian-code/python-lint-annotate@v3 + - uses: marian-code/python-lint-annotate@v4 with: python-root-list: "./tests/*.py" use-black: true From 9f245899e3a48d620542f3e608fa7c8b4f7fc832 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Wed, 3 Apr 2024 16:26:39 -0400 Subject: [PATCH 34/37] Update all requirements to latest versions Also, update the README to just point to requirements.txt. --- README.md | 13 +------------ requirements.txt | 14 +++++++------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 7a522d0..67b9243 100644 --- a/README.md +++ b/README.md @@ -58,18 +58,7 @@ Uses `actions/setup-python@v5`. Only python `3.8` - `3.12` versions are tested. Python `3.x` versions prior to `3.8` are not tested since they are EOL now. Any python `2.x` versions are unsupported! You can lint on Linux, Windows and MacOS. -The lintner versions are: - -```bash -pycodestyle==2.8.0 -pydocstyle==6.1.1 -pylint==3.1.0 -mypy==0.910 -black==21.11b1 -flake8==4.0.1 -vulture==2.3 -isort==5.10.1 -``` +The linter versions are defined in [requirements.txt](requirements.txt). ## IMPORTANT - test environment diff --git a/requirements.txt b/requirements.txt index 80c2ceb..95890b8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -black==21.11b1 -flake8==4.0.1 -isort==5.10.1 -mypy~=0.961 -pycodestyle==2.8.0 -pydocstyle==6.1.1 +black==24.3.0 +flake8==7.0.0 +isort==5.13.2 +mypy~=1.9.0 +pycodestyle==2.11.1 +pydocstyle==6.3.0 pylint==3.1.0 -vulture==2.3 +vulture==2.11 From 99fbd8921018fc177b5ac1d8db461f48af5d1544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claudio=20Alarc=C3=B3n=20Reyes?= Date: Sat, 16 Nov 2024 07:11:14 -0300 Subject: [PATCH 35/37] Using different macos versions for python older and newer than 3.11 --- .github/workflows/all-lints.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index ceea1c6..72071e5 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -8,8 +8,20 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-13, macos-latest, windows-latest] python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + exclude: + - os: macos-latest + python-version: 3.8 + - os: macos-latest + python-version: 3.9 + - os: macos-latest + python-version: 3.10 + - os: macos-13 + python-version: 3.11 + - os: macos-13 + python-version: 3.12 + steps: - uses: actions/checkout@v4 - uses: marian-code/python-lint-annotate@master From 93ec7a85c2919b649558edfff68099475d940c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claudio=20Alarc=C3=B3n=20Reyes?= Date: Wed, 13 Nov 2024 10:16:03 -0300 Subject: [PATCH 36/37] ISSUE-15 New parameter to use an existing python installation. - New parameter use-external-python to use an already installed python - Installation of requirements.txt uses --ignore-installed to avoid overriding versions defined in an external python - Adding a test workflow to check use-external-python --- .github/workflows/test-python-install.yml | 55 +++++++++++++++++++++++ action.yml | 10 ++++- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/test-python-install.yml diff --git a/.github/workflows/test-python-install.yml b/.github/workflows/test-python-install.yml new file mode 100644 index 0000000..038dcd5 --- /dev/null +++ b/.github/workflows/test-python-install.yml @@ -0,0 +1,55 @@ +on: + push: + pull_request: +name: Check python installation +jobs: + pythoninstall: + name: Test Python install + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ['3.11'] + use-external-python: [true, false] + env: + python-test-package: python-dummy + steps: + - uses: actions/checkout@v4 + + - name: Install Python if required + if: ${{ matrix.use-external-python }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install a test dependency if external Python is used + if: ${{ matrix.use-external-python }} + run: + pip install ${{ env.python-test-package }} + + - name: Test Action usage + uses: ./ + with: + python-root-list: "./tests/*.py ./tests/subtest/*.py" + use-black: true + use-isort: true + use-mypy: true + use-pycodestyle: true + use-pydocstyle: true + extra-pycodestyle-options: "--max-line-length=88" + use-pylint: false + use-flake8: false + use-vulture: true + python-version: ${{ matrix.python-version }} + use-external-python: ${{ matrix.use-external-python }} + + - name: Check if test dependency exists after execution + run: | + pip freeze > all-deps.txt + should_appear=$( if [[ "${{ matrix.use-external-python }}" == "true" ]]; then echo 0; else echo 1; fi ) + line_exists=$( grep -qF "${{ env.python-test-package }}" "all-deps.txt"; echo $? ) + echo "test package should be installed: ${{ matrix.use-external-python }}" + echo "test package is present (0 = present): ${line_exists}" + cat all-deps.txt + test "${should_appear}" == "${line_exists}" + diff --git a/action.yml b/action.yml index 74232d0..746853d 100644 --- a/action.yml +++ b/action.yml @@ -76,11 +76,17 @@ inputs: description: "Set desired python version with this keyword" required: false default: "3.8" + use-external-python: + description: "false (default): Install a new Python for this action; true: use the python installation in the previous steps" + type: boolean + required: false + default: false runs: using: "composite" steps: - name: Setup python + if: ${{ ! inputs.use-external-python }} uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} @@ -93,13 +99,13 @@ runs: - name: Windows install dependencies if: ${{ runner.os == 'Windows' }} run: | - pip install -r ${{ github.action_path }}\requirements.txt + pip install -r ${{ github.action_path }}\requirements.txt --ignore-installed echo "path_sep=" >> $GITHUB_ENV shell: pwsh - name: Posix install dependencies if: ${{ runner.os != 'Windows' }} - run: pip install -r ${{ github.action_path }}/requirements.txt + run: pip install -r ${{ github.action_path }}/requirements.txt --ignore-installed shell: bash - name: Lint on Windows From ea5c8b525589423a38d19c3e2671bccb05069db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claudio=20Alarc=C3=B3n=20Reyes?= Date: Mon, 25 Nov 2024 09:39:40 -0300 Subject: [PATCH 37/37] Fixes #19 Updating README and adding an example --- .github/workflows/all-lints.yml | 2 +- README.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/all-lints.yml b/.github/workflows/all-lints.yml index 72071e5..de59ecf 100644 --- a/.github/workflows/all-lints.yml +++ b/.github/workflows/all-lints.yml @@ -24,7 +24,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: marian-code/python-lint-annotate@master + - uses: ./ with: python-root-list: "./tests/*.py ./tests/subtest/*.py" use-black: true diff --git a/README.md b/README.md index 67b9243..34e8534 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ selected linters. - Zero configuration based: Add a single line in your CI and done! - GitHub Annotations on PR: Highlights issues inline on the PR diff. - Most of the popular community trusted linters in one place. +- Allows to use either a new or existing Python version using `use-external-python`. +See [this example](examples/actions-use_external_python.yml). ## Linters supported