pytest-dev / pytest-dev/pytest-html

Use importlib.resources rather than setuptools.pkg_resources

Open
#275 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Infrastructure proposal
Dominant language
Python
Stars
779
Forks
260
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the package's use of setuptools.pkg_resources and review the Python 3.6 compatibility stated in the issue. Replace the resource-loading use with importlib.resources.read_text, remove the unnecessary setuptools dependency, and verify the existing test suite still passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.