From 6f123d767b2c37e295da31ce46274bfbc673007a Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Fri, 9 May 2025 14:43:35 +0200 Subject: [PATCH 1/5] Upgraded GHA workflow to enable python 3.5. removed useless nox session --- .github/workflows/base.yml | 37 +++++++++++++++++------- noxfile.py | 59 +++++++++++++++++++------------------- setup.py | 7 +++-- 3 files changed, 62 insertions(+), 41 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 0f612b6..e60ceab 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v4.1.1 - name: Install python 3.9 - uses: actions/setup-python@v5.0.0 + uses: actions/setup-python@v5.1.0 with: python-version: 3.9 architecture: x64 @@ -59,9 +59,10 @@ jobs: - name: Checkout uses: actions/checkout@v4.1.1 - - name: Install python ${{ matrix.nox_session.python }} for tests - if: ${{ ! contains(fromJson('["3.13"]'), matrix.nox_session.python ) }} - uses: MatteoH2O1999/setup-python@v3.2.1 # actions/setup-python@v5.0.0 + # General case + - name: Install python ${{ matrix.nox_session.python }} for tests (not 3.5 not 3.13) + if: ${{ ! contains(fromJson('["3.5", "3.13"]'), matrix.nox_session.python ) }} + uses: MatteoH2O1999/setup-python@v4 # actions/setup-python@v5.0.0 id: set-py with: python-version: ${{ matrix.nox_session.python }} @@ -69,6 +70,22 @@ jobs: allow-build: info cache-build: true + # Particular case of issue with 3.5 + - name: Install python ${{ matrix.nox_session.python }} for tests (3.5) + if: contains(fromJson('["3.5"]'), matrix.nox_session.python ) + uses: MatteoH2O1999/setup-python@v4 # actions/setup-python@v5.0.0 + id: set-py-35 + with: + python-version: ${{ matrix.nox_session.python }} + architecture: x64 + allow-build: info + cache-build: true + env: + # workaround found in https://github.com/actions/setup-python/issues/866 + # for issue "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:728)" on Python 3.5 + PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org" + + - name: Install python ${{ matrix.nox_session.python }} for tests (3.13) if: contains(fromJson('["3.13"]'), matrix.nox_session.python ) uses: actions/setup-python@v5 @@ -82,7 +99,7 @@ jobs: cache-build: true - name: Install python 3.12 for nox - uses: actions/setup-python@v5.0.0 + uses: actions/setup-python@v5.1.0 with: python-version: 3.12 architecture: x64 @@ -101,7 +118,7 @@ jobs: # Share ./docs/reports so that they can be deployed with doc in next job - name: Share reports with other jobs if: runner.os == 'Linux' - uses: actions/upload-artifact@v4.3.0 + uses: actions/upload-artifact@v4.3.1 with: name: reports_dir path: ./docs/reports @@ -114,7 +131,7 @@ jobs: uses: actions/checkout@v4.1.1 - name: Install python 3.9 for nox - uses: actions/setup-python@v5.0.0 + uses: actions/setup-python@v5.1.0 with: python-version: 3.9 architecture: x64 @@ -141,14 +158,14 @@ jobs: fetch-depth: 0 # so that gh-deploy works - name: Install python 3.9 for nox - uses: actions/setup-python@v5.0.0 + uses: actions/setup-python@v5.1.0 with: python-version: 3.9 architecture: x64 # 1) retrieve the reports generated previously - name: Retrieve reports - uses: actions/download-artifact@v4.1.1 + uses: actions/download-artifact@v4.1.4 with: name: reports_dir path: ./docs/reports @@ -180,7 +197,7 @@ jobs: EOF - name: \[not on TAG\] Publish coverage report if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads') - uses: codecov/codecov-action@v4.0.1 + uses: codecov/codecov-action@v4.1.1 with: files: ./docs/reports/coverage/coverage.xml - name: \[not on TAG\] Build wheel and sdist diff --git a/noxfile.py b/noxfile.py index 20aff88..39fb424 100644 --- a/noxfile.py +++ b/noxfile.py @@ -9,7 +9,7 @@ # add parent folder to python path so that we can import noxfile_utils.py # note that you need to "pip install -r noxfile-requiterements.txt" for this file to work. sys.path.append(str(Path(__file__).parent / "ci_tools")) -from nox_utils import (PY27, PY37, PY36, PY38, PY39, PY310, PY311, PY312, PY313, install_reqs, rm_folder, rm_file, +from nox_utils import (PY27, PY37, PY36, PY35, PY38, PY39, PY310, PY311, PY312, PY313, install_reqs, rm_folder, rm_file, DONT_INSTALL) # noqa @@ -61,6 +61,7 @@ class Folders: PY39: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY38: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY27: {"coverage": False, "pkg_specs": {"pip": ">10"}}, + PY35: {"coverage": False, "pkg_specs": {"pip": ">10"}}, PY36: {"coverage": False, "pkg_specs": {"pip": ">19"}}, # IMPORTANT: this should be last so that the folder docs/reports is not deleted afterwards PY37: {"coverage": True, "pkg_specs": {"pip": ">19"}}, # , "pytest-html": "1.9.0" @@ -289,34 +290,34 @@ def release(session): "-d", f"https://{gh_org}.github.io/{gh_repo}/changelog", current_tag) -@nox.session(python=False) -def gha_list(session): - """(mandatory arg: ) Prints all sessions available for , for GithubActions.""" - - # see https://stackoverflow.com/q/66747359/7262247 - - # The options - parser = argparse.ArgumentParser() - parser.add_argument("-s", "--session", help="The nox base session name") - parser.add_argument( - "-v", - "--with_version", - action="store_true", - default=False, - help="Return a list of lists where the first element is the python version and the second the nox session.", - ) - additional_args = parser.parse_args(session.posargs) - - # Now use --json CLI option - out = session.run("nox", "-l", "--json", "-s", "tests", external=True, silent=True) - sessions_list = [{"python": s["python"], "session": s["session"]} for s in json.loads(out)] - - # TODO filter ? - - # print the list so that it can be caught by GHA. - # Note that json.dumps is optional since this is a list of string. - # However it is to remind us that GHA expects a well-formatted json list of strings. - print(json.dumps(sessions_list)) +# @nox.session(python=False) +# def gha_list(session): +# """(mandatory arg: ) Prints all sessions available for , for GithubActions.""" +# +# # see https://stackoverflow.com/q/66747359/7262247 +# +# # The options +# parser = argparse.ArgumentParser() +# parser.add_argument("-s", "--session", help="The nox base session name") +# parser.add_argument( +# "-v", +# "--with_version", +# action="store_true", +# default=False, +# help="Return a list of lists where the first element is the python version and the second the nox session.", +# ) +# additional_args = parser.parse_args(session.posargs) +# +# # Now use --json CLI option +# out = session.run("nox", "-l", "--json", "-s", "tests", external=True, silent=True) +# sessions_list = [{"python": s["python"], "session": s["session"]} for s in json.loads(out)] +# +# # TODO filter ? +# +# # print the list so that it can be caught by GHA. +# # Note that json.dumps is optional since this is a list of string. +# # However it is to remind us that GHA expects a well-formatted json list of strings. +# print(json.dumps(sessions_list)) # if __name__ == '__main__': diff --git a/setup.py b/setup.py index b05033e..a6c1577 100644 --- a/setup.py +++ b/setup.py @@ -34,9 +34,12 @@ "write_to": "src/makefun/_version.py", } # Use the 'version_file_template' directive if possible to avoid type hints and annotations (python <3.8) -from packaging.version import Version setuptools_scm_version = pkg_resources.get_distribution("setuptools_scm").version -if Version(setuptools_scm_version) >= Version('6'): +# for some reason importing packaging.version.Version here fails on python 3.5 +# from packaging.version import Version +# if Version(setuptools_scm_version) >= Version('6'): +setuptools_scm_version_major = int(setuptools_scm_version.split(".")[0]) +if setuptools_scm_version_major >= 6: # template_arg_name = "version_file_template" if Version(setuptools_scm_version) >= Version('8.1') else "write_to_template" # print(Version(setuptools_scm_version)) # print(template_arg_name) From 5cb946626b947bfb6aed362409184dd613d47aa5 Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Fri, 9 May 2025 15:34:37 +0200 Subject: [PATCH 2/5] Removed official support for python versions `<3.9`. These versions will not run in CI anymore. Note that `2.7` is still supported - until corresponding github action stops working. --- .github/workflows/base.yml | 7 ++++++- ci_tools/nox_utils.py | 5 +++-- docs/changelog.md | 6 ++++++ noxfile.py | 11 +++-------- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index e60ceab..d02a96a 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -156,6 +156,7 @@ jobs: uses: actions/checkout@v4.1.1 with: fetch-depth: 0 # so that gh-deploy works + # persist-credentials: false # see https://github.com/orgs/community/discussions/25702 - name: Install python 3.9 for nox uses: actions/setup-python@v5.1.0 @@ -209,7 +210,11 @@ jobs: # 7) Create github release and build the wheel - name: \[TAG only\] Build wheel and create github release if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - run: nox -s release -- ${{ secrets.GITHUB_TOKEN }} + # We would have to use a PAT instead of GITHUB_TOKEN if we want the next job to trigger. + # See https://github.com/orgs/community/discussions/25702 + # For now we will rather rely on a "workflow completed" trigger to avoid + # having a token expiration date to manage + run: nox -s release -- ${{ secrets.GITHUB_TOKEN }} # ${{ secrets.WORKFLOW_SECRET}} # 8) Publish the wheel on PyPi - name: \[TAG only\] Deploy on PyPi diff --git a/ci_tools/nox_utils.py b/ci_tools/nox_utils.py index 3c4df0f..74a9b15 100644 --- a/ci_tools/nox_utils.py +++ b/ci_tools/nox_utils.py @@ -12,8 +12,9 @@ nox_logger = logging.getLogger("nox") -PY27, PY35, PY36, PY37, PY38, PY39, PY310, PY311, PY312, PY313 = ("2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", - "3.11", "3.12", "3.13") +PY27, PY35, PY36, PY37, PY38, PY39, PY310, PY311, PY312, PY313, PY314 = ( + "2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" +) DONT_INSTALL = "dont_install" diff --git a/docs/changelog.md b/docs/changelog.md index fcc3a22..f61dc06 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,11 @@ # Changelog +### 1.16.0 - (in progress) new python versions scope + +- Removed official support for python versions `<3.9`. These versions will not run in CI anymore. Note that `2.7` is + still supported - until corresponding github action stops working. + + ### 1.15.6 - compatibility fix - Fixed issue with legacy python 2.7 and 3.5. Fixes [#110](https://github.com/smarie/python-makefun/issues/110) diff --git a/noxfile.py b/noxfile.py index 39fb424..317c876 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,5 +1,3 @@ -import argparse -import json import logging import nox # noqa @@ -9,7 +7,7 @@ # add parent folder to python path so that we can import noxfile_utils.py # note that you need to "pip install -r noxfile-requiterements.txt" for this file to work. sys.path.append(str(Path(__file__).parent / "ci_tools")) -from nox_utils import (PY27, PY37, PY36, PY35, PY38, PY39, PY310, PY311, PY312, PY313, install_reqs, rm_folder, rm_file, +from nox_utils import (PY27, PY39, PY310, PY311, PY312, PY313, PY314, install_reqs, rm_folder, rm_file, DONT_INSTALL) # noqa @@ -54,17 +52,14 @@ class Folders: ENVS = { + PY314: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY313: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY312: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY311: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY310: {"coverage": False, "pkg_specs": {"pip": ">19"}}, - PY39: {"coverage": False, "pkg_specs": {"pip": ">19"}}, - PY38: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY27: {"coverage": False, "pkg_specs": {"pip": ">10"}}, - PY35: {"coverage": False, "pkg_specs": {"pip": ">10"}}, - PY36: {"coverage": False, "pkg_specs": {"pip": ">19"}}, # IMPORTANT: this should be last so that the folder docs/reports is not deleted afterwards - PY37: {"coverage": True, "pkg_specs": {"pip": ">19"}}, # , "pytest-html": "1.9.0" + PY39: {"coverage": True, "pkg_specs": {"pip": ">19"}}, } ENV_PARAMS = tuple((k, v["coverage"], v["pkg_specs"]) for k, v in ENVS.items()) From 19b2d3c3a52f1f0474f68ca9972eec48526534cb Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Fri, 9 May 2025 15:36:52 +0200 Subject: [PATCH 3/5] Added pre-releases for 3.14 --- .github/workflows/base.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index d02a96a..3a2164c 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -60,8 +60,8 @@ jobs: uses: actions/checkout@v4.1.1 # General case - - name: Install python ${{ matrix.nox_session.python }} for tests (not 3.5 not 3.13) - if: ${{ ! contains(fromJson('["3.5", "3.13"]'), matrix.nox_session.python ) }} + - name: Install python ${{ matrix.nox_session.python }} for tests (not 3.5 not 3.14) + if: ${{ ! contains(fromJson('["3.5", "3.14"]'), matrix.nox_session.python ) }} uses: MatteoH2O1999/setup-python@v4 # actions/setup-python@v5.0.0 id: set-py with: @@ -86,8 +86,8 @@ jobs: PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org" - - name: Install python ${{ matrix.nox_session.python }} for tests (3.13) - if: contains(fromJson('["3.13"]'), matrix.nox_session.python ) + - name: Install python ${{ matrix.nox_session.python }} for tests (3.14) + if: contains(fromJson('["3.14"]'), matrix.nox_session.python ) uses: actions/setup-python@v5 id: set-py-latest with: From 6483678650a424b419ce54c080dc925bda8e3b40 Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Fri, 9 May 2025 15:38:53 +0200 Subject: [PATCH 4/5] Removed python 2.7 too from the supported ones --- docs/changelog.md | 3 +-- noxfile.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index f61dc06..18e0798 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,8 +2,7 @@ ### 1.16.0 - (in progress) new python versions scope -- Removed official support for python versions `<3.9`. These versions will not run in CI anymore. Note that `2.7` is - still supported - until corresponding github action stops working. +- Removed official support for python versions `<3.9`. These versions will not run in CI anymore. ### 1.15.6 - compatibility fix diff --git a/noxfile.py b/noxfile.py index 317c876..3e58570 100644 --- a/noxfile.py +++ b/noxfile.py @@ -7,7 +7,7 @@ # add parent folder to python path so that we can import noxfile_utils.py # note that you need to "pip install -r noxfile-requiterements.txt" for this file to work. sys.path.append(str(Path(__file__).parent / "ci_tools")) -from nox_utils import (PY27, PY39, PY310, PY311, PY312, PY313, PY314, install_reqs, rm_folder, rm_file, +from nox_utils import (PY39, PY310, PY311, PY312, PY313, PY314, install_reqs, rm_folder, rm_file, DONT_INSTALL) # noqa @@ -57,7 +57,6 @@ class Folders: PY312: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY311: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY310: {"coverage": False, "pkg_specs": {"pip": ">19"}}, - PY27: {"coverage": False, "pkg_specs": {"pip": ">10"}}, # IMPORTANT: this should be last so that the folder docs/reports is not deleted afterwards PY39: {"coverage": True, "pkg_specs": {"pip": ">19"}}, } From 3b1e628e9e7ecf05ea9bc6a9fb73c45563a3c24a Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Fri, 9 May 2025 15:40:45 +0200 Subject: [PATCH 5/5] Removed 3.14 for now --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 3e58570..07da61f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -52,7 +52,7 @@ class Folders: ENVS = { - PY314: {"coverage": False, "pkg_specs": {"pip": ">19"}}, + # PY314: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY313: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY312: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY311: {"coverage": False, "pkg_specs": {"pip": ">19"}},