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

Replace deprecated pkg_resources #68

Merged
merged 1 commit into from
Aug 19, 2024
Merged
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
6 changes: 3 additions & 3 deletions src/aerovaldb/jsondb/jsonfiledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import shutil
from pathlib import Path
from typing import Callable, Awaitable, Any, Generator
import importlib.metadata

from async_lru import alru_cache
from packaging.version import Version
from pkg_resources import DistributionNotFound, get_distribution # type: ignore

from aerovaldb.aerovaldb import AerovalDB
from aerovaldb.exceptions import UnusedArguments, TemplateNotFound
Expand Down Expand Up @@ -236,8 +236,8 @@ async def _get_version(self, project: str, experiment: str) -> Version:
# been written, we use the version of the installed pyaerocom. This is
# important for tests to work correctly, and for files to be written
# correctly if the config file happens to be written after data files.
version = Version(get_distribution("pyaerocom").version)
except DistributionNotFound:
version = Version(importlib.metadata.version("pyaerocom"))
except importlib.metadata.PackageNotFoundError:
version = Version("0.0.1")
finally:
return version
Expand Down