From 7f8aa80b0e50614b9cebc68950a7f717dbc648da Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 18 Aug 2022 19:16:29 +0200 Subject: [PATCH] Update dependencies and increase python version to 3.10 Drop future imports, not needed with python 3.10 Signed-off-by: Ferdinand Thiessen --- flaschengeist/app.py | 2 +- flaschengeist/cli/export_cmd.py | 2 +- flaschengeist/cli/plugin_cmd.py | 2 +- flaschengeist/database.py | 4 +--- flaschengeist/models/image.py | 2 -- flaschengeist/models/notification.py | 1 - flaschengeist/models/session.py | 6 ------ flaschengeist/models/user.py | 3 --- flaschengeist/plugins/__init__.py | 2 +- flaschengeist/plugins/balance/models.py | 2 -- flaschengeist/plugins/pricelist/models.py | 2 -- setup.cfg | 14 ++++++-------- 12 files changed, 11 insertions(+), 31 deletions(-) diff --git a/flaschengeist/app.py b/flaschengeist/app.py index b6f87e1..4aa8b88 100644 --- a/flaschengeist/app.py +++ b/flaschengeist/app.py @@ -4,7 +4,7 @@ from flask import Flask from flask_cors import CORS from datetime import datetime, date from flask.json import JSONEncoder, jsonify -from importlib_metadata import entry_points +from importlib.metadata import entry_points from sqlalchemy.exc import OperationalError from werkzeug.exceptions import HTTPException diff --git a/flaschengeist/cli/export_cmd.py b/flaschengeist/cli/export_cmd.py index 2131f7b..4e0fa03 100644 --- a/flaschengeist/cli/export_cmd.py +++ b/flaschengeist/cli/export_cmd.py @@ -1,5 +1,5 @@ import click -from importlib_metadata import entry_points +from importlib.metadata import entry_points @click.command() diff --git a/flaschengeist/cli/plugin_cmd.py b/flaschengeist/cli/plugin_cmd.py index 4a34cc6..97bd1bc 100644 --- a/flaschengeist/cli/plugin_cmd.py +++ b/flaschengeist/cli/plugin_cmd.py @@ -2,7 +2,7 @@ import click from click.decorators import pass_context from flask import current_app from flask.cli import with_appcontext -from importlib_metadata import EntryPoint, entry_points +from importlib.metadata import EntryPoint, entry_points from flaschengeist.database import db from flaschengeist.config import config diff --git a/flaschengeist/database.py b/flaschengeist/database.py index a2c4672..5bb30ef 100644 --- a/flaschengeist/database.py +++ b/flaschengeist/database.py @@ -1,7 +1,7 @@ import os from flask_migrate import Migrate, Config from flask_sqlalchemy import SQLAlchemy -from importlib_metadata import EntryPoint +from importlib.metadata import EntryPoint, entry_points, distribution from sqlalchemy import MetaData from flaschengeist import logger @@ -30,8 +30,6 @@ def configure_alembic(config: Config): This includes even disabled plugins, as simply disabling a plugin without uninstall can break the alembic version management. """ - from importlib_metadata import entry_points, distribution - # Set main script location config.set_main_option( "script_location", str(distribution("flaschengeist").locate_file("") / "flaschengeist" / "alembic") diff --git a/flaschengeist/models/image.py b/flaschengeist/models/image.py index 9a97ea8..d87af8a 100644 --- a/flaschengeist/models/image.py +++ b/flaschengeist/models/image.py @@ -1,5 +1,3 @@ -from __future__ import annotations # TODO: Remove if python requirement is >= 3.10 - from sqlalchemy import event from pathlib import Path diff --git a/flaschengeist/models/notification.py b/flaschengeist/models/notification.py index 9431c17..07320c7 100644 --- a/flaschengeist/models/notification.py +++ b/flaschengeist/models/notification.py @@ -1,4 +1,3 @@ -from __future__ import annotations # TODO: Remove if python requirement is >= 3.10 from datetime import datetime from typing import Any diff --git a/flaschengeist/models/session.py b/flaschengeist/models/session.py index 9acf27c..7dc6df8 100644 --- a/flaschengeist/models/session.py +++ b/flaschengeist/models/session.py @@ -1,10 +1,4 @@ -from __future__ import annotations # TODO: Remove if python requirement is >= 3.10 - from datetime import datetime, timedelta, timezone - -from . import ModelSerializeMixin, UtcDateTime, Serial -from .user import User -from flaschengeist.database import db from secrets import compare_digest from flaschengeist import logger diff --git a/flaschengeist/models/user.py b/flaschengeist/models/user.py index 2ce1716..2889eeb 100644 --- a/flaschengeist/models/user.py +++ b/flaschengeist/models/user.py @@ -1,6 +1,3 @@ -from __future__ import annotations # TODO: Remove if python requirement is >= 3.10 - -from flask import url_for from typing import Optional from datetime import date, datetime from sqlalchemy.orm.collections import attribute_mapped_collection diff --git a/flaschengeist/plugins/__init__.py b/flaschengeist/plugins/__init__.py index 13936e5..fadecff 100644 --- a/flaschengeist/plugins/__init__.py +++ b/flaschengeist/plugins/__init__.py @@ -5,7 +5,7 @@ """ from typing import Optional -from importlib_metadata import Distribution, EntryPoint +from importlib.metadata import Distribution, EntryPoint from werkzeug.exceptions import MethodNotAllowed, NotFound from werkzeug.datastructures import FileStorage diff --git a/flaschengeist/plugins/balance/models.py b/flaschengeist/plugins/balance/models.py index 1ba206b..d5d0061 100644 --- a/flaschengeist/plugins/balance/models.py +++ b/flaschengeist/plugins/balance/models.py @@ -1,5 +1,3 @@ -from __future__ import annotations # TODO: Remove if python requirement is >= 3.10 - from datetime import datetime from typing import Optional from sqlalchemy.ext.hybrid import hybrid_property diff --git a/flaschengeist/plugins/pricelist/models.py b/flaschengeist/plugins/pricelist/models.py index 630766d..543fee0 100644 --- a/flaschengeist/plugins/pricelist/models.py +++ b/flaschengeist/plugins/pricelist/models.py @@ -1,5 +1,3 @@ -from __future__ import annotations # TODO: Remove if python requirement is >= 3.10 - from flaschengeist.database import db from flaschengeist.models import ModelSerializeMixin, Serial from flaschengeist.models.image import Image diff --git a/setup.cfg b/setup.cfg index 41af0da..46433c8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,19 +19,17 @@ classifiers = [options] include_package_data = True -python_requires = >=3.9 +python_requires = >=3.10 packages = find: install_requires = - Flask>=2.0 - Pillow>=8.4.0 + Flask==2.0.3 + Pillow>=9.0 flask_cors flask_migrate>=3.1.0 - flask_sqlalchemy>=2.5 - # Importlib requirement can be dropped when python requirement is >= 3.10 - importlib_metadata>=4.3 - sqlalchemy>=1.4.26 + flask_sqlalchemy>=2.5.1 + sqlalchemy>=1.4.39 toml - werkzeug >= 2.0 + werkzeug==2.0.3 [options.extras_require] argon = argon2-cffi