[FEATURE] allow for all kwargs when using @log_step
See original GitHub issueHi,
When using @log_step
in debugging a Pandas Pipeline, the current function must accept a single argument of df:pd.Dataframe
.
However if the user sends all the parameters as kwargs there is an error .
It would be useful if the @log_step
will check the first kwargs and if it is a pd.Dataframe
then it will convert it into an arg - possible implementation before running the def wrapper() as follows
_kwargs = {**kwargs}
first_arg= next(iter(_kwargs))
if isinstance(_kwargs[first_arg],pd.DataFrame) and len(args)==0:
args=args+(_kwargs.pop[first_arg],)
Issue Analytics
- State:
- Created 9 months ago
- Comments:5
Top Results From Across the Web
Python args and kwargs: Demystified
In this step-by-step tutorial, you'll learn how to use args and kwargs in Python to add more flexibility to your functions. You'll also...
Read more >How To Use *args and **kwargs in Python 3 - DigitalOcean
Let's create another short program to show how we can make use of **kwargs . Here we'll create a function to greet a...
Read more >10 Examples to Master *args and **kwargs in Python
**kwargs allow a function to take any number of keyword arguments. By default, **kwargs is an empty dictionary. Each undefined keyword argument ...
Read more >python - Passing more kwargs into a function than initially set
I'm using the inspect.signature() function to check if the callable supports a **kwarg catch-all (by looking for a Parameter.VAR_KEYWORD entry) ...
Read more >What are args and kwargs and when to use them
So far, it is clear that you can use *args to accept a variable number of arguments in a function. But the other...
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 Free
Top 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
I’m not sure if changing
args
directly is a great way to solve this because we use it later inresult = func(*args, **kwargs)
Maybe something like this?
If you think this is a good direction I’ll be happy to submit a PR