Skip to content

Commit

Permalink
Merge #640
Browse files Browse the repository at this point in the history
640: Deprecation warning for python3.6 r=pathunstrom a=MichaelCduBois

This is the feature for #636 

If the user is running Python 3.6 a deprecation warning is logged.

Co-authored-by: Michael duBois <mdubois@bytement.com>
Co-authored-by: Michael duBois <39778093+MichaelCduBois@users.noreply.github.com>
Co-authored-by: Piper Thunstrom <pathunstrom@gmail.com>
  • Loading branch information
4 people authored Oct 8, 2021
2 parents dac9190 + 2b34e05 commit a87329c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ Halle Jones|HJones@aliacy.com||
[Victor Hart](https://github.com/vicohart) | [vicohart@gmail.com](vicohart@gmail.com) |
[nilamo](https://github.com/nilamo) | [7nilamo@gmail.com](7nilamo@gmail.com) |
[Abhijeet](https://github.com/abhijeetgupto) |[abhigupta7b@gmail.com](abhigupta7b@gmail.com) | [@abhijeetgupto](https://twitter.com/abhijeetgupto)|
[Michael duBois](https://github.com/MichaelCduBois) | |
[Stephen James](https://github.com/sjames1958gm) | [sajames1958@gmail.com](sajames1958@gmail.com) |
[Sergio Gavilán](https://github.com/sgavil) | [ssjsrgx@gmail.com](ssjsrgx@gmail.com) | [@sgavil01](https://twitter.com/sgavil01)

27 changes: 27 additions & 0 deletions ppb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"""

import logging
from sys import version_info
from typing import Callable

from ppb import directions
Expand Down Expand Up @@ -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_release: 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."
warnings.filterwarnings('default')
warnings.warn(deprecation_message, DeprecationWarning)


def run(setup: Callable[[Scene], None] = None, *, log_level=logging.WARNING,
starting_scene=Scene, title="PursuedPyBear", **engine_opts):
"""
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit a87329c

Please sign in to comment.