Keep original docstring from @task decorated function
See original GitHub issueCurrent behavior
When decorating a function with @task
, the original docstring of the function is lost.
Proposed behavior
Original docstring is kept. Looking at the wrapper prefect.utilities.tasks.task
, I thinks this should be do-able with functools.wraps
, although I am not exactly sure what change needs to be made.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Python decorator handling docstrings - Stack Overflow
I've recently been failing to get the help description correct for decorated functions - it seems a pretty poor state of affairs, but...
Read more >Preserving docstrings when decorating functions | Python
Here is an example of Preserving docstrings when decorating functions: Your friend has come to you with a problem.
Read more >How to Keep Your Original Method Attributes When Using ...
With “functools.wrap,” the decorated function that returns the “wrapper()” function takes care of copying the docstring, name function, and other information ...
Read more >How to preserve Function Metadata while using Decorators?
This can be done using the wraps() method of the functools. It updates the wrapper function to look like wrapped function by copying...
Read more >Python Decorators [Part 1]. Primer | by Sumeet Sarkar | Medium
Decorator needs the understanding of the fact that functions in python are ... Do we always have to implement a wraps to preserve...
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 ended up implementing a sphinx extension for this.
@cicdw just tried exactly that, no joy …