Skip to content

Commit c8990e6

Browse files
authored
Merge pull request #114 from smarie/feature/py35_in_ci
Removing support for legacy python versions
2 parents 714fe1f + 3b1e628 commit c8990e6

File tree

5 files changed

+79
-53
lines changed

5 files changed

+79
-53
lines changed

.github/workflows/base.yml

+35-13
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/[email protected]
2727

2828
- name: Install python 3.9
29-
uses: actions/setup-python@v5.0.0
29+
uses: actions/setup-python@v5.1.0
3030
with:
3131
python-version: 3.9
3232
architecture: x64
@@ -59,18 +59,35 @@ jobs:
5959
- name: Checkout
6060
uses: actions/[email protected]
6161

62-
- name: Install python ${{ matrix.nox_session.python }} for tests
63-
if: ${{ ! contains(fromJson('["3.13"]'), matrix.nox_session.python ) }}
64-
uses: MatteoH2O1999/[email protected] # actions/[email protected]
62+
# General case
63+
- name: Install python ${{ matrix.nox_session.python }} for tests (not 3.5 not 3.14)
64+
if: ${{ ! contains(fromJson('["3.5", "3.14"]'), matrix.nox_session.python ) }}
65+
uses: MatteoH2O1999/setup-python@v4 # actions/[email protected]
6566
id: set-py
6667
with:
6768
python-version: ${{ matrix.nox_session.python }}
6869
architecture: x64
6970
allow-build: info
7071
cache-build: true
7172

72-
- name: Install python ${{ matrix.nox_session.python }} for tests (3.13)
73-
if: contains(fromJson('["3.13"]'), matrix.nox_session.python )
73+
# Particular case of issue with 3.5
74+
- name: Install python ${{ matrix.nox_session.python }} for tests (3.5)
75+
if: contains(fromJson('["3.5"]'), matrix.nox_session.python )
76+
uses: MatteoH2O1999/setup-python@v4 # actions/[email protected]
77+
id: set-py-35
78+
with:
79+
python-version: ${{ matrix.nox_session.python }}
80+
architecture: x64
81+
allow-build: info
82+
cache-build: true
83+
env:
84+
# workaround found in https://github.com/actions/setup-python/issues/866
85+
# for issue "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:728)" on Python 3.5
86+
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"
87+
88+
89+
- name: Install python ${{ matrix.nox_session.python }} for tests (3.14)
90+
if: contains(fromJson('["3.14"]'), matrix.nox_session.python )
7491
uses: actions/setup-python@v5
7592
id: set-py-latest
7693
with:
@@ -82,7 +99,7 @@ jobs:
8299
cache-build: true
83100

84101
- name: Install python 3.12 for nox
85-
uses: actions/setup-python@v5.0.0
102+
uses: actions/setup-python@v5.1.0
86103
with:
87104
python-version: 3.12
88105
architecture: x64
@@ -101,7 +118,7 @@ jobs:
101118
# Share ./docs/reports so that they can be deployed with doc in next job
102119
- name: Share reports with other jobs
103120
if: runner.os == 'Linux'
104-
uses: actions/[email protected].0
121+
uses: actions/[email protected].1
105122
with:
106123
name: reports_dir
107124
path: ./docs/reports
@@ -114,7 +131,7 @@ jobs:
114131
uses: actions/[email protected]
115132

116133
- name: Install python 3.9 for nox
117-
uses: actions/setup-python@v5.0.0
134+
uses: actions/setup-python@v5.1.0
118135
with:
119136
python-version: 3.9
120137
architecture: x64
@@ -139,16 +156,17 @@ jobs:
139156
uses: actions/[email protected]
140157
with:
141158
fetch-depth: 0 # so that gh-deploy works
159+
# persist-credentials: false # see https://github.com/orgs/community/discussions/25702
142160

143161
- name: Install python 3.9 for nox
144-
uses: actions/setup-python@v5.0.0
162+
uses: actions/setup-python@v5.1.0
145163
with:
146164
python-version: 3.9
147165
architecture: x64
148166

149167
# 1) retrieve the reports generated previously
150168
- name: Retrieve reports
151-
uses: actions/[email protected].1
169+
uses: actions/[email protected].4
152170
with:
153171
name: reports_dir
154172
path: ./docs/reports
@@ -180,7 +198,7 @@ jobs:
180198
EOF
181199
- name: \[not on TAG\] Publish coverage report
182200
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads')
183-
uses: codecov/codecov-action@v4.0.1
201+
uses: codecov/codecov-action@v4.1.1
184202
with:
185203
files: ./docs/reports/coverage/coverage.xml
186204
- name: \[not on TAG\] Build wheel and sdist
@@ -192,7 +210,11 @@ jobs:
192210
# 7) Create github release and build the wheel
193211
- name: \[TAG only\] Build wheel and create github release
194212
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
195-
run: nox -s release -- ${{ secrets.GITHUB_TOKEN }}
213+
# We would have to use a PAT instead of GITHUB_TOKEN if we want the next job to trigger.
214+
# See https://github.com/orgs/community/discussions/25702
215+
# For now we will rather rely on a "workflow completed" trigger to avoid
216+
# having a token expiration date to manage
217+
run: nox -s release -- ${{ secrets.GITHUB_TOKEN }} # ${{ secrets.WORKFLOW_SECRET}}
196218

197219
# 8) Publish the wheel on PyPi
198220
- name: \[TAG only\] Deploy on PyPi

ci_tools/nox_utils.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
nox_logger = logging.getLogger("nox")
1313

1414

15-
PY27, PY35, PY36, PY37, PY38, PY39, PY310, PY311, PY312, PY313 = ("2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10",
16-
"3.11", "3.12", "3.13")
15+
PY27, PY35, PY36, PY37, PY38, PY39, PY310, PY311, PY312, PY313, PY314 = (
16+
"2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"
17+
)
1718
DONT_INSTALL = "dont_install"
1819

1920

docs/changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
### 1.16.0 - (in progress) new python versions scope
4+
5+
- Removed official support for python versions `<3.9`. These versions will not run in CI anymore.
6+
7+
38
### 1.15.6 - compatibility fix
49

510
- Fixed issue with legacy python 2.7 and 3.5. Fixes [#110](https://github.com/smarie/python-makefun/issues/110)

noxfile.py

+31-36
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import argparse
2-
import json
31
import logging
42

53
import nox # noqa
@@ -9,7 +7,7 @@
97
# add parent folder to python path so that we can import noxfile_utils.py
108
# note that you need to "pip install -r noxfile-requiterements.txt" for this file to work.
119
sys.path.append(str(Path(__file__).parent / "ci_tools"))
12-
from nox_utils import (PY27, PY37, PY36, PY38, PY39, PY310, PY311, PY312, PY313, install_reqs, rm_folder, rm_file,
10+
from nox_utils import (PY39, PY310, PY311, PY312, PY313, PY314, install_reqs, rm_folder, rm_file,
1311
DONT_INSTALL) # noqa
1412

1513

@@ -54,16 +52,13 @@ class Folders:
5452

5553

5654
ENVS = {
55+
# PY314: {"coverage": False, "pkg_specs": {"pip": ">19"}},
5756
PY313: {"coverage": False, "pkg_specs": {"pip": ">19"}},
5857
PY312: {"coverage": False, "pkg_specs": {"pip": ">19"}},
5958
PY311: {"coverage": False, "pkg_specs": {"pip": ">19"}},
6059
PY310: {"coverage": False, "pkg_specs": {"pip": ">19"}},
61-
PY39: {"coverage": False, "pkg_specs": {"pip": ">19"}},
62-
PY38: {"coverage": False, "pkg_specs": {"pip": ">19"}},
63-
PY27: {"coverage": False, "pkg_specs": {"pip": ">10"}},
64-
PY36: {"coverage": False, "pkg_specs": {"pip": ">19"}},
6560
# IMPORTANT: this should be last so that the folder docs/reports is not deleted afterwards
66-
PY37: {"coverage": True, "pkg_specs": {"pip": ">19"}}, # , "pytest-html": "1.9.0"
61+
PY39: {"coverage": True, "pkg_specs": {"pip": ">19"}},
6762
}
6863

6964
ENV_PARAMS = tuple((k, v["coverage"], v["pkg_specs"]) for k, v in ENVS.items())
@@ -289,34 +284,34 @@ def release(session):
289284
"-d", f"https://{gh_org}.github.io/{gh_repo}/changelog", current_tag)
290285

291286

292-
@nox.session(python=False)
293-
def gha_list(session):
294-
"""(mandatory arg: <base_session_name>) Prints all sessions available for <base_session_name>, for GithubActions."""
295-
296-
# see https://stackoverflow.com/q/66747359/7262247
297-
298-
# The options
299-
parser = argparse.ArgumentParser()
300-
parser.add_argument("-s", "--session", help="The nox base session name")
301-
parser.add_argument(
302-
"-v",
303-
"--with_version",
304-
action="store_true",
305-
default=False,
306-
help="Return a list of lists where the first element is the python version and the second the nox session.",
307-
)
308-
additional_args = parser.parse_args(session.posargs)
309-
310-
# Now use --json CLI option
311-
out = session.run("nox", "-l", "--json", "-s", "tests", external=True, silent=True)
312-
sessions_list = [{"python": s["python"], "session": s["session"]} for s in json.loads(out)]
313-
314-
# TODO filter ?
315-
316-
# print the list so that it can be caught by GHA.
317-
# Note that json.dumps is optional since this is a list of string.
318-
# However it is to remind us that GHA expects a well-formatted json list of strings.
319-
print(json.dumps(sessions_list))
287+
# @nox.session(python=False)
288+
# def gha_list(session):
289+
# """(mandatory arg: <base_session_name>) Prints all sessions available for <base_session_name>, for GithubActions."""
290+
#
291+
# # see https://stackoverflow.com/q/66747359/7262247
292+
#
293+
# # The options
294+
# parser = argparse.ArgumentParser()
295+
# parser.add_argument("-s", "--session", help="The nox base session name")
296+
# parser.add_argument(
297+
# "-v",
298+
# "--with_version",
299+
# action="store_true",
300+
# default=False,
301+
# help="Return a list of lists where the first element is the python version and the second the nox session.",
302+
# )
303+
# additional_args = parser.parse_args(session.posargs)
304+
#
305+
# # Now use --json CLI option
306+
# out = session.run("nox", "-l", "--json", "-s", "tests", external=True, silent=True)
307+
# sessions_list = [{"python": s["python"], "session": s["session"]} for s in json.loads(out)]
308+
#
309+
# # TODO filter ?
310+
#
311+
# # print the list so that it can be caught by GHA.
312+
# # Note that json.dumps is optional since this is a list of string.
313+
# # However it is to remind us that GHA expects a well-formatted json list of strings.
314+
# print(json.dumps(sessions_list))
320315

321316

322317
# if __name__ == '__main__':

setup.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@
3434
"write_to": "src/makefun/_version.py",
3535
}
3636
# Use the 'version_file_template' directive if possible to avoid type hints and annotations (python <3.8)
37-
from packaging.version import Version
3837
setuptools_scm_version = pkg_resources.get_distribution("setuptools_scm").version
39-
if Version(setuptools_scm_version) >= Version('6'):
38+
# for some reason importing packaging.version.Version here fails on python 3.5
39+
# from packaging.version import Version
40+
# if Version(setuptools_scm_version) >= Version('6'):
41+
setuptools_scm_version_major = int(setuptools_scm_version.split(".")[0])
42+
if setuptools_scm_version_major >= 6:
4043
# template_arg_name = "version_file_template" if Version(setuptools_scm_version) >= Version('8.1') else "write_to_template"
4144
# print(Version(setuptools_scm_version))
4245
# print(template_arg_name)

0 commit comments

Comments
 (0)