Open michalk8 opened 3 years ago
hi @michalk8! Thanks for your input! As these are three feature requests, we should probably turn it into three separate issues.
- would it be possible to include alias argument (optional) to access the modified docstring? With some check if it's specified so that it doesn't overwrite existing keys.
sure, why not. sounds reasonable to me.
- can keep_params and deleta_params be used as decorators? I'd like to keep things in place rather than invoking d.keep_params somewhere below the functions
I understand your point. It's a bit awkward as the keep_params
method would then just return a function that takes a callable does nothing, but I think that's ok.
- can typehints in the docstrings be made optional? I always use https://pypi.org/project/sphinx-autodoc-typehints/, so including them in the docstring is not necessary. However, not including them doesn't currently work with {keep,delete}_params.
Sure, makes sense.
Maybe you have an idea how to best approach this?
I'd need to play around with the regex myself in order to solve this. It's indeed not that straight-forward. Alternatively, you could use the keep_types
method, which should pretty much do what you'd like to see.
Hi @Chilipp , thanks for making docrep, I find it really useful! I have 3 small requests, all somewhat related to
keep_params
/delete_params
:alias
argument (optional) to access the modified docstring? With some check if it's specified so that it doesn't overwrite existing keys.keep_params
anddeleta_params
be used as decorators? I'd like to keep things in place rather than invokingd.keep_params
somewhere below the functionscan typehints in the docstrings be made optional? I always use https://pypi.org/project/sphinx-autodoc-typehints/, so including them in the docstring is not necessary. However, not including them doesn't currently work with
{keep,delete}_params
.I think 1. and 2. are fairly easy to adjust and I can make a PR for them.
As for 3., I somewhat naively though it might be as simple as modifying the relevant part of the regex from
:
to:?
(or similar), however that's not the case, since some tests were failing (esp. the complex ones, where there was a mixture of keeping the annotations in the docstrings and omitting them [which is really discouraged]). Maybe you have an idea how to best approach this?