Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendor jaraco.text #3061

Merged
merged 5 commits into from
Feb 2, 2022
Merged

Vendor jaraco.text #3061

merged 5 commits into from
Feb 2, 2022

Conversation

jaraco
Copy link
Member

@jaraco jaraco commented Jan 29, 2022

While working on the effort to remove Setuptools' reliance on pkg_resources, I quickly discover that build_meta depends on pkg_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 vendor jaraco.text into pkg_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.
  • Because the 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 and importlib_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.

@jaraco jaraco force-pushed the bugfix/3059-simple-session-build branch from 48f463f to 26652b4 Compare January 29, 2022 23:46
@jaraco jaraco force-pushed the bugfix/3059-simple-session-build branch from 26652b4 to 588c322 Compare January 30, 2022 02:10
@jaraco jaraco force-pushed the bugfix/3059-simple-session-build branch from 588c322 to 253ecb0 Compare January 30, 2022 02:18
Base automatically changed from bugfix/3059-simple-session-build to main February 2, 2022 00:44
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.

1 participant