setuptools: [BUG] packages of the form package.something renamed to package_something in 75.8.1
setuptools version
setuptools==75.8.1
Python version
python3.10
OS
windows
Additional environment information
Description
We have packages using pyproject.toml of the form:
something.module that use implicit namespaces for something
The latest 75.8.1 seems to rename the something.module-1.2.3.dist-info to be instead: something_module-1.2.3.dist-info
rolling back to 75.8.0 this problem does not exist.
This breaks folks using something of the form pkg_resources.require('something.module') as it now only works if they have pkg_resources.require('something-module')
Expected behavior
packages should continue to have the something.module form
How to Reproduce
git clone https://github.com/krpatter-intc/setuptools-example.git
cd setuptools-example
python -m build
And you’ll note the naming difference in the wheel (and the .dist-info file)
You can then run:
import pkg_resources
pkg_resources.require("something.module") # this now throws an exception
Output
I’m aware pkg_resources is on its way out, but this still feels bad that the package has a new name. I’m not sure what the new equivalent/replacement for pkg_resources.require is.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 28 (11 by maintainers)
Commits related to this issue
- Work around breaking install ... due to dot replaced to dash in module name. See https://github.com/pypa/setuptools/issues/4853 and https://github.com/plone/plone.autoinclude/issues/25 — committed to plone/plone.autoinclude by reebalazs 2 years ago
- Work around breaking install ... due to dot replaced to dash in module name. See https://github.com/pypa/setuptools/issues/4853 and https://github.com/plone/plone.autoinclude/issues/25 — committed to plone/plone.autoinclude by reebalazs 2 years ago
- Fix distribution name for newer setuptools See https://github.com/pypa/setuptools/issues/4853 — committed to collective/collective.timedevents by reebalazs 2 years ago
I confirmed that this is a bug that exists in
importlib.metadataprovided in Python 3.9 (all the way up to 3.9.16) that is fixed in Python 3.10 (starting at 3.10.0).Looks like this was fixed in https://pypi.org/project/importlib-metadata/2.1.0/ and https://pypi.org/project/importlib-metadata/3.1.0/. The entry at https://github.com/python/importlib_metadata/blob/main/NEWS.rst#v210 says:
@Zoltag Note that if you’re unable to upgrade your Python version and instead installing
importlib_metadatafrom PyPI, you need to make the following change to your file:Same issue here. All our jobs are broken since yesterday because of this change. Any workaround for that? What is weird is that I tried to pin setuptools to older versions, and it doesn’t help 😦
This issue sounds relevant to what we’re experiencing.
We started getting Docker image runtime failures today (very unusual), where as far as we can tell the only difference is
setuptoolsversion75.8.0versus75.8.1.Also:
pkg_resources.DistributionNotFound: The 'repoze.debug==1.1' distribution was not foundSo seems related to packages with
.in name, and https://github.com/pypa/setuptools/issues/3777 actually mentionszope.interfaceso guessing it’s related.Our solution was to bump
PasteDeploypackage, which apparently dropped setuptools dependency and started using importlib.metadata instead: https://docs.pylonsproject.org/projects/pastedeploy/en/latest/news.htmlNot sure there is fix needed here, but commenting since this broke us in prod.
The CI is working now to release a new patched version of setuptools that should solve the problem with
pkg_resources.require(...).For people having problems with the exact name of the distribution file has changed a character to
_, I recommend trying something more flexible like glob patterns/regexes or wildcards in general. Since Setuptools is required to comply with the PyPA standards, the change in the file name itself is not considered a bug.