diff --git a/tutors3/__about__.py b/tutors3/__about__.py index d894b27..4575fed 100644 --- a/tutors3/__about__.py +++ b/tutors3/__about__.py @@ -1,8 +1,8 @@ -import pkg_resources +from importlib import metadata # __version__ attribute as suggested by (deferred) PEP 396: # https://www.python.org/dev/peps/pep-0396/ # # Single-source package definition as suggested (among several # options) by: # https://packaging.python.org/guides/single-sourcing-package-version/ -__version__ = pkg_resources.get_distribution('tutor-contrib-s3').version +__version__ = metadata.version('tutor-contrib-s3') diff --git a/tutors3/plugin.py b/tutors3/plugin.py index 7126f34..15fd878 100644 --- a/tutors3/plugin.py +++ b/tutors3/plugin.py @@ -1,5 +1,5 @@ import os -import pkg_resources +import importlib_resources from glob import glob from tutor import hooks @@ -31,7 +31,7 @@ # Add the "templates" folder as a template root hooks.Filters.ENV_TEMPLATE_ROOTS.add_item( - pkg_resources.resource_filename("tutors3", "templates") + str(importlib_resources.files("tutors3") / "templates") ) # Render the "build" and "apps" folders hooks.Filters.ENV_TEMPLATE_TARGETS.add_items( @@ -41,12 +41,8 @@ ], ) # Load patches from files -for path in glob( - os.path.join( - pkg_resources.resource_filename("tutors3", "patches"), - "*", - ) -): +for path in glob(str( + importlib_resources.files("tutors3") / "patches" / "*")): with open(path, encoding="utf-8") as patch_file: hooks.Filters.ENV_PATCHES.add_item( (os.path.basename(path), patch_file.read())