tantale / deprecated

Python @deprecated decorator to deprecate old python classes, functions or methods.
MIT License
298 stars 32 forks source link

support for deprecated parameters #53

Closed mjhajharia closed 1 year ago

mjhajharia commented 2 years ago

I followed the contribution guide on the issue related to adding support for deprecated parameters, I had made a previous PR but I think it wasn't well formatted or according to guidelines so I made a new one. You can view the usage here.

https://gist.github.com/mjhajharia/061b5fc054ec4948fa0af3bd1083b6a2

Since chunks of the classic adapter get modified, I think for the sake of not messing up the already existing tests, it's better to create a new adapter, so I created classicadapterparam in param.py and it's sphinx equivalent in param_sphinx.py

This code itself, reformatted differently can also be seen here https://deprecat.readthedocs.io/en/latest/source/api.html#examples, it looks nice I think

Additionally, you can see a live example of the PyMC docs generated using a PR here https://pymc--5226.org.readthedocs.build/en/5226/api/distributions/utilities.html#pymc3.distributions.Distribution

Note:

  1. we should not be using the deprecated directive for kwargs as it is only for functions or classes, so I'm making use of admonitions!
  2. the sphinx directive for kwargs only works properly in numpydoc formatting of doc strings