-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Docs cross references (#2633) #2855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs cross references (#2633) #2855
Conversation
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
Signed-off-by: starry69 <starry369126@outlook.com> Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com> Co-authored-by: poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Looks like you edited the (dev) requirements or the pre-commit hooks. I'm just a friendly reminder to keep the pre-commit hook versions in sync with the dev requirements and the additional dependencies for the hooks in sync with the requirements :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Looks like you edited README.rst or README_RAW.rst. I'm just a friendly reminder to apply relevant changes to both of those files :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there. Relax, I am just a little warning for the maintainers to release directly after merging your PR, otherwise we have broken examples and people might get confused :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your PR - nice work! Concentrating on inter-doc linking is perfectly fine 👍
I left a few comments below. Apart from that, I have two more general comments:
- it would be nice to have some more cross-referencing in
tg.ext
. e.g. link fromHandler
toDispatcher.add/remove_handler
, fromCallbackContext.job
toJobQueue
, from {CallbackContext
,Dispatcher.{chat, bot, user}_data
} toContextTypes
, fromContextTypes
to{Updater,Dispatcher}Builder.context_types
, fromDefaults
to{Updater, Dispatcher}Builder.defaults
andExtBot.defaults
, fromCallbackDataCache
toExtBot.callback_data_cache
andCallbackContext.drop_callback_data
, fromDispatcher.update_persistence
toBasePersistecne.update_*_data
. You can probably find some more :) That said, I'm ofc aware, that it's probably impossible to find all the links :D - Having each reference on a new line seems a bit excessive and uses a lot of space. Can you remove the empty lines and add commas at the end of the lines? that way we get a more compact overview
@@ -2345,6 +2460,12 @@ def get_file( | |||
You should save the file's MIME type and name (if available) when the File object | |||
is received. | |||
|
|||
.. seealso:: :meth:`telegram.ChatPhoto.get_small_file` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, we also have {Animation, Audio, Document, PhotoSize, Sticker, Video, VideoNote, Voice}.get_file
. Please also check that you link back to here from those methods :)
@@ -42,6 +42,10 @@ class ChatMember(TelegramObject): | |||
Objects of this class are comparable in terms of equality. Two objects of this class are | |||
considered equal, if their :attr:`user` and :attr:`status` are equal. | |||
|
|||
.. seealso:: :attr:`telegram.ChatMemberUpdated.old_chat_member` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also tg.ChatMember
, Bot.get_chat_member
, Bot.get_chat_administrators
@@ -36,6 +36,8 @@ class ChatPermissions(TelegramObject): | |||
permissions that are set, but also sets all the others to :obj:`False`. However, since not | |||
documented, this behaviour may change unbeknown to PTB. | |||
|
|||
.. seealso:: :attr:`telegram.Chat.permissions` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and Bot.set_chat_permissions
@@ -34,6 +34,8 @@ class ChatPhoto(TelegramObject): | |||
considered equal, if their :attr:`small_file_unique_id` and :attr:`big_file_unique_id` are | |||
equal. | |||
|
|||
.. seealso:: :attr:`telegram.Chat.ChatPhoto` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. seealso:: :attr:`telegram.Chat.ChatPhoto` | |
.. seealso:: :attr:`telegram.Chat.chat_photo` |
.. seealso:: :attr:`telegram.CallbackQuery.media` | ||
|
||
:attr:`telegram.messages.media` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InputMedia
objects are never sent back from telegram, they are only used as input for send_media_group
or edit_message_media
. Please also add this to the subclasses - btw same for ChatMember
:)
@@ -39,6 +39,7 @@ class KeyboardButton(TelegramObject): | |||
* :attr:`request_poll` option will only work in Telegram versions released after 23 | |||
January, 2020. Older clients will receive unsupported message. | |||
|
|||
.. seealso:: :attr:`telegram.ReplyKeyboardMarkup.keyboard` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. seealso:: :attr:`telegram.ReplyKeyboardMarkup.keyboard` | |
.. seealso:: :attr:`telegram.ReplyKeyboardMarkup.keyboard` | |
@@ -84,6 +84,22 @@ class Message(TelegramObject): | |||
Note: | |||
In Python :keyword:`from` is a reserved word, use ``from_user`` instead. | |||
|
|||
.. seealso:: :meth:`telegram.Bot.send_message` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the other send_*
methods also return Messages
and so do the edit_*
methods … IMO that's in fact a bit much cross referencing - IMO we can just skip all of those here, including send_message
@@ -96,6 +98,10 @@ class BasePersistence(Generic[UD, CD, BD], ABC): | |||
.. versionchanged:: 14.0 | |||
The parameters and attributes ``store_*_data`` were replaced by :attr:`store_data`. | |||
|
|||
.. seealso:: :attr:`telegram.ext.ConversationHandler.persistence` | |||
|
|||
:attr:`telegram.ext.Dispatcher.persistence` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{Updater, Dispatcher}Builder.persistence
@@ -503,6 +503,8 @@ class DispatcherBuilder(_BaseBuilder[ODT, BT, CCT, UD, CD, BD, JQ, PT]): | |||
.. seealso:: | |||
:class:`telegram.ext.UpdaterBuilder` | |||
|
|||
:meth:`telegram.ext.Dispatcher.builder` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn' make much sense IMO, please remove. same below.
Wow, do we really need so many cross references? Can't imagine adding/maintaining each one of these after refactors/API updates |
:attr:`telegram.InlineQuery.from_user` | ||
|
||
:attr:`telegram.InlineQuery.from_user` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
repeated
.. seealso:: :attr:`telegram.InputInvoiceMessageContent.prices` | ||
|
||
.. seealso:: :attr:`telegram.ShippingOption.prices` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. seealso:: :attr:`telegram.InputInvoiceMessageContent.prices` | |
.. seealso:: :attr:`telegram.ShippingOption.prices` | |
.. seealso:: :attr:`telegram.InputInvoiceMessageContent.prices`, | |
:attr:`telegram.ShippingOption.prices` |
Some are surely more useful than others. E.g. Linking from |
Thanks for feedback! I will be working on fixes of issues listed in comments in the coming days =) |
At the moment, only the first part of the cross-referencing task has been completed, related to links within the source code, excluding the wiki and examples.
Checklist for PRs
.. versionadded:: version
,.. versionchanged:: version
or.. deprecated:: version
to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)AUTHORS.rst
(optional)