Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 35 additions & 13 deletions .github/workflows/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -59,18 +59,35 @@ 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 }}
architecture: x64
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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions ci_tools/nox_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
67 changes: 31 additions & 36 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import argparse
import json
import logging

import nox # noqa
Expand All @@ -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


Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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: <base_session_name>) Prints all sessions available for <base_session_name>, 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: <base_session_name>) Prints all sessions available for <base_session_name>, 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__':
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading