Skip to content

Conversation

@gforcada
Copy link
Member

@gforcada gforcada commented Dec 6, 2025

Partly fixes #208

There is still some usage on tests, which I'm not exactly sure how that can be done without pkg_resources. Any hints? 🤔

Left as draft as #207 should be merged first.

@gforcada gforcada marked this pull request as draft December 6, 2025 16:50
@dataflake
Copy link
Contributor

Partly fixes #208

There is still some usage on tests, which I'm not exactly sure how that can be done without pkg_resources. Any hints?

Thank you for getting onto this so quickly. For my own use case it's enough to remove it from the standard modules that get run when the tool is used.

It is deprecated in `setuptools` and meant to be removed soon.
@mauritsvanrees mauritsvanrees force-pushed the remove-pkg-resources-usage branch from 8e79f56 to 75b31cb Compare December 8, 2025 21:50
Copy link
Member

@mauritsvanrees mauritsvanrees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and works when I try it in Plone 6.2 coredev. I have merged the other PR, and have rebased and force pushed the current PR branch on top of that.

@mauritsvanrees mauritsvanrees marked this pull request as ready for review December 8, 2025 22:06
@mauritsvanrees
Copy link
Member

There is still some usage on tests, which I'm not exactly sure how that can be done without pkg_resources. Any hints? 🤔

Those are lines like this:

install_dependencies(pkg_resources.working_set.require("ZEO"), test)

This is the function (slightly simplified):

def install_dependencies(dependencies, test):
    for dep in dependencies:
        install(dep.project_name, test)

The install function that is called here, comes from zc.buildout.testing. For each project name that is passed, it does this:

dist = pkg_resources.working_set.find(
    pkg_resources.Requirement.parse(project))

So even if we come up with a non-pkg_resources way to spell this in our tests, we would still be calling zc.buildout which still heavily uses pkg_resources for the foreseeable future.

In other words, I think we can ignore these occurrences in our tests for now.

zc.buildout 5.1.1 already has setuptools<81 in its requirements. I don't see a way for zc.buildout to work with a newer setuptools, unless we copy the pkg_resources module into buildout itself. At that point the plone.recipe.zope2instance tests may need to import pkg_resources from zc.buildout.

Anyway, that may be something for later.

@mauritsvanrees mauritsvanrees merged commit 934ef85 into master Dec 8, 2025
8 checks passed
@mauritsvanrees mauritsvanrees deleted the remove-pkg-resources-usage branch December 8, 2025 22:20
@mauritsvanrees
Copy link
Member

I have released 9.0.0a1 with this.

@dataflake
Copy link
Contributor

Thank you! 🙏

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.

UserWarnings due to pkg_resources

4 participants