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

Relax the RegistryInitConfig type to allow Mapping #66

Merged
merged 5 commits into from
Jan 23, 2025

Conversation

bcmills
Copy link
Contributor

@bcmills bcmills commented Jan 22, 2025

We do not actually require the config to be a dict, and in other existing repos we already use other
Mapping implementations with the Registry.

Python 3.7 reached end of life 2023-06-27, and Python 3.8 reached end of
life 2023-10-07. Support for these versions was already dropped in #64,
but we can simplify the code by removing workarounds for library bugs in
those releases.
We do not actually require the config to be a dict, and in other
existing repos we already use other Mapping implementations with the
`Registry`.
@bcmills bcmills force-pushed the registry-config-type branch from 752838e to 035aea7 Compare January 22, 2025 20:49
Base automatically changed from eol-python to master January 22, 2025 21:48
CHANGES.md Outdated
Comment on lines 9 to 11
Relax `RegistryInitConfig` from `Dict` to `Mapping`. (We do not actually require
the config to be a dict, and in other existing repos we already use other
Mapping implementations with the `Registry`.)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: consistent monospace

Suggested change
Relax `RegistryInitConfig` from `Dict` to `Mapping`. (We do not actually require
the config to be a dict, and in other existing repos we already use other
Mapping implementations with the `Registry`.)
Relax `RegistryInitConfig` from `Dict` to `Mapping`. (We do not actually require
the config to be a `Dict`, and in other existing repos we already use other
`Mapping` implementations with the `Registry`.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pared down the entry instead. (I through I had already moved that sentence to the commit message! 😅)

@@ -11,7 +11,7 @@
T = TypeVar("T")


RegistryInitConfig = Dict[str, Any]
RegistryInitConfig = Mapping[str, Any]
Copy link
Contributor

@biniona biniona Jan 22, 2025

Choose a reason for hiding this comment

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

Suggestion: I think RegistryConfigWrapper generally assumes dictionaries throughout it's documentation + method names (it has a _from_dict method). Not a big deal either way, but it may be worth updating these to reference the Mapping type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the RegistryConfigWrapper._from_dict() comment. I think it's probably ok to be a bit sloppy about this in prose, though: conceptually it is “dict-like”.

@@ -4,6 +4,12 @@

# Changelog

## v1.3.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion (Optional): Could this be a patch bump? I bet we just weren't aware of this distinction when the code was first written - making this a bug IMO. I could see this going either way. Your call!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In theory it could be, but to me this really is a feature addition: one can now legitimately use a Mapping where only a Dict was (technically) allowed.

CHANGES.md describes the contents of the change; the commit message
describes the reason for making it.
@bcmills bcmills merged commit e82b375 into master Jan 23, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants