Skip to content

Commit

Permalink
Remove deprecated pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
alifbe committed Oct 11, 2023
1 parent b2e414d commit 7b46fcc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ tests = [
"rstcheck-core",
"types-Jinja2",
"types-PyYAML",
"types-pkg_resources",
"types-python-dateutil",
]
docs = [
Expand Down
6 changes: 3 additions & 3 deletions src/subscript/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import sys

try:
import pkg_resources
from importlib import metadata

__version__ = pkg_resources.get_distribution(__name__).version
except pkg_resources.DistributionNotFound:
__version__ = metadata.version(__name__)
except metadata.PackageNotFoundError:
pass


Expand Down
8 changes: 6 additions & 2 deletions src/subscript/hook_implementations/jobs.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import importlib
import os
import pkgutil
from typing import Any, Optional

from ert.shared.plugins.plugin_manager import hook_implementation
from ert.shared.plugins.plugin_response import plugin_response
from pkg_resources import resource_filename

# pylint: disable=no-value-for-parameter


def _get_jobs_from_directory(directory):
"""Do a filesystem lookup in a directory to check
for available ERT forward models"""
resource_directory = resource_filename("subscript", directory)
resource_directory = (
os.path.dirname(pkgutil.get_loader("subscript").get_filename())
+ "/"
+ directory
)

all_files = [
os.path.join(resource_directory, f)
Expand Down

0 comments on commit 7b46fcc

Please sign in to comment.