-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update package name #7
Comments
We could also update the name to |
We could also... instead of having a cryptic function like import defaults
function.set_defaults(parameter=0)
Object.__init__.set_defaults(parameter='') Or import defaults
defaults.set_defaults(function, parameter=0)
defaults.set_defaults(Object.__init__, parameter='') Or import defaults
defaults.set_defaults({
function: {
parameter: 0
},
Object.__init__: {
parameter: ''
},
}) Or import defaults
defaults.set_defaults(
(function, dict(parameter=0)),
(Object.__init__, dict(parameter='')),
) We could also... maybe... use a generic type to add type checking for |
Or it could be named |
Add this quote to the documentation:
https://blog.codinghorror.com/the-power-of-defaults/
Rename this package to
Defaults
, it makes more sense thanHParams
.Example API:
This module is also redundant, the primary interface is via a dotted string path. The dotted string path is then parsed, imported, and hashed. Instead of resolving a string path, we could just accept a function object. The function object is guaranteed to exist, and we can check if it has a configurable wrapper.
We should still use
_get_function_signature
so that the configuration is exportable and importable into another process. We can remove_lazy_resolution
because the import responsibility is on the owner.With regard to external libraries, like
_BatchNorm
andBatchNorm1d
, the issue will continue to persist. At the end of the day, there are two references to the same function. If one of the references is decorated and the other is not, that will cause all kinds of issues. For example, it'll cause issues with the trace. It'll also cause issues with__qualname__
. The proper solution is to create a subclass withBatchNorm1d
that has a separate__init__
with a separate set ofkwargs
.The idea of decorating external libraries is interesting. At the end of the day, the goal of this library is to help configure a bunch of code. Instead of having an external configuration object that is passed through the entire code base, we just directly inject the parameters that we'd like to use.
The text was updated successfully, but these errors were encountered: