Skip to content

Conversation

@Bibo-Joshi
Copy link
Contributor

Hi again :)

In python-telegram-bot/python-telegram-bot#3010 it was notices that sphinx-paramlinks doesn't work with napoleons "Keyword Arguments" - see e.g. here for how we use that to differentiate between positional and keyword-only arguments. See the docs of napoleon, sphinx-doc/sphinx#2379 and sphinx-doc/sphinx#2381 for more info on how "Keyword Arguments" are implemented in sphinx.

However this seems to be rather easy to support by just enhancing two regexes a bit. A test on our documentation seemed to work fine.

@zzzeek
Copy link
Contributor

zzzeek commented May 31, 2022

wow your docs look so much better than mine and I've been trying for 16 years to get them to be readable :( are those annotations after each param things you have to enter in the docstring explicitly w/ napoleon or are they derived from pep-484 annotations? they look much cleaner than pep484 annotations.

@zzzeek
Copy link
Contributor

zzzeek commented May 31, 2022

yeah this looks great, i can follow it.

@Bibo-Joshi
Copy link
Contributor Author

wow your docs look so much better than mine

Thanks 👼 Much is due to the theme though - we recently switched from the readthedocs theme to furo. Also our docs contain almost exclusively technical references (i.e. class definitions along with parameters, methods etc) and more detailed explanations of the usage are in a github wiki. that seems to be different for sqlalchemy and IMO changes the overall impression

are those annotations after each param things you have to enter in the docstring explicitly w/ napoleon or are they derived from pep-484 annotations? they look much cleaner than pep484 annotations.

Those are set explicitly (source for the method linked above). There are some extensions that try to parse the type annotations into the docstrings. I tried around with sphinx-autodoc-typehints a while ago and found manually writing the types to yield nicer results. Though I should add that this particular project has a new maintainer since then and probably has evolved quite a bit.

yeah this looks great, i can follow it.

Sweet :) We're using a Telegram Bot in our support group that allows us to search through the documenation on the fly from within Telegram and being able to point users directly to the parameters has greatly improved our support. So it would be awesome if we could continue to do so for the keyword only arguments 👍

@zzzeek zzzeek merged commit 0b61b10 into sqlalchemyorg:main May 31, 2022
@Bibo-Joshi Bibo-Joshi deleted the kwargs branch May 31, 2022 16:55
@zzzeek
Copy link
Contributor

zzzeek commented May 31, 2022

it's released. i didnt test it, so if there's problems, I'm sure we'll notice...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants