From 836a0bcacae1eb65ea6416f268468701dc50ac1b Mon Sep 17 00:00:00 2001 From: Michael duBois Date: Fri, 1 Oct 2021 10:57:24 -0600 Subject: [PATCH 1/4] Added to CONTRIBUTORS --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 23fa8f30..1df5a591 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -48,3 +48,4 @@ Halle Jones|HJones@aliacy.com|| [Mateus Denucci Garcia Seabra Resende](https://github.com/MateusDenucci) | | [Victor Hart](https://github.com/vicohart) | [vicohart@gmail.com](vicohart@gmail.com) | [nilamo](https://github.com/nilamo) | [7nilamo@gmail.com](7nilamo@gmail.com) | +[Michael duBois](https://github.com/MichaelCduBois) | | From eb9b44f67791b995c3cc8e1e45e029f2260d4d3f Mon Sep 17 00:00:00 2001 From: Michael duBois Date: Fri, 1 Oct 2021 15:03:11 -0600 Subject: [PATCH 2/4] Checking python version for planned deprecation. --- ppb/__init__.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ppb/__init__.py b/ppb/__init__.py index 76e69e7b..1f7cd5f2 100644 --- a/ppb/__init__.py +++ b/ppb/__init__.py @@ -30,6 +30,7 @@ """ import logging +from sys import version_info from typing import Callable from ppb import directions @@ -73,6 +74,30 @@ def _make_kwargs(setup, title, engine_opts): return kwargs +def _validate_python_support(required_version='3.7', ppb_release='2.0', + release_date='June 2022'): + """ + Verifies Supported Python Version. + + This function verifies ppb is running on a supported Python version. + + :param required_version: Minimum Python Version Supported by PPB + :type required_version: str + :param ppb_release: PPB release version deprecation will occur + :type ppb_relase: str + :param release_date: Estimated release month for PPB Version + :type release_date: str + """ + # Creates (Major, Minor) version tuples for comparisson + if version_info[0:2] <= tuple(map(int, required_version.split('.'))): + deprecation_message = f"PPB v{ppb_release} will no longer support "\ + f"Python {version_info[0]}.{version_info[1]} " \ + f"once released around {release_date}. Please " \ + f"update to Python {required_version} or newer." + logger = logging.getLogger(__name__) + logger.warning(f"Deprecation Warning: {deprecation_message}") + + def run(setup: Callable[[Scene], None] = None, *, log_level=logging.WARNING, starting_scene=Scene, title="PursuedPyBear", **engine_opts): """ @@ -122,6 +147,8 @@ def __init__(self, **kwargs): """ logging.basicConfig(level=log_level) + _validate_python_support() + with make_engine(setup, starting_scene=starting_scene, title=title, **engine_opts) as eng: eng.run() From cd0253f412cda917e8abd510e5699d329bf7aa7d Mon Sep 17 00:00:00 2001 From: Michael duBois Date: Sat, 2 Oct 2021 20:58:18 -0600 Subject: [PATCH 3/4] Corrected Spelling --- ppb/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppb/__init__.py b/ppb/__init__.py index 1f7cd5f2..8882cc78 100644 --- a/ppb/__init__.py +++ b/ppb/__init__.py @@ -84,7 +84,7 @@ def _validate_python_support(required_version='3.7', ppb_release='2.0', :param required_version: Minimum Python Version Supported by PPB :type required_version: str :param ppb_release: PPB release version deprecation will occur - :type ppb_relase: str + :type ppb_release: str :param release_date: Estimated release month for PPB Version :type release_date: str """ From 6871abec1af4d429862c96ea2ad16cbf498494b8 Mon Sep 17 00:00:00 2001 From: Michael duBois Date: Sat, 2 Oct 2021 21:10:30 -0600 Subject: [PATCH 4/4] Migrating from logger.warning to warnings.warn. --- ppb/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppb/__init__.py b/ppb/__init__.py index 8882cc78..ea6b7e85 100644 --- a/ppb/__init__.py +++ b/ppb/__init__.py @@ -94,8 +94,8 @@ def _validate_python_support(required_version='3.7', ppb_release='2.0', f"Python {version_info[0]}.{version_info[1]} " \ f"once released around {release_date}. Please " \ f"update to Python {required_version} or newer." - logger = logging.getLogger(__name__) - logger.warning(f"Deprecation Warning: {deprecation_message}") + warnings.filterwarnings('default') + warnings.warn(deprecation_message, DeprecationWarning) def run(setup: Callable[[Scene], None] = None, *, log_level=logging.WARNING,