Skip to content

Commit

Permalink
remove deprecated pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
dshore committed Sep 29, 2023
1 parent 34af09c commit b63be17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion line_item_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__version__ = '0.2.10'

# For an official release, use dev_version = ''
dev_version = '2'
dev_version = '3'

version = __version__
if dev_version:
Expand Down
4 changes: 2 additions & 2 deletions line_item_manager/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Console script for line_item_manager."""
from functools import partial
import json
import pkg_resources
from importlib.resources import files
import sys

import click
Expand Down Expand Up @@ -155,7 +155,7 @@ def create(ctx: click.core.Context, configfile: str, **kwargs):
logger.error('Cleanup: Google Ads Error, %s', _e)

def show_resource(filename: str) -> None:
rsrc_name = pkg_resources.resource_filename('line_item_manager', filename) # type: ignore[misc]
rsrc_name = files('line_item_manager').joinpath(filename) # type: ignore[misc]
with open(rsrc_name) as fp:
print(fp.read())

Expand Down
5 changes: 2 additions & 3 deletions line_item_manager/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from hashlib import sha1
import pkg_resources
from importlib.resources import files
from pprint import pformat
from typing import Any, Dict, Iterable, List

Expand Down Expand Up @@ -37,8 +37,7 @@ def package_filename(name: str) -> str:
Returns:
Fullpath of the package file
"""
return pkg_resources.resource_filename('line_item_manager',
f'conf.d/{name}') # type: ignore[misc]
return files('line_item_manager').joinpath(f'conf.d/{name}') # type: ignore[misc]

def read_package_file(name: str) -> str:
"""Get contents of a package file specified by name.
Expand Down

0 comments on commit b63be17

Please sign in to comment.