diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 0f612b6..3a2164c 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.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: python-version: ${{ matrix.nox_session.python }} @@ -69,8 +70,24 @@ jobs: allow-build: info cache-build: true - - name: Install python ${{ matrix.nox_session.python }} for tests (3.13) - if: contains(fromJson('["3.13"]'), matrix.nox_session.python ) + # 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.14) + if: contains(fromJson('["3.14"]'), matrix.nox_session.python ) uses: actions/setup-python@v5 id: set-py-latest with: @@ -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 @@ -139,16 +156,17 @@ 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.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 +198,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 @@ -192,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..18e0798 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,10 @@ # 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. + + ### 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 20aff88..07da61f 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, PY38, PY39, PY310, PY311, PY312, PY313, 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 @@ -54,16 +52,13 @@ 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"}}, - 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()) @@ -289,34 +284,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)