pytest-html icon indicating copy to clipboard operation
pytest-html copied to clipboard

Use importlib.resources rather than setuptools.pkg_resources

Open jmrgibson opened this issue 5 years ago • 2 comments
trafficstars

Could we change this package to use https://docs.python.org/3/library/importlib.html#importlib.resources.read_text? instead of pkg_resources from setuptools?

I see the following advantages

  1. pip installing setuptools doesn't play nice with tools like https://github.com/jazzband/pip-tools
  2. pkg_resources doesn't work with pyoxidizer https://pyoxidizer.readthedocs.io/en/stable/,
  3. importlib is part of the std library, meaning we have one less dependency (we can't always assume setuptools is going to be available, especially with things like pyinstaller, pyoxidize, etc)

The readme says we need python3.6 or newer, so we should be fine for compatibility, as importlib was added in 3.1.

I'll put up a PR shortly, its a pretty minimal change

jmrgibson avatar Mar 03 '20 16:03 jmrgibson

PR: https://github.com/pytest-dev/pytest-html/pull/276

jmrgibson avatar Mar 03 '20 16:03 jmrgibson

related issue: https://github.com/indygreg/PyOxidizer/issues/69

jkowalleck avatar Dec 04 '20 15:12 jkowalleck