Keyword-only arguments in pipeline function signature break the compilation
See original GitHub issue/kind bug
What steps did you take and what happened:
Pass a pipeline function that has keyword-only arguments, e.g. def pipeline(*, keyword_only_argument: str)
.
Compiler rises:
TypeError: missing a required argument: 'keyword_only_argument'
What did you expect to happen:
Pipeline working just fine, just like for non-keyword-only arguments, e.g. def pipeline(casual_argument: str)
.
Additional information:
Origins in compiler.py
due to using FullArgsSpec.args
, which doesn’t contain keyword-only arguments:
argspec = inspect.getfullargspec(pipeline_func)
(...)
for arg_name in argspec.args:
args_list.append(...)
with dsl.Pipeline(pipeline_name) as dsl_pipeline:
pipeline_func(*args_list)
Environment:
Irrelevant.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Keyword-only arguments in pipeline function signature break ...
Create a pipeline function with keyword-only argument(s). Pass it to compile . def some_pipeline(*, keyword_only_argument: str): pass ...
Read more >python - What is the safe way of using keyword-only arguments?
Advantages: It's less error-prone. When having positional arguments in a function call, changing a signature can break things. With keyword-only ...
Read more >Functions - Julia Documentation
Keyword argument default values are evaluated only when necessary (when a corresponding keyword argument is not passed), and in left-to-right order. Therefore ...
Read more >Keyword-only Arguments in Python - Medium
A keyword argument is an argument preceded by an identifier (named arguments). Notice that the value here is passed in a function call...
Read more >Robot Framework User Guide
As the first example of using free named arguments, let's take a look at Run Process keyword in the Process library. It has...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So the
FullArgSpec
does contain thekwonlyargs
, which we could make use of here.But is that really a useful thing to do? Why would you define a
dsl.Pipeline
function withvarargs
(*
) followed bykwonlyargs
? Should your pipeline function not have to know about the arguments by name in order to do something useful with them?This issue has been automatically closed because it has not had recent activity. Please comment “/reopen” to reopen it.