Skip to content

Commit 3fa920d

Browse files
authored
Merge pull request #111 from smarie/feature/110_compat
Fixed compat with python < 3.8
2 parents d59b842 + e61cd0f commit 3fa920d

5 files changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ jobs:
194194
# 8) Publish the wheel on PyPi
195195
- name: \[TAG only\] Deploy on PyPi
196196
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
197-
uses: pypa/gh-action-pypi-publish@v1.8.11
197+
uses: pypa/gh-action-pypi-publish@release/v1
198198
with:
199199
user: __token__
200200
password: ${{ secrets.PYPI_API_TOKEN }}

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
### 1.15.5 - compatibility fix
4+
5+
- Fixed issue with legacy python 2.7 and 3.5. Fixes [#110](https://github.com/smarie/python-makefun/issues/110)
6+
37
### 1.15.4 - Python 3.13 official support
48

59
- Python 3.13 is now supported. PR [#108](https://github.com/smarie/python-makefun/pull/108) and PR

noxfile-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
virtualenv
22
nox
33
toml
4-
makefun
4+
setuptools<72 # later versions do not read 'tests_require' from setup.cfg anymore
55
setuptools_scm # used in 'release'
66
keyring # used in 'release'

noxfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def tests(session, coverage, pkg_specs):
136136
"-m", "pytest", "--cache-clear",
137137
f"--junitxml={Folders.test_xml}", f"--html={Folders.test_html}",
138138
"-v", "tests/")
139-
session.run("coverage", "report")
139+
session.run("coverage", "report") # this shows in terminal + fails under XX%, same as --cov-report term --cov-fail-under=70 # noqa
140140
session.run("coverage", "xml", "-o", f"{Folders.coverage_xml}")
141141
session.run("coverage", "html", "-d", f"{Folders.coverage_reports}")
142142
# delete this intermediate file, it is not needed anymore
@@ -154,7 +154,7 @@ def flake8(session):
154154
"""Launch flake8 qualimetry."""
155155

156156
session.install("-r", str(Folders.ci_tools / "flake8-requirements.txt"))
157-
session.run("pip", "install", ".")
157+
session.install(".")
158158

159159
rm_folder(Folders.flake8_reports)
160160
Folders.flake8_reports.mkdir(parents=True, exist_ok=True)
@@ -285,7 +285,7 @@ def gha_list(session):
285285
out = session.run("nox", "-l", "--json", "-s", "tests", external=True, silent=True)
286286
sessions_list = [{"python": s["python"], "session": s["session"]} for s in json.loads(out)]
287287

288-
# TODO filter
288+
# TODO filter ?
289289

290290
# print the list so that it can be caught by GHA.
291291
# Note that json.dumps is optional since this is a list of string.

setup.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,22 @@
2929
DOWNLOAD_URL = URL + "/tarball/" + get_version()
3030

3131

32+
# Setuptools_scm target version file to generate
33+
args = {
34+
"write_to": "src/makefun/_version.py",
35+
}
36+
# Use the 'version_file_template' directive if possible to avoid type hints and annotations (python <3.8)
37+
from packaging.version import Version
38+
setuptools_scm_version = pkg_resources.get_distribution("setuptools_scm").version
39+
if Version(setuptools_scm_version) >= Version('8.1.0'):
40+
# Note that it was named 'write_to_template' earlier. But at that time it was not generating annotations so no need.
41+
args["version_file_template"] = """# file generated by setuptools_scm
42+
# don't change, don't track in version control
43+
__version__ = version = '{version}'
44+
__version_tuple__ = version_tuple = {version_tuple}
45+
"""
3246
# (3) Call setup() with as little args as possible
3347
setup(
3448
download_url=DOWNLOAD_URL,
35-
use_scm_version={
36-
"write_to": "src/makefun/_version.py"
37-
}, # we can't put `use_scm_version` in setup.cfg yet unfortunately
49+
use_scm_version=args
3850
)

0 commit comments

Comments
 (0)