diff options
-rw-r--r-- | fietsboek/__init__.py | 4 | ||||
-rw-r--r-- | fietsboek/updater/__init__.py | 6 | ||||
-rw-r--r-- | fietsboek/util.py | 6 | ||||
-rw-r--r-- | pyproject.toml | 6 |
4 files changed, 7 insertions, 15 deletions
diff --git a/fietsboek/__init__.py b/fietsboek/__init__.py index 10ba164..9112576 100644 --- a/fietsboek/__init__.py +++ b/fietsboek/__init__.py @@ -13,10 +13,10 @@ For more information, you can check out the following resources: Content ------- """ +import importlib.metadata from pathlib import Path from typing import Callable, Optional -import importlib_metadata import redis from pyramid.config import Configurator from pyramid.csrf import CookieCSRFStoragePolicy @@ -33,7 +33,7 @@ from .data import DataManager from .pages import Pages from .security import SecurityPolicy -__VERSION__ = importlib_metadata.version("fietsboek") +__VERSION__ = importlib.metadata.version("fietsboek") def locale_negotiator(request: Request) -> Optional[str]: diff --git a/fietsboek/updater/__init__.py b/fietsboek/updater/__init__.py index a62b395..9e2e7f0 100644 --- a/fietsboek/updater/__init__.py +++ b/fietsboek/updater/__init__.py @@ -1,5 +1,6 @@ """Updating (data migration) logic for fietsboek.""" import datetime +import importlib.resources import importlib.util import logging import random @@ -10,9 +11,6 @@ from typing import List import alembic.command import alembic.config import alembic.runtime - -# Compat for Python < 3.9 -import importlib_resources import jinja2 import pyramid.paster import sqlalchemy @@ -385,7 +383,7 @@ def _filename_to_modname(name): def _load_update_scripts(): """Loads all available import scripts.""" - files = importlib_resources.files(__name__) / "scripts" + files = importlib.resources.files(__name__) / "scripts" return [ UpdateScript(file.read_text(encoding="utf-8"), _filename_to_modname(file.name)) for file in files.iterdir() diff --git a/fietsboek/util.py b/fietsboek/util.py index 96ba660..c741550 100644 --- a/fietsboek/util.py +++ b/fietsboek/util.py @@ -1,5 +1,6 @@ """Various utility functions.""" import datetime +import importlib.resources import os import re import secrets @@ -9,9 +10,6 @@ from typing import List, Optional, Union import babel import bleach import gpxpy - -# Compat for Python < 3.9 -import importlib_resources import markdown import sqlalchemy import webob @@ -311,7 +309,7 @@ def read_localized_resource( for locale in locales: for package in locale_packages: - locale_dir = importlib_resources.files(package) / "locale" / locale + locale_dir = importlib.resources.files(package) / "locale" / locale resource_path = locale_dir / path try: return resource_path.read_text(encoding="utf-8") diff --git a/pyproject.toml b/pyproject.toml index 41236f3..e6dcf34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ repository = "https://gitlab.com/dunj3/fietsboek" keywords = ["web", "gpx"] [tool.poetry.dependencies] -python = "^3.7.2" +python = "^3.9" pyramid = "^2" pyramid_jinja2 = "^2.10" @@ -40,10 +40,6 @@ transaction = "^3" "zope.sqlalchemy" = "^1.6" redis = "^4.3.4" -# Compatibility with old Python versions -importlib_resources = "^5.10" -importlib_metadata = "^6.0.0" - Babel = "^2.11" cryptography = "^39" gpxpy = "^1.5" |