Skip to content

Commit

Permalink
Merge pull request #111 from smarie/feature/110_compat
Browse files Browse the repository at this point in the history
Fixed compat with python < 3.8
  • Loading branch information
smarie authored Sep 26, 2024
2 parents d59b842 + e61cd0f commit 3fa920d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ jobs:
# 8) Publish the wheel on PyPi
- name: \[TAG only\] Deploy on PyPi
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.8.11
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 1.15.5 - compatibility fix

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

### 1.15.4 - Python 3.13 official support

- Python 3.13 is now supported. PR [#108](https://github.com/smarie/python-makefun/pull/108) and PR
Expand Down
2 changes: 1 addition & 1 deletion noxfile-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
virtualenv
nox
toml
makefun
setuptools<72 # later versions do not read 'tests_require' from setup.cfg anymore
setuptools_scm # used in 'release'
keyring # used in 'release'
6 changes: 3 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def tests(session, coverage, pkg_specs):
"-m", "pytest", "--cache-clear",
f"--junitxml={Folders.test_xml}", f"--html={Folders.test_html}",
"-v", "tests/")
session.run("coverage", "report")
session.run("coverage", "report") # this shows in terminal + fails under XX%, same as --cov-report term --cov-fail-under=70 # noqa
session.run("coverage", "xml", "-o", f"{Folders.coverage_xml}")
session.run("coverage", "html", "-d", f"{Folders.coverage_reports}")
# delete this intermediate file, it is not needed anymore
Expand All @@ -154,7 +154,7 @@ def flake8(session):
"""Launch flake8 qualimetry."""

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

rm_folder(Folders.flake8_reports)
Folders.flake8_reports.mkdir(parents=True, exist_ok=True)
Expand Down Expand Up @@ -285,7 +285,7 @@ def gha_list(session):
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
# 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.
Expand Down
18 changes: 15 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,22 @@
DOWNLOAD_URL = URL + "/tarball/" + get_version()


# Setuptools_scm target version file to generate
args = {
"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('8.1.0'):
# Note that it was named 'write_to_template' earlier. But at that time it was not generating annotations so no need.
args["version_file_template"] = """# file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = '{version}'
__version_tuple__ = version_tuple = {version_tuple}
"""
# (3) Call setup() with as little args as possible
setup(
download_url=DOWNLOAD_URL,
use_scm_version={
"write_to": "src/makefun/_version.py"
}, # we can't put `use_scm_version` in setup.cfg yet unfortunately
use_scm_version=args
)

0 comments on commit 3fa920d

Please sign in to comment.