Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While working on the effort to remove Setuptools' reliance on pkg_resources, I quickly discover that
build_meta
depends onpkg_resources.parse_requirements
, which itself relies on some somewhat idiosyncratic code for parsing lines and lists. So in #3045, I refactored most of that functionality into a composition of tested functions. To make this functionality available to Setuptools, I then extracted the functions and copied them to jaraco.text 3.7 and in this PR, I vendorjaraco.text
intopkg_resources
. Subsequently, I expect to switch setuptools.build_meta to rely on that functionality instead of pkg_resources.Although in theory, vendoring a new package is easy, this one was not. It turned out that there were several complications:
jaraco.text
has a few dependencies and transitive dependencies. These dependencies had to be rewritten as well.jaraco.text
depends on importlib_resources (and thus zipp) on Pythons older than 3.9, requiring special handling to ensure these otherwise conditional dependencies were present unconditionally.jaraco.text
relies on a resource in its package, a text file, that's loaded on import. This text file would not get installed with the vendored package without special handling in Setuptools' own setup.py script due to the limitation that setuptools can't use include_package_data.jaraco
package is a namespace package, I was afraid it was going to be an issue, but in 7713ca9, I confirmed that it was not an issue.Ultimately, this migration was more trouble than it was worth, at least for this local change, but I persevered to get to a working solution, because I want Setuptools to be able to adopt functionality from arbitrary libraries just like any other Python project, and until #2825 is solved, this technique is the best available to accomplish that.
Moreover, I believe both
importlib_resources
andimportlib_metadata
are going to need to be vendored in order for setuptools to drop support for pkg_resources, so it's good to start to address that concern here.