-
Notifications
You must be signed in to change notification settings - Fork 2
Draft: Register as / Replacing Modules from other Repositories #57
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
base: master
Are you sure you want to change the base?
Conversation
…sion during development)
…s do not interfere
I like the idea, as I previously run into a few of those issues myself. This could be solved by adjusting the order of the paths, where miniflask looks for modules: If one specifies user first, and system later, miniflask will find user modules first, and then the system ones. (Very much like the PATH environment variable in Linux) What I don't like is the fact that the user has to know every other module in other repositories and take care of duplicates. What happens if the user uses his repository in another context? Will function calls like |
Thank you for your feedback. I'll first summarize the feature proposals that we talked about in the last weeks and then comment on the pros and cons each. Module-Name based replacement: Pros:
Cons:
Module-ID based replacement: Pros:
Cons:
Comment:
To be honest, I do not see how the first method gives a more loose coupling of modules and requires less knowledge of the repository to replace modules in. In both cases the user needs to know the module to be replaced in a broad manner (like the events it defines) anyway? I think, both methods achieve more or less the same, however the second method allows multiple modules to serve as replacements for the very same module. Also, the method does not require the module to serve as a replacement to be placed in a separate repository. |
b98b08f
to
260e362
Compare
dfa8411
to
ee089c8
Compare
Register as / Replacing Modules from other Repositories
This MR presents a proposal for replacing modules from other repositories.
Consider two repositories:
main
andreplace
,where the repository
main
contains the module hierarchy that plays well together.This MR:
main
loads another module, i.e.testmodule
. The module will always be searched inmain
, same applies for any other repository.register_as
to let one module take the place of any other module (also in other repositories).Previously, a module could only take the place of another module if that module has been called using
register_default_module
.New
register_as
behavior (previously known asredefine_scope
):register_as
allows any module to be internally renamed to any other module in such a way that the original module will not be loaded anymoremain
repository