From 34d1d843d39d308decb5eac898470fcbade4b6b5 Mon Sep 17 00:00:00 2001 From: zmoon Date: Fri, 14 Jul 2023 17:56:12 -0600 Subject: [PATCH 1/4] Font path as file-relative path --- pydecorate/decorator_agg.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pydecorate/decorator_agg.py b/pydecorate/decorator_agg.py index ba3514e..2fcbd94 100644 --- a/pydecorate/decorator_agg.py +++ b/pydecorate/decorator_agg.py @@ -17,11 +17,14 @@ # along with this program. If not, see . """Aggdraw-based image decoration class.""" +from pathlib import Path + import aggdraw -from pkg_resources import resource_filename from pydecorate.decorator_base import DecoratorBase +HERE = Path(__file__).parent + class DecoratorAGG(DecoratorBase): """Aggdraw-based image decoration class.""" @@ -30,8 +33,8 @@ def add_scale(self, colormap, **kwargs): self._add_scale(colormap, **kwargs) def _load_default_font(self): - font_path = resource_filename("pydecorate.fonts", "DejaVuSerif.ttf") - return aggdraw.Font("black", font_path, size=16) + font_path = HERE / "fonts" / "DejaVuSerif.ttf" + return aggdraw.Font("black", font_path.as_posix(), size=16) def _load_font(self): try: From a5998b351a6ed10e37833761b3b7fb14bf54d763 Mon Sep 17 00:00:00 2001 From: zmoon Date: Fri, 14 Jul 2023 17:56:53 -0600 Subject: [PATCH 2/4] Remove comment probably could remove the file as well --- pydecorate/fonts/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pydecorate/fonts/__init__.py b/pydecorate/fonts/__init__.py index d47c660..e69de29 100644 --- a/pydecorate/fonts/__init__.py +++ b/pydecorate/fonts/__init__.py @@ -1 +0,0 @@ -# Need this directory to be a module so that pkg_resources.resource_filename properly finds it From 4bdcfb266ca6601e3c0ddccb16afe7e4f3dc519c Mon Sep 17 00:00:00 2001 From: zmoon Date: Fri, 14 Jul 2023 17:59:13 -0600 Subject: [PATCH 3/4] Use importlib.metadata to get version for docs --- doc/source/conf.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 814f295..d9781e8 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -18,8 +18,7 @@ import os import sys - -from pkg_resources import get_distribution +from importlib.metadata import version as get_version # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -61,7 +60,7 @@ # built documents. # # get version using setuptools-scm -release = get_distribution("pydecorate").version +release = get_version("pydecorate") # The full version, including alpha/beta/rc tags. # for example take major/minor version = ".".join(release.split(".")[:2]) From 655b49aa2a3cb80d2ede4de9ebe5229ea785d598 Mon Sep 17 00:00:00 2001 From: zmoon Date: Fri, 14 Jul 2023 17:59:49 -0600 Subject: [PATCH 4/4] Remove runtime dep on setuptools (pkg_resources) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5982f66..bebfa05 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ packages=["pydecorate"], include_package_data=True, package_data={"pydecorate": ["fonts/*.ttf"]}, - install_requires=["pillow", "aggdraw", "numpy", "setuptools"], + install_requires=["pillow", "aggdraw", "numpy"], setup_requires=["setuptools_scm", "setuptools_scm_git_archive"], scripts=[], data_files=[],