From 806dde1936cd3a032ba78570be4627ac51f49d03 Mon Sep 17 00:00:00 2001 From: Cobalt Date: Thu, 27 May 2021 12:02:58 +0200 Subject: [PATCH 1/6] Add deprecation warning for 3.5 and lower The messages might need adjustment, but the test is working. --- src/gino/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gino/__init__.py b/src/gino/__init__.py index a776568f..a1ff80a9 100644 --- a/src/gino/__init__.py +++ b/src/gino/__init__.py @@ -1,4 +1,5 @@ import logging +import sys from .api import Gino # NOQA from .bakery import Bakery @@ -45,6 +46,19 @@ def get_version(): return version("gino") +# Check if current python version is deprecated +try: + # Get version from sys.vrsion value (usually: '3.7.0 ...') + subversion = int(sys.version[2]) + + # Check if version is lower than 3.6 + if subversion < 6: + print("DEPRECATION WARNING: Python version 3.5 and lower are not supported since they've reached EOL") +except ValueError: + # Unable to determine version leads to warning + print("WARNING: Unable to determine current python version") + + # noinspection PyBroadException try: __version__ = get_version() From 4acc65bcac84c3735e677fc1d2e39ed492c8f3c7 Mon Sep 17 00:00:00 2001 From: Cobalt Date: Thu, 27 May 2021 12:09:31 +0200 Subject: [PATCH 2/6] fix style --- src/gino/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gino/__init__.py b/src/gino/__init__.py index a1ff80a9..28713c26 100644 --- a/src/gino/__init__.py +++ b/src/gino/__init__.py @@ -53,7 +53,9 @@ def get_version(): # Check if version is lower than 3.6 if subversion < 6: - print("DEPRECATION WARNING: Python version 3.5 and lower are not supported since they've reached EOL") + print( + "DEPRECATION WARNING: Python version 3.5 and lower are not supported since they've reached EOL" + ) except ValueError: # Unable to determine version leads to warning print("WARNING: Unable to determine current python version") From 2254489f81a37548e31c503e413bc2e386788b41 Mon Sep 17 00:00:00 2001 From: Cobalt Date: Thu, 27 May 2021 12:13:05 +0200 Subject: [PATCH 3/6] fix style [2] I really hate black sometimes --- src/gino/__init__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/gino/__init__.py b/src/gino/__init__.py index 28713c26..7e34c6d1 100644 --- a/src/gino/__init__.py +++ b/src/gino/__init__.py @@ -15,18 +15,14 @@ def create_engine(*args, **kwargs): """ Shortcut for :func:`sqlalchemy.create_engine` with ``strategy="gino"``. - .. versionchanged:: 1.1 Added the ``bakery`` keyword argument, please see :class:`~.bakery.Bakery`. - .. versionchanged:: 1.1 Added the ``prebake`` keyword argument to choose when to create the prepared statements for the queries in the bakery: - * **Pre-bake** immediately when connected to the database (default). * No **pre-bake** but create prepared statements lazily when needed for the first time. - Note: ``prebake`` has no effect in aiomysql """ @@ -60,7 +56,7 @@ def get_version(): # Unable to determine version leads to warning print("WARNING: Unable to determine current python version") - + # noinspection PyBroadException try: __version__ = get_version() From 7b3464bba6af00ab7e9bdd244cae5648a0706aa1 Mon Sep 17 00:00:00 2001 From: Cobalt Date: Fri, 28 May 2021 08:59:51 +0000 Subject: [PATCH 4/6] change from print to warnings --- src/gino/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gino/__init__.py b/src/gino/__init__.py index 7e34c6d1..fa09fa13 100644 --- a/src/gino/__init__.py +++ b/src/gino/__init__.py @@ -1,5 +1,6 @@ import logging import sys +import warnings from .api import Gino # NOQA from .bakery import Bakery @@ -44,13 +45,14 @@ def get_version(): # Check if current python version is deprecated try: - # Get version from sys.vrsion value (usually: '3.7.0 ...') + # Get version from sys.version value (usually: '3.7.0 ...') subversion = int(sys.version[2]) # Check if version is lower than 3.6 if subversion < 6: - print( - "DEPRECATION WARNING: Python version 3.5 and lower are not supported since they've reached EOL" + warnings.warn( + "DEPRECATION WARNING: Python version 3.5 and lower are not supported", + DeprecationWarning, ) except ValueError: # Unable to determine version leads to warning From da51cb3c213496975227bef48cef7ba87587a251 Mon Sep 17 00:00:00 2001 From: Cobalt Date: Sun, 30 May 2021 16:12:26 +0000 Subject: [PATCH 5/6] hopefully last fix --- src/gino/__init__.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/gino/__init__.py b/src/gino/__init__.py index fa09fa13..b120f211 100644 --- a/src/gino/__init__.py +++ b/src/gino/__init__.py @@ -44,19 +44,12 @@ def get_version(): # Check if current python version is deprecated -try: - # Get version from sys.version value (usually: '3.7.0 ...') - subversion = int(sys.version[2]) - - # Check if version is lower than 3.6 - if subversion < 6: - warnings.warn( - "DEPRECATION WARNING: Python version 3.5 and lower are not supported", - DeprecationWarning, - ) -except ValueError: - # Unable to determine version leads to warning - print("WARNING: Unable to determine current python version") +# Check if version is lower than 3.6 +if sys.version_info < (3, 6): + warnings.warn( + "DEPRECATION WARNING: Python version 3.5 and lower are not supported", + DeprecationWarning, + ) # noinspection PyBroadException From 91d69b05893bc6d06a372565fd1d90a7fc2bb50a Mon Sep 17 00:00:00 2001 From: Cobalt Date: Wed, 9 Jun 2021 13:37:09 +0000 Subject: [PATCH 6/6] add lines back --- src/gino/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gino/__init__.py b/src/gino/__init__.py index b120f211..3a223d04 100644 --- a/src/gino/__init__.py +++ b/src/gino/__init__.py @@ -21,9 +21,11 @@ def create_engine(*args, **kwargs): .. versionchanged:: 1.1 Added the ``prebake`` keyword argument to choose when to create the prepared statements for the queries in the bakery: + * **Pre-bake** immediately when connected to the database (default). * No **pre-bake** but create prepared statements lazily when needed for the first time. + Note: ``prebake`` has no effect in aiomysql """