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

Use modern Python import features for product enumeration #1240

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

d-maurer
Copy link
Contributor

Fixes #1239.

Currently, Zope only supports file based module finders during product enumeration (see OFS.Application.get_products).
This PR replaces Zope's proprietary product enumeration by pkgutil.iter_modules and thereby supports all module finder types supported by Python.

To reduce the risk for incompatibilities the signature for product handling functions in OFS.Application is mostly left unchanged: product_dir is replaced by finder (though most functions do not use this parameter in their body).

@d-maurer d-maurer requested review from dwt and dataflake November 27, 2024 09:35
@dataflake
Copy link
Member

dataflake commented Nov 27, 2024

The code looks fine and the tests run, but how do we really know if the new way to load products will produce the same results as the old way, meaning it won't lead to any products not being loaded?

@d-maurer
Copy link
Contributor Author

d-maurer commented Nov 27, 2024 via email

Copy link
Member

@dataflake dataflake left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation!

@dwt
Copy link
Contributor

dwt commented Nov 27, 2024

That looks about how I would have expected. Thanks al lot!

@d-maurer d-maurer merged commit c647a3a into master Nov 27, 2024
28 checks passed
@d-maurer d-maurer deleted the modernize_product_enumeration branch November 27, 2024 12:28
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.

Zope needs to change the way it enumerate Products?
3 participants