Skip to content
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

Documentation links in tutorials #136

Merged
merged 26 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
def7f79
versions frozen
pseusys Apr 27, 2023
5297d20
Merge branch 'dev' of https://github.com/deeppavlov/dialog_flow_frame…
pseusys Apr 27, 2023
299145d
documentation links added to some of the examples
pseusys May 27, 2023
590f6a8
caches left undocumented only
pseusys May 28, 2023
66339bb
Merge branch 'dev' into feat/documentation_links_in_tutorials
pseusys Jun 16, 2023
3872296
merge artifact removed
pseusys Jun 16, 2023
78329b8
link llength fixing comments added
pseusys Jun 23, 2023
a14a87a
tutorial format test fixed
pseusys Jun 23, 2023
d5f0727
Merge branch 'dev' into feat/documentation_links_in_tutorials
pseusys Jul 20, 2023
8f6b567
tests fixed
pseusys Jul 26, 2023
1d233d0
problems mentioned in review (partly) fixed
pseusys Aug 2, 2023
b35b6ed
two more fixes
pseusys Aug 2, 2023
cb03e52
Merge branch 'dev' into feat/documentation_links_in_tutorials
pseusys Aug 18, 2023
3f33130
added to merge
pseusys Aug 18, 2023
2921fb7
correct and unbroken links added to documentation
pseusys Aug 18, 2023
caa6718
links proposition
pseusys Aug 21, 2023
00800d4
docs fixed
pseusys Aug 23, 2023
82c14c9
links fixed (again)
pseusys Aug 23, 2023
e67d974
review comments fixed
pseusys Aug 24, 2023
a14cce4
Merge branch 'dev' into feat/documentation_links_in_tutorials
pseusys Sep 29, 2023
aa6f44a
docs added to tutorials
pseusys Sep 30, 2023
072a71e
dff -> api
pseusys Sep 30, 2023
adfea27
add note about index pages.
RLKRo Oct 1, 2023
6641694
remove markdown wrapping from usage example for `DocumentationLink`
RLKRo Oct 1, 2023
ce9898f
use `mddoclink` in benchmark tutorial && minor changes to the tutorial
RLKRo Oct 1, 2023
b54a737
minor corrections to cache tutorial descriptions
RLKRo Oct 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions docs/source/utils/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,18 @@ def inner(tutorial_text: str):
# %% [markdown]
\"\"\"
__Installing dependencies__

The cell below installs dff with dependencies for running tutorials
To install the minimal version of dff, use `pip install dff`
To install other options of dff, use `pip install dff[OPTION_NAME1,OPTION_NAME2]`
where OPTION_NAME can be one of the options from EXTRA_DEPENDENCIES.
e.g `pip install dff[ydb, mysql]` installs dff with dependencies for using Yandex Database and MySQL
EXTRA_DEPENDENCIES can be found in
[here](https://github.com/deeppavlov/dialog_flow_framework/blob/dev/README.md#installation)
pseusys marked this conversation as resolved.
Show resolved Hide resolved
\"\"\"

# %%
!python3 -m pip install -q dff[tutorials]
# Installs dff with dependencies for running tutorials
# To install the minimal version of dff, use `pip install dff`
# To install other options of dff, use `pip install dff[OPTION_NAME1,OPTION_NAME2]`
# where OPTION_NAME can be one of the options from EXTRA_DEPENDENCIES.
# e.g `pip install dff[ydb, mysql]` installs dff with dependencies for using Yandex Database and MySQL
# EXTRA_DEPENDENCIES can be found in
# https://github.com/deeppavlov/dialog_flow_framework/blob/dev/README.md#installation


# %% [markdown]
\"\"\"
__Running tutorial__
\"\"\"
pseusys marked this conversation as resolved.
Show resolved Hide resolved

{tutorial_text[second_cell:]}
""",
Expand Down
2 changes: 1 addition & 1 deletion tests/tutorials/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
re.compile(r"# %%\n"), # check python block
]

docstring_start_pattern = re.compile(r'# %% \[markdown\]\n"""\n#(?: .*:)? \d+\. .*\n(?:\n[\S\s]*)?"""\n')
docstring_start_pattern = re.compile(r'# %% \[markdown\]\n"""\n#(?: .*:)? \d+\. .*\n(?:\n[\S\s]*)?"""(?: # .*)?\n')
comment_start_pattern = re.compile(r'# %% \[markdown\]\n# #(?: .*:)? \d+\. .*\n#(?:\n# [\S\s]*)?')


Expand Down
7 changes: 6 additions & 1 deletion tutorials/context_storages/1_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
# 1. Basics

The following tutorial shows the basic use of the database connection.
"""

See [context_storage_factory](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.database.html#dff.context_storages.database.context_storage_factory) function
for creating a context storage factory by path.
pseusys marked this conversation as resolved.
Show resolved Hide resolved

In this example JSON file is used as a storage.
""" # noqa: E501


# %%
Expand Down
8 changes: 7 additions & 1 deletion tutorials/context_storages/2_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
# 2. PostgreSQL

This is a tutorial on using PostgreSQL.
"""

See [SQLContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class
for storing you users' contexts in SQL databases.
pseusys marked this conversation as resolved.
Show resolved Hide resolved

The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncpg](https://magicstack.github.io/asyncpg/current/)
pseusys marked this conversation as resolved.
Show resolved Hide resolved
libraries for asynchronous access to PostgreSQL DB.
""" # noqa: E501


# %%
Expand Down
7 changes: 6 additions & 1 deletion tutorials/context_storages/3_mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
# 3. MongoDB

This is a tutorial on using MongoDB.
"""

See [MongoContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.mongo.html#mongo) class
for storing you users' contexts in Mongo database.

The DFF uses [motor](https://motor.readthedocs.io/en/stable/) library for asynchronous access to MongoDB.
""" # noqa: E501


# %%
Expand Down
7 changes: 6 additions & 1 deletion tutorials/context_storages/4_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
# 4. Redis

This is a tutorial on using Redis.
"""

See [RedisContextStorage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.redis.html#redis) class
for storing you users' contexts in Redis database.

The DFF uses [redis.asyncio](https://redis.readthedocs.io/en/latest/) library for asynchronous access to Redis DB.
""" # noqa: E501


# %%
Expand Down
8 changes: 7 additions & 1 deletion tutorials/context_storages/5_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
# 5. MySQL

This is a tutorial on using MySQL.
"""

See [MySQL](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class
for storing you users' contexts in SQL databases.

The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [asyncmy](https://github.com/long2ice/asyncmy)
libraries for asynchronous access to MySQL DB.
""" # noqa: E501


# %%
Expand Down
10 changes: 9 additions & 1 deletion tutorials/context_storages/6_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
# 6. SQLite

This is a tutorial on using SQLite.
"""

See [SQLite](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.sql.html#sql) class
for storing you users' contexts in SQL databases.

The DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/) and [aiosqlite](https://readthedocs.org/projects/aiosqlite/)
libraries for asynchronous access to SQLite DB.

Note that protocol separator for windows differs from one for linux.
""" # noqa: E501


# %%
Expand Down
7 changes: 6 additions & 1 deletion tutorials/context_storages/7_yandex_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
# 7. Yandex DataBase

This is a tutorial on how to use Yandex DataBase.
"""

See [YDB](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.context_storages.ydb.html#yandex-db) class
for storing you users' contexts in Yandex database.

The DFF uses [ydb.aio](https://ydb.tech/en/docs/) library for asynchronous access to Yandex DB.
""" # noqa: E501


# %%
Expand Down
7 changes: 6 additions & 1 deletion tutorials/messengers/telegram/1_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

The following tutorial shows how to run a regular DFF script in Telegram.
It asks users for the '/start' command and then loops in one place.
"""

Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface)
class and [telebot](https://pytba.readthedocs.io/en/latest/index.html) library are used for accessing telegram API in polling mode.

Telegram API token is used for access telegram API.
pseusys marked this conversation as resolved.
Show resolved Hide resolved
""" # noqa: E501


# %%
Expand Down
12 changes: 10 additions & 2 deletions tutorials/messengers/telegram/2_buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
"""
# Telegram: 2. Buttons


This tutorial shows how to display and hide a basic keyboard in Telegram.
"""

Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message)
class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and
[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard)
classes are used for configuring additional telegram message features.

Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message)
classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc.
""" # noqa: E501


# %%
import os
Expand Down
12 changes: 10 additions & 2 deletions tutorials/messengers/telegram/3_buttons_with_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@
"""
# Telegram: 3. Buttons with Callback


This tutorial demonstrates, how to add an inline keyboard and utilize
inline queries.
"""

Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message)
class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and
[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard)
classes are used for configuring additional telegram message features.

Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message)
classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc.
""" # noqa: E501


# %%
import os
Expand Down
11 changes: 10 additions & 1 deletion tutorials/messengers/telegram/4_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@

This tutorial shows how to process Telegram updates in your script
and reuse handler triggers from the `pytelegrambotapi` library.
"""

Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message)
class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and
[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard)
classes are used for configuring additional telegram message features.

Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message)
classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc.
""" # noqa: E501
pseusys marked this conversation as resolved.
Show resolved Hide resolved


# %%
import os
Expand Down
11 changes: 10 additions & 1 deletion tutorials/messengers/telegram/5_conditions_with_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
# Telegram: 5. Conditions with Media

This tutorial shows how to use media-related logic in your script.
"""

Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message)
class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and
[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard)
classes are used for configuring additional telegram message features.

Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message)
classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc.
""" # noqa: E501
pseusys marked this conversation as resolved.
Show resolved Hide resolved


# %%
import os
Expand Down
15 changes: 14 additions & 1 deletion tutorials/messengers/telegram/6_conditions_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@

This tutorial shows how to use additional update filters
inherited from the `pytelegrambotapi` library.
"""

Here, [TelegramMessage](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#telegram-message)
class is used to represent telegram message, [TelegramUI](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.TelegramUI) and
[RemoveKeyboard](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.message.html#dff.messengers.telegram.message.RemoveKeyboard)
classes are used for configuring additional telegram message features.

Different [message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#message)
classes are used for representing different common message features, like Attachment, Audio, Button, Image, etc.
pseusys marked this conversation as resolved.
Show resolved Hide resolved

[telegram_condition](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.telegram_condition)
function and different types of [UpdateType](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.telegram.messenger.html#dff.messengers.telegram.messenger.UpdateType)
can be used for telegram message type checking.
pseusys marked this conversation as resolved.
Show resolved Hide resolved
""" # noqa: E501


# %%
import os
Expand Down
4 changes: 3 additions & 1 deletion tutorials/messengers/telegram/7_polling_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

The following tutorial shows how to configure `PollingTelegramInterface`.

"""
Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.PollingMessengerInterface)
and its' different parameters are shown.
pseusys marked this conversation as resolved.
Show resolved Hide resolved
""" # noqa: E501


# %%
Expand Down
5 changes: 4 additions & 1 deletion tutorials/messengers/telegram/8_webhook_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

The following tutorial shows how to use `CallbackTelegramInterface`
that makes your bot accessible through a public webhook.
"""

Here, [PollingTelegramInterface](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.messengers.common.interface.html#dff.messengers.common.interface.CallbackMessengerInterface)
pseusys marked this conversation as resolved.
Show resolved Hide resolved
is used for accessing telegram API in callback mode.
""" # noqa: E501


# %%
Expand Down
8 changes: 7 additions & 1 deletion tutorials/messengers/web_api_interface/1_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
This tutorial shows how to create an API for DFF using FastAPI.

You can see the result at http://127.0.0.1:8000/docs.
"""

Here, `_run_pipeline` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run))
pseusys marked this conversation as resolved.
Show resolved Hide resolved
method is used to execute pipeline once.

[Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message)
is used to represent incoming to pipeline data.
pseusys marked this conversation as resolved.
Show resolved Hide resolved
""" # noqa: E501


# %%
Expand Down
8 changes: 7 additions & 1 deletion tutorials/messengers/web_api_interface/2_websocket_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
> ... for this example, we'll use a very simple HTML document with some JavaScript,
> all inside a long string.
> This, of course, is not optimal and you wouldn't use it for production.
"""

Here, `_run_pipeline` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run))
method is used to execute pipeline once.

[Message](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.message.html#dff.script.core.message.Message)
is used to represent incoming to pipeline data.
pseusys marked this conversation as resolved.
Show resolved Hide resolved
""" # noqa: E501


# %%
Expand Down
5 changes: 4 additions & 1 deletion tutorials/pipeline/1_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

The following tutorial shows basic usage of `pipeline`
module as an extension to `dff.script.core`.
"""

Here, `__call__` (same as [run](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.run))
method is used to execute pipeline once.
""" # noqa: E501


# %%
Expand Down
5 changes: 4 additions & 1 deletion tutorials/pipeline/2_pre_and_post_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

The following tutorial shows more advanced usage of `pipeline`
module as an extension to `dff.script.core`.
"""

Here, [MISC](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.script.core.context.html#dff.script.core.context.Context.misc)
dictionary of context is used for storing message additional data.
pseusys marked this conversation as resolved.
Show resolved Hide resolved
""" # noqa: E501


# %%
Expand Down
8 changes: 7 additions & 1 deletion tutorials/pipeline/3_pipeline_dict_with_services_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@

The following tutorial shows `pipeline` creation from
dict and most important pipeline components.
"""

Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#service)
class, that can be used for pre- and postprocessing of messages is shown.

Pipeline [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict)
static method can be used for pipeline creation (from dictionary).
pseusys marked this conversation as resolved.
Show resolved Hide resolved
""" # noqa: E501


# %%
Expand Down
8 changes: 7 additions & 1 deletion tutorials/pipeline/3_pipeline_dict_with_services_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@

The following tutorial shows `pipeline` creation from dict
and most important pipeline components.
"""

Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#service)
class, that can be used for some more complex pre- and postprocessing of messages is shown.

Pipeline [from_dict](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.pipeline.pipeline.html#dff.pipeline.pipeline.pipeline.Pipeline.from_dict)
static method can be used for pipeline creation (from dictionary).
pseusys marked this conversation as resolved.
Show resolved Hide resolved
""" # noqa: E501


# %%
Expand Down
6 changes: 5 additions & 1 deletion tutorials/pipeline/4_groups_and_conditions_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
# 4. Groups and conditions (basic)

The following example shows `pipeline` service group usage and start conditions.
"""

Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#dff.pipeline.service.service.Service)s
and [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s
are shown for advanced data pre- and postprocessing based on conditions.
""" # noqa: E501


# %%
Expand Down
6 changes: 5 additions & 1 deletion tutorials/pipeline/4_groups_and_conditions_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
# 4. Groups and conditions (full)
pseusys marked this conversation as resolved.
Show resolved Hide resolved

The following tutorial shows `pipeline` service group usage and start conditions.
"""

Here, [Service](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.service.html#dff.pipeline.service.service.Service)s
and [ServiceGroup](https://deeppavlov.github.io/dialog_flow_framework/apiref/dff.pipeline.service.group.html#dff.pipeline.service.group.ServiceGroup)s
are shown for advanced data pre- and postprocessing based on conditions.
""" # noqa: E501


# %%
Expand Down
Loading