kieferk / dfply

dplyr-style piping operations for pandas dataframes
GNU General Public License v3.0
889 stars 103 forks source link

Function docstring not preserved with @dfpipe decorator #35

Open janfreyberg opened 6 years ago

janfreyberg commented 6 years ago

Passing through docstrings now works great when using the @pipe decorator, but not when you use the @dfpipe decorator (which the dfply functions get defined through).

The problem is that when using @dfpipe, the function passed to pipe is actually group_delegation:

def dfpipe(f):
    return pipe(
        group_delegation(
            symbolic_evaluation(f)
        )
    )

I think for this to truly work you'd need to pass the docstring through all three of these functions. Then mutate and other dfply functions would have the proper docstrings.

kieferk commented 6 years ago

OK, I'll add the same think you added to the dfpipe decorator to the other decorators right now and hopefully it will clear up the docstrings displaying.

kieferk commented 6 years ago

@janfreyberg I just pushed a couple changes to master that hopefully will get this working for you. Check it out and let me know if it solves your issue.

janfreyberg commented 6 years ago

Just to follow up on this – this works really well now! Thanks for this. shift-tab in jupyter now displays the docstring for mutate.

There's lots of functions with no docstring right now, though - I'll start documenting some of these this next week.

Once they all have docstrings, it could be nice to move the documentation to sphinx so that updating the docstring and documentation is the same thing!