r/PythonLearning • u/Business-Feedback635 • 4h ago
Looking for a first open-source contribution? 238 maintained PyPI packages still import pkg_resources, and the fix is often one line
setuptools 82 (February 2026) removed pkg_resources. Code that still runs import pkg_resources now fails with:
ModuleNotFoundError: No module named 'pkg_resources'It also fails in any new Python 3.12+ virtual environment, because venv no longer installs setuptools.
I run py-code.org, a search over the code inside PyPI packages. I checked every package that still uses pkg_resources: 1,504 import it with no fallback, so they fail without it. 238 of them had a release in the last six months and have a public repository, so the maintainers are active and can merge a fix.
The fix is usually small, which makes it a good first pull request:
# before
import pkg_resources
requests_version = pkg_resources.get_distribution("requests").version
# after (Python 3.8+)
from importlib.metadata import version
requests_version = version("requests")For data files inside a package, pkg_resources.resource_filename(pkg, path) becomes importlib.resources.files(pkg) / path (Python 3.9+).
How to do it:
- Pick a project from the list (CSV with the file and line of each import, and the repo link): https://github.com/pypi-data/blog/blob/main/pkg-resources-pypi/results/unguarded.csv
- Check that it isn't fixed already: search the repo's main branch for
pkg_resources, and look at open issues and pull requests. - Replace each call. The post has a table with the replacement for each
pkg_resourcesfunction. - Test in a fresh virtual environment (
python3.12 -m venv), so setuptools isn't there, and run the project's tests. - Open one small pull request. Explain it in one line: "pkg_resources was removed in setuptools 82 and isn't installed by default in Python 3.12+ virtual environments."
Please send one PR per project, and skip any project where someone has already opened one.
Full write-up, with the replacement table and the most downloaded affected packages: https://py-code.org/blog/pkg-resources-pypi/
