8000 Documentation improvements and fixes by HitaloM · Pull Request #19 · hydrogram/hydrogram · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
52 changes: 30 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ If you have a question, please use the [discussions](https://github.com/orgs/hyd

## Providing Feedback

Feedback from the community is very important to us at Hydrogram. You can share your thoughts and suggestions by creating [discussions](https://github.com/orgs/hydrogram/discussions).
Feedback from the community is very important to us at Hydrogram. If you have any suggestions, ideas, or concerns, please share them with us. You can use the [discussions](https://github.com/orgs/hydrogram/discussions) to start a conversation.

You might be wondering about the difference between asking questions, providing feedback, and making feature requests. Asking questions is about seeking help or clarification. Providing feedback involves sharing your thoughts and opinions on the existing features and the project as a whole. Feature requests, on the other hand, are about suggesting new features or improvements. See the next section for more details on feature requests.

## Creating Issues

Expand Down Expand Up @@ -60,64 +62,70 @@ You can read more about pull requests in the [GitHub docs](https://docs.github.c
1. Fork the Hydrogram repository to your GitHub account.
2. Clone your forked repository of Hydrogram to your computer:

bash```
git clone <https://github.com/><your username>/hydrogram
cd hydrogram```
```bash
git clone https://github.com/<your username>/hydrogram
cd hydrogram
```

4. Add a track to the original repository:

bash```
git remote add upstream <https://github.com/hydrogram/hydrogram>```
```bash
git remote add upstream https://github.com/hydrogram/hydrogram
```

5. Install dependencies:

Hydrogram uses and recommends [Rye](https://rye-up.com/) for managing virtual environmens and dependencies.

bash```
rye sync --all-features```
```bash
rye sync --all-features
```

> We use `--all-features` to install all the optional dependencies, which are required to run the tests and build the documentation.

6. Install pre-commit hooks:

[Pre-commit](https://pre-commit.com/) is a tool that runs various checks before you make a commit. It helps you avoid committing any errors or warnings that might break your code or violate the coding standards.

bash```
pre-commit install```
```bash
pre-commit install
```

### Format the code (code-style)

Hydrogram uses [Ruff](https://docs.astral.sh/ruff/) for linting and formatting the code to maintain it consistent and clean. You should [install](https://docs.astral.sh/ruff/installation/) and run Ruff on your code before committing:

bash```
ruff check .```
```bash
ruff check .
```

However, you can also rely on [pre-commit](https://pre-commit.com/) for it:

bash```
pre-commit run --run-all-files```
```bash
pre-commit run --run-all-files
```

### Run tests

All changes should be tested:

bash```
pytest tests```
```bash
pytest tests
```

Remember to write tests for your new features or modify the existing tests to cover your code changes. Testing is essential to ensure the quality and reliability of your code.

### Docs

We use Sphinx to generate documentation in the `docs` directory. You can edit the sources and preview the changes using a live-preview server with:

bash```
sphinx-autobuild docs/source/ docs/build/ --watch hydrogram/```
```bash
sphinx-autobuild docs/source/ docs/build/ --watch hydrogram/
```

### Commit Messages

We use conventional commits, which provide a standardized and structured format for commit messages. This helps ensure clear and consistent communication about the changes made in each commit.

- **Commit messages**: The commit messages should follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification, which provides a structured and consistent format for describing the changes in the commits. The commit messages should have the following structure:
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), which provide a standardized and structured format for commit messages. This helps ensure clear and consistent communication about the changes made in each commit. The commit messages should have the following structure:

```
<type>[optional scope]: <description>
Expand Down Expand Up @@ -158,7 +166,7 @@ Write a concise summary of your changes in one or more sentences, so that bot de
- `feature` - when you add a new feature
- `bugfix` - when you fix a bug
- `doc` - when you improve the documentation
- `removal` - when you remove something from the library968sm6
- `removal` - when you remove something from the library
- `misc` - when you change something in the core or the project configuration

If you are not sure which category to use, you can ask the core contributors for help.
Expand Down
Empty file modified cherry-pick-pyro.sh
100755 → 100644
Empty file.
Binary file added docs/source/_static/img/mtproto-vs-bot-api.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 27 additions & 51 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,16 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

import re
import datetime
import sys
from pathlib import Path

project = "Hydrogram"
copyright = "2023-present, Hydrogram."
author = "Hydrogram"

docs_dir = Path(__file__).parent.parent
sys.path.insert(0, docs_dir.resolve().as_posix())

# Find the version and release information.
# We have a single source of truth for our version number: pip's __init__.py file.
# This next bit of code reads from it.
file_with_version = Path(docs_dir / ".." / "hydrogram" / "__init__.py")
with Path(file_with_version).open() as f:
for line in f:
if m := re.match(r'__version__ = "(.*)"', line):
__version__ = m[1]
# The short X.Y version.
version = ".".join(__version__.split(".")[:2])
# The full version, including alpha/beta/rc tags.
release = __version__
break
else: # AKA no-break
version = release = "dev"
import hydrogram # noqa: E402

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
project = "Hydrogram"
author = "Hydrogram"
copyright = f"{datetime.date.today().year}, {author}"
release = hydrogram.__version__

extensions = [
"sphinx.ext.autodoc",
Expand All @@ -48,38 +24,40 @@

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"aiosqlite": ("https://aiosqlite.omnilib.dev/en/stable/", None),
}

master_doc = "index"
source_suffix = ".rst"
autodoc_member_order = "bysource"
html_use_modindex = False
html_use_index = False

napoleon_use_rtype = False
napoleon_use_param = False

master_doc = "index"
source_suffix = ".rst"
autodoc_member_order = "bysource"
autodoc_typehints = "none"

towncrier_draft_autoversion_mode = "draft"
towncrier_draft_include_empty = True
towncrier_draft_working_directory = Path(__file__).parent.parent.parent

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
pygments_style = "friendly"

# Decides the language used for syntax highlighting of code blocks.
highlight_language = "python3"
html_theme = "furo"
html_title = f"{project} v{release} Documentation"
html_last_updated_fmt = (
f"{datetime.datetime.now(tz=datetime.UTC).strftime('%d/%m/%Y, %H:%M:%S')} UTC"
)

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_copy_source = False

html_theme = "furo"
html_title = f"{project} documentation v{release}"
html_static_path = ["_static"]
html_css_files = [
"css/all.min.css",
"css/custom.css",
]

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the documentation.
html_theme_options = {
"navigation_with_keys": True,
"dark_css_variables": {
Expand All @@ -92,12 +70,10 @@
},
"light_logo": "hydrogram-light.png",
"dark_logo": "hydrogram-dark.png",
"footer_icons": [
"footer_icons": [ # all these icons are from https://react-icons.github.io/react-icons
{
# Telegram channel logo
"name": "Telegram Channel",
"url": "https://t.me/HydrogramNews/",
# Following svg is from https://react-icons.github.io/react-icons/search?q=telegram
"html": (
'<svg stroke="currentColor" fill="currentColor" stroke-width="0" '
'viewBox="0 0 16 16" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">'
Expand All @@ -113,9 +89,9 @@
),
"class": "",
},
{ # Github logo
"name": "GitHub",
"url": "https://github.com/hydrogram/hydrogram/",
{
"name": "GitHub Organization",
"url": "https://github.com/hydrogram/",
"html": (
'<svg stroke="currentColor" fill="currentColor" stroke-width="0" '
'viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 '
Expand All @@ -130,8 +106,8 @@
),
"class": "",
},
{ # PTB website logo - globe
"name": "python-telegram-bot website",
{
"name": "Hydrogram Website",
"url": "https://hydrogram.org/",
"html": (
'<svg stroke="currentColor" fill="currentColor" stroke-width="0" '
Expand Down
2 changes: 1 addition & 1 deletion docs/source/topics/speedups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ The ``uvloop.install()`` call also needs to be placed before creating a Client i

app.run()

.. _TgCrypto: https://github.com/hydrogram/tgcrypto
.. _TgCrypto: https://github.com/pyrogram/tgcrypto
.. _uvloop: https://github.com/MagicStack/uvloop
2 changes: 1 addition & 1 deletion hydrogram/errors/pyromod/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/errors/pyromod/listener_stopped.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/errors/pyromod/listener_timeout.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/helpers/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/methods/pyromod/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/methods/pyromod/ask.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/methods/pyromod/listen.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/methods/pyromod/register_next_step_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/methods/pyromod/remove_listener.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/methods/pyromod/stop_listener.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/methods/pyromod/stop_listening.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
2 changes: 1 addition & 1 deletion hydrogram/nav/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2020-present Cezar H. <https://github.com/usernein>
# Copyright (C) 2023-present Amano LLC <https://amanoteam.com>
# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>
#
# This file is part of Hydrogram.
#
Expand Down
Loading
0