diff --git a/requirements.txt b/requirements.txt index f8d1df18a..560a1c1b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,25 +8,19 @@ # ############################################################################### -Flask==3.0.*; python_version > '3.7' -Flask==2.2.*; python_version <= '3.7' +Flask==3.0.* Flask-Login==0.* Flask-Mail==0.* Flask-Migrate==4.* greenlet==1.1.2; python_version <= '3.10' -Flask-SQLAlchemy==3.1.*; python_version > '3.7' -Flask-SQLAlchemy==3.0.*; python_version <= '3.7' -Flask-WTF==1.2.*; python_version > '3.7' -Flask-WTF==1.1.1; python_version <= '3.7' +Flask-SQLAlchemy==3.1.* +Flask-WTF==1.2.* Flask-Compress==1.* Flask-Paranoid==0.* -Flask-Babel==4.0.*; python_version > '3.7' -Flask-Babel==3.1.*; python_version <= '3.7' -Flask-Security-Too==5.4.*; python_version > '3.7' -Flask-Security-Too==5.1.*; python_version <= '3.7' +Flask-Babel==4.0.* +Flask-Security-Too==5.4.* Flask-SocketIO==5.3.* -WTForms==3.1.*; python_version > '3.7' -WTForms==3.0.*; python_version <= '3.7' +WTForms==3.1.* passlib==1.* pytz==2024.* speaklater3==1.* @@ -43,25 +37,19 @@ gssapi==1.8.* eventlet==0.36.1 user-agents==2.2.0 pywinpty==2.0.*; sys_platform=="win32" -Authlib==1.3.*; python_version > '3.7' -Authlib==1.2.*; python_version <= '3.7' +Authlib==1.3.* pyotp==2.* qrcode==7.* -boto3==1.34.*; python_version > '3.7' -boto3==1.33.*; python_version <= '3.7' +boto3==1.34.* urllib3==1.26.* azure-mgmt-rdbms==10.1.0 -azure-mgmt-resource==23.1.1; python_version > '3.7' -azure-mgmt-resource==23.0.1; python_version <= '3.7' +azure-mgmt-resource==23.1.1 azure-mgmt-subscription==3.1.1 -azure-identity==1.17.1; python_version > '3.7' -azure-identity==1.15.0; python_version <= '3.7' +azure-identity==1.17.1 google-api-python-client==2.* google-auth-oauthlib==1.2.0 -keyring==24.*; python_version > '3.7' -keyring==23.*; python_version <= '3.7' -Werkzeug==3.0.*; python_version > '3.7' -Werkzeug==2.2.3; python_version <= '3.7' +keyring==24.* +Werkzeug==3.0.* typer[all]==0.12.* setuptools==70.*; python_version >= '3.12' jsonformatter~=0.3.2 diff --git a/web/pgAdmin4.py b/web/pgAdmin4.py index e4aa89f82..6307dc87e 100644 --- a/web/pgAdmin4.py +++ b/web/pgAdmin4.py @@ -15,8 +15,8 @@ import sys if sys.version_info <= (3, 9): import select -if sys.version_info < (3, 7): - raise RuntimeError('This application must be run under Python 3.7 ' +if sys.version_info < (3, 8): + raise RuntimeError('This application must be run under Python 3.8 ' 'or later.') import builtins import os diff --git a/web/pgAdmin4.wsgi b/web/pgAdmin4.wsgi index 9cce91ed4..ee521d700 100644 --- a/web/pgAdmin4.wsgi +++ b/web/pgAdmin4.wsgi @@ -10,8 +10,8 @@ import os import sys -if sys.version_info < (3, 7): - raise Exception('This application must be run under Python 3.7 or later.') +if sys.version_info < (3, 8): + raise Exception('This application must be run under Python 3.8 or later.') import builtins diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py index 49b8edbda..8582a0828 100644 --- a/web/pgadmin/__init__.py +++ b/web/pgadmin/__init__.py @@ -520,13 +520,9 @@ def create_app(app_name=None): security.init_app(app, user_datastore) - # register custom unauthorised handler. - if sys.version_info < (3, 8): - app.login_manager.unauthorized_handler(pga_unauthorised) - else: - # Flask-Security-Too > 5.4.* requires custom unauth handeler - # to be registeres with it. - security.unauthn_handler(pga_unauthorised) + # Flask-Security-Too > 5.4.* requires custom unauth handeler + # to be registeres with it. + security.unauthn_handler(pga_unauthorised) # Set the permanent session lifetime to the specified value in config file. app.permanent_session_lifetime = timedelta( diff --git a/web/pgadmin/browser/__init__.py b/web/pgadmin/browser/__init__.py index 96cbccaa3..f5a3ee891 100644 --- a/web/pgadmin/browser/__init__.py +++ b/web/pgadmin/browser/__init__.py @@ -65,13 +65,7 @@ from pgadmin.authenticate import AuthSourceManager from pgadmin.utils.exception import CryptKeyMissing from pgadmin.user_login_check import pga_login_required - -try: - from flask_security.views import default_render_json -except ImportError as e: - # Support Flask-Security-Too == 3.2 - if sys.version_info < (3, 8): - from flask_security.views import _render_json as default_render_json +from flask_security.views import default_render_json MODULE_NAME = 'browser' BROWSER_STATIC = 'browser.static' @@ -1103,8 +1097,7 @@ if hasattr(config, 'SECURITY_RECOVERABLE') and config.SECURITY_RECOVERABLE: form_class = _security.forms.get('reset_password_form').cls form = form_class(request.form) if request.form else form_class() - if sys.version_info >= (3, 8): - form.user = user + form.user = user if form.validate_on_submit(): try: diff --git a/web/pgadmin/tools/user_management/__init__.py b/web/pgadmin/tools/user_management/__init__.py index 15fc4ba1d..8bc9338b6 100644 --- a/web/pgadmin/tools/user_management/__init__.py +++ b/web/pgadmin/tools/user_management/__init__.py @@ -12,8 +12,7 @@ import json import sys -if sys.version_info >= (3, 8): - from unicodedata import normalize, is_normalized +from unicodedata import normalize, is_normalized from flask import render_template, request, \ Response, abort, current_app, session @@ -446,10 +445,6 @@ def normalise_password(password): 'NFKD' ) - # Remove check of Python version once Python 3.7 support ends - if sys.version_info < (3, 8): - return password - return password if is_normalized(normalise_form, password) else\ normalize(normalise_form, password) diff --git a/web/regression/python_test_utils/csrf_test_client.py b/web/regression/python_test_utils/csrf_test_client.py index 0c804ef14..4c4f660c9 100644 --- a/web/regression/python_test_utils/csrf_test_client.py +++ b/web/regression/python_test_utils/csrf_test_client.py @@ -27,12 +27,6 @@ class RequestShim(): def set_cookie(self, key, value='', *args, **kwargs): "Set the cookie on the Flask test client." - if sys.version_info <= (3, 7, 9999): - server_name = current_app.config["SERVER_NAME"] or "localhost" - return self.client.set_cookie( - server_name, key=key, value=value, *args, **kwargs - ) - if kwargs['domain'] is None: kwargs['domain'] = current_app.config["SERVER_NAME"] or "localhost" @@ -102,10 +96,7 @@ class TestClient(testing.FlaskClient): environ_overrides = { 'wsgi.url_scheme': '' } - if sys.version_info <= (3, 7, 9999): - self.cookie_jar.inject_wsgi(environ_overrides) - else: - self._add_cookies_to_wsgi(environ_overrides) + self._add_cookies_to_wsgi(environ_overrides) with self.app.test_request_context(): # Now, we call Flask-WTF's method of generating a CSRF token... diff --git a/web/regression/runtests.py b/web/regression/runtests.py index 2fc560995..cf6c3a7be 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -29,8 +29,8 @@ from selenium.webdriver.firefox.options import Options as FirefoxOptions if sys.platform == "win32": asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) -if sys.version_info < (3, 7): - raise RuntimeError('The test suite must be run under Python 3.7 or later.') +if sys.version_info < (3, 8): + raise RuntimeError('The test suite must be run under Python 3.8 or later.') import builtins