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
Adding dependencies through the hook framework is a bit overly complicated and undocumented #2557
Comments
There is another "problem". Since the first hook one can possibly do this in now is the pre_fetch_hook, doing a --dry-run won't show any changes in dependencies, thus possibly causing confusion. Also --robot doesn't pick up on the added dependencies because resolving dependencies is done before pre_fetch_hook. |
@akesandgren It sounds like we need a hook to allow you to intervene before the actual parsing of an easyconfig file happens, i.e. where you can modify the raw dict representation after the easyconfig file was read? |
That might be a bit of overkill if the target is changing dependencies, (in which case the suggestion above will suffice). But it might be useful to be able to change things that early on. |
--module-only will have problems if this isn't done the right way (whatever that ends up being). |
@akesandgren I think we can avoid that you need to call The The latter is why it's now so tricky to modify dependencies, you're basically being forced by doing it too late. If we pull the for loop apart to first just set the "raw" value for the Not only would that result in a hook that should allow for easily tweaking the |
Removing the call to _parse_dep in the for loop leaves just self[key] = local_vars[key] right? And having a hook after that loop is where i'd like to have it. One should be able to handle both deps (add/remove) and patch (add/remove) in that hook. (and technically all sorts of things) |
@akesandgren Please check #2562, and see if it works for you... |
Yes it works like a charm. |
fixed in #2562 |
The implemented hook framework has no easy way to add dependencies (or remove them).
There are two problems:
Adding a dependency_hook in EasyConfig.parse() before the call to self.generate_template_values() would make this much cleaner. One would still have to call self.cfg._parse_dependency() but one could add a helper function in the framework to handle the actual add/remove of a list of dependencies.
The other approach would be to write good documentation on this.
A piece of hook code that works is the following:
The text was updated successfully, but these errors were encountered: