Repository navigation
add task attribute 'inherits' to take over declarations of other tasks - #493
Open
SahilRajputdotexe wants to merge 1 commit into
Open
SahilRajputdotexe wants to merge 1 commit into
SahilRajputdotexe wants to merge 1 commit into
Conversation
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.
Tasks that share file dependencies, options or up-to-date checks currently have to repeat them in every task. This adds an
inheritsattribute (a list or tuple of task names) so a task can take on the declarations of other tasks.testnow also depends onsetup.cfgand accepts--level.What gets inherited:
file_depandcalc_depare combined,task_depandsetupkeep the task's own entries first and then the parents',uptodatechecks are added (an inheritedconfig_changedis recorded for the inheriting task),params,getargsandmetaare merged by name with the task's own entry winning, anddocandverbositycome from the first parent that has one when the task has none.actions,targets,clean,teardown,title,io,watchandpos_argare never inherited and parents are never modified. Parents can be sub-tasks or group tasks, chains work, andlist,info,help,TaskControlandcreate_aftertasks all see the resolved tasks.An unknown name raises
InvalidTaskand a cycle raisesInvalidDodoFile.I did not find an existing issue for this. I added docs in
doc/tasks.rst, a sample and a CHANGES entry.Tests are in
tests/test_task_inherits.py.rut,doit pyflakesanddoit codestylepass locally apart from one macOS path-case failure intest_action.pythat is unrelated, and the full CI matrix passes on my fork.