From d282401697a2563c89d834c7ab602903b9915364 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Mon, 25 Mar 2024 16:26:15 -0400 Subject: [PATCH 01/10] 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 02/10] 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 03/10] 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 04/10] 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 05/10] 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 06/10] 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 07/10] 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 08/10] 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 09/10] 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 10/10] 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