Skip to content

Conversation

mauritsvanrees
Copy link
Collaborator

Sample error:

.tox/py312/lib/python3.12/site-packages/mr/developer/extension.py:2: in <module>
    from setuptools.package_index import safe_name
E   ModuleNotFoundError: No module named 'setuptools.package_index'

setuptools 80.2.0 removes the package_index module. When it still existed, this actually imported safe_name from pkg_resources. This may depend on the setuptools version as well, and pkg_resources will be removed at the end of the year. So I copied the only thing we needed: the safe_name function.

Note that we don't have CI setup on master currently. But @mamico has added that in PR #212. So we should get that PR merged soon as well. (And I would also fully drop Python 2 support, and Python 3.8 and lower.)

Sample error:

```
.tox/py312/lib/python3.12/site-packages/mr/developer/extension.py:2: in <module>
    from setuptools.package_index import safe_name
E   ModuleNotFoundError: No module named 'setuptools.package_index'
```

`setuptools` 80.2.0 removes the `package_index` module.
When it still existed, this actually imported `safe_name` from `pkg_resources`.
This may depend on the setuptools version as well, and `pkg_resources` will be removed at the end of the year.
So I copied the only thing we needed: the `safe_name` function.
@mauritsvanrees mauritsvanrees requested a review from fschulze June 4, 2025 16:17
@fschulze
Copy link
Owner

fschulze commented Jun 4, 2025

Looks good to me. Feel free to merge whenever it fits.

@mauritsvanrees mauritsvanrees merged commit 1a3240e into master Jun 4, 2025
@mauritsvanrees
Copy link
Collaborator Author

Thanks for the quick review. I have released 2.0.3 with this.

@mamico
Copy link

mamico commented Jun 5, 2025

thanks to both of you

mauritsvanrees added a commit to zopefoundation/Zope that referenced this pull request Jun 10, 2025
This fixes a ModuleNotFoundError with setuptools 80.2 or higher, for the removed `package_index` module.
See fschulze/mr.developer#213
mauritsvanrees added a commit to zopefoundation/Zope that referenced this pull request Jun 10, 2025
This fixes a ModuleNotFoundError with setuptools 80.2 or higher, for the removed `package_index` module.
See fschulze/mr.developer#213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants