Skip to content

[BUG] Restore pkg_resources #5174

@stephenfin

Description

@stephenfin

setuptools version

setuptools==82.0.0

Python version

Python 3.10

OS

n/a

Additional environment information

No response

Description

(I am reporting this a bug, though it's likely to be more of a discussion, at least initially. I don't see this kind of technical discussion happening in GitHub Discussion though).

setuptools 82.0.0 recently removed the pkg_resources library. This breaks all packages that rely on this for either build-time and runtime. While users can work around this at runtime by pre-installing an older setuptools version in the environment, doing so for build-time dependency on pkg_resources is far more difficult, given the rise of of build isolation in pip and other tools in recent years (I believe this was the key reason for closing #863). While workaround do exist for pip (which has the --no-build-isolation hammer), I don't believe other tools like tox have equivalent options. The removal of pkg_resources thus effectively breaks installation of older packages, which is very unfortunate given these are still quite common in the wild.

Expected behavior

The entire reason for build_meta.__legacy__ existence is to allow us to continue using packages that haven't migrated to newer packaging standards, whether that is because the packages are no longer maintained or we're intentionally testing older versions (for e.g. stable or historical release branches). Removing pkg_resources breaks this contract owing to pkg_resources's use as a build-time dependency for things like namespace packages.

I believe pkg_resources should continue to be installed in the environment legacy configuration. Whether this "installation" is handled by pip or setuptools is likely an implementation detail, but in either case the backing code to support it is small, and it could easily be filed away somewhere and never looked at again.

Am I missing something? Is there an alternative approach users can use and that we could document? As always, I am happy to work on a solution once one has been agreed on.

How to Reproduce

n/a

Output

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions