Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove importlib-metadata #1357

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions ephios/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
from datetime import timedelta
from email.utils import getaddresses
from importlib import metadata
from pathlib import Path

import environ
Expand All @@ -13,11 +14,6 @@

from ephios.extra.secrets import django_secret_from_file

try:
import importlib_metadata # importlib is broken on python3.8, using backport
except ImportError:
import importlib.metadata as importlib_metadata

# BASE_DIR is the directory containing the ephios package
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Expand Down Expand Up @@ -60,8 +56,8 @@
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS")

try:
EPHIOS_VERSION = importlib_metadata.version("ephios")
except importlib_metadata.PackageNotFoundError:
EPHIOS_VERSION = metadata.version("ephios")
except metadata.PackageNotFoundError:
# ephios is not installed as a package (e.g. development setup)
EPHIOS_VERSION = "dev"

Expand Down Expand Up @@ -113,7 +109,7 @@
"ephios.plugins.federation.apps.PluginApp",
]
PLUGINS = copy.copy(CORE_PLUGINS)
for ep in importlib_metadata.entry_points(group="ephios.plugins"):
for ep in metadata.entry_points(group="ephios.plugins"):
PLUGINS.append(ep.value)

INSTALLED_APPS += PLUGINS
Expand Down
4 changes: 1 addition & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ django-statici18n = "^2.3.1"
django-dynamic-preferences = "^1.15.0"
django-crispy-forms = "^2.0"
django-webpush = "^0.3.5"
importlib-metadata = { version = ">=5.2.0", python = "<3.9" }
django-libsass = "^0.9"
crispy-bootstrap5 = ">=0.7,<2024.3"
djangorestframework = "^3.13.1"
Expand Down