Merged
Conversation
There was a problem hiding this comment.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/ipahealthcheck/core/core.py:35-40` </location>
<code_context>
def find_registries(entry_points):
# Loading the resources may reset the log level, save it.
log_level = logger.level
registries = {}
for entry_point in entry_points:
registries.update({
ep.name: ep.load()
for ep in importlib_metadata.entry_points().select(
group=entry_point
)
})
logger.setLevel(log_level)
return registries
</code_context>
<issue_to_address>
**issue (code-quality):** Merge dictionary updates via the union operator ([`dict-assign-update-to-union`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/dict-assign-update-to-union/))
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Comment on lines
35
to
40
| registries.update({ | ||
| ep.name: ep.resolve() | ||
| for ep in pkg_resources.iter_entry_points(entry_point) | ||
| ep.name: ep.load() | ||
| for ep in importlib_metadata.entry_points().select( | ||
| group=entry_point | ||
| ) | ||
| }) |
There was a problem hiding this comment.
issue (code-quality): Merge dictionary updates via the union operator (dict-assign-update-to-union)
hroncok
reviewed
Oct 2, 2025
| # Copyright (C) 2019 FreeIPA Contributors see COPYING for license | ||
| # | ||
|
|
||
| __import__('pkg_resources').declare_namespace(__name__) |
There was a problem hiding this comment.
Given that those are namespace packages, have you considered removing the __init__.py files following PEP 420 – Implicit Namespace Packages available since Python 3.3?
Collaborator
Author
There was a problem hiding this comment.
I dropped both instances of a namespace init.py, thanks.
aa45267 to
144d24d
Compare
The usage of pkg_resources (subpackage of setuptools distribution) is discouraged. https://setuptools.pypa.io/en/latest/pkg_resources.html: Use of pkg_resources is discouraged in favor of importlib.resources, importlib.metadata, and their backports (importlib_resources, importlib_metadata). Please consider using those libraries instead of pkg_resources. freeipa-healthcheck uses several points of pkg_resources: * pkg_resources.iter_entry_points to access entry points. migration: https://importlib-metadata.readthedocs.io/en/latest/migration.html#pkg-resources-iter-entry-points * pkg_resources.get_distribution to access a distribution. migration: https://importlib-metadata.readthedocs.io/en/latest/migration.html#pkg-resources-get-distribution * __import__('pkg_resources').declare_namespace https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#creating-a-namespace-package Compatibility note: importlib.metadata is in stdlib since Python 3.8: https://docs.python.org/3/library/importlib.metadata.html Fixes: freeipa#273 Signed-off-by: Rob Crittenden <rcritten@redhat.com>
hroncok
approved these changes
Dec 9, 2025
Collaborator
Author
|
rawhide build with this patch created, freeipa-healthcheck-0.19-3.fc44 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The usage of pkg_resources (subpackage of setuptools distribution) is discouraged.
https://setuptools.pypa.io/en/latest/pkg_resources.html:
Use of pkg_resources is discouraged in favor of importlib.resources,
importlib.metadata, and their backports (importlib_resources,
importlib_metadata). Please consider using those libraries instead
of pkg_resources.
freeipa-healthcheck uses several points of pkg_resources:
Compatibility note: importlib.metadata is in stdlib since Python 3.8: https://docs.python.org/3/library/importlib.metadata.html
Fixes: #273
Summary by Sourcery
Migrate the project from pkg_resources to importlib.metadata (and its backport) and update setup configuration accordingly
Enhancements:
Build: