Extracting documentation from resource
- Dominant language
- Python
- Stars
- 652
- Forks
- 151
- PR merge metrics
- No merged PRs in 30d
Description
Is it possible to extract documentation from the docstring, e.g.
````python
class CatResource(MethodResource):
@marshal_with(PetSchema)
def get(self, pet_id):
"""Gets the cat with the given id
Lorem ipsum dolor sit amet, ea aeque commodo lucilius nam. Est tation
libris periculis eu, tale oporteat efficiantur eu quo. Choro integre has
cu. Et mea mutat habemus vulputate, iudico prompta facilisis pro te,
porro fugit labore ut cum. Has audiam alienum apeirian in, mel ut vero
porro option, aliquip mediocrem accusamus mea an. In his iisque laboramus
efficiendi.
Inermis volutpat ne his, an populo debitis complectitur vix. Eros
bonorum feugait no has. Eu duis autem per, eu his paulo neglegentur
necessitatibus. Zril voluptaria mel at, saperet dissentiet in duo.
"""
return Pet('calici', 'cat')
````
This would be equivalent to what I am doing at the moment:
````python
class CatResource(MethodResource):
@marshal_with(PetSchema)
@doc(
summary='Gets the cat with the given id',
description='Lorem ipsum dolor sit amet, ea aeque commodo lucilius nam. Est tation '
'libris periculis eu, tale oporteat efficiantur eu quo. Choro integre has '
'cu. Et mea mutat habemus vulputate, iudico prompta facilisis pro te, '
'porro fugit labore ut cum. Has audiam alienum apeirian in, mel ut vero '
'porro option, aliquip mediocrem accusamus mea an. In his iisque laboramus '
'efficiendi.'
'\n'
'\n'
'Inermis volutpat ne his, an populo debitis complectitur vix. Eros '
'bonorum feugait no has. Eu duis autem per, eu his paulo neglegentur '
'necessitatibus. Zril voluptaria mel at, saperet dissentiet in duo.')
def get(self, pet_id):
return Pet('calici', 'cat')
````
The docstring itself is easy to extract, e.g. `CatResource.get.__doc__`. Is this already possible? When the description becomes very descriptive (e.g. more than 72 characters which results in a new line according to PEP 8) it becomes harder to read and format, than if it has been in the docstring of the method.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the @doc decorator, the @marshal_with decorator, and the CatResource.get.__doc__ example. Trace how the existing API documentation reads summary and description, then determine whether the method docstring can supply equivalent values. Done means generated documentation preserves the docstring’s summary and full description without duplicating them in @doc.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100