diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 998bdc70b..96a97e3be 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -60,21 +62,24 @@ 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 /hydrogram -cd hydrogram``` +```bash +git clone https://github.com//hydrogram +cd hydrogram +``` 4. Add a track to the original repository: -bash``` -git remote add upstream ``` +```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. @@ -82,27 +87,31 @@ rye sync --all-features``` [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. @@ -110,14 +119,13 @@ Remember to write tests for your new features or modify the existing tests to co 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: ``` [optional scope]: @@ -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. diff --git a/cherry-pick-pyro.sh b/cherry-pick-pyro.sh old mode 100755 new mode 100644 diff --git a/docs/source/_static/img/mtproto-vs-bot-api.png b/docs/source/_static/img/mtproto-vs-bot-api.png new file mode 100644 index 000000000..081f92a85 Binary files /dev/null and b/docs/source/_static/img/mtproto-vs-bot-api.png differ diff --git a/docs/source/conf.py b/docs/source/conf.py index 99ad73219..a15a2f52d 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -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", @@ -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": { @@ -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": ( '' @@ -113,9 +89,9 @@ ), "class": "", }, - { # Github logo - "name": "GitHub", - "url": "https://github.com/hydrogram/hydrogram/", + { + "name": "GitHub Organization", + "url": "https://github.com/hydrogram/", "html": ( ' -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/errors/pyromod/listener_stopped.py b/hydrogram/errors/pyromod/listener_stopped.py index a1575fc27..e5ac200db 100644 --- a/hydrogram/errors/pyromod/listener_stopped.py +++ b/hydrogram/errors/pyromod/listener_stopped.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/errors/pyromod/listener_timeout.py b/hydrogram/errors/pyromod/listener_timeout.py index cd945829e..e666376d0 100644 --- a/hydrogram/errors/pyromod/listener_timeout.py +++ b/hydrogram/errors/pyromod/listener_timeout.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/helpers/__init__.py b/hydrogram/helpers/__init__.py index ecd234fe3..cf5959789 100644 --- a/hydrogram/helpers/__init__.py +++ b/hydrogram/helpers/__init__.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/helpers/helpers.py b/hydrogram/helpers/helpers.py index 76a525f41..40c43828b 100644 --- a/hydrogram/helpers/helpers.py +++ b/hydrogram/helpers/helpers.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/__init__.py b/hydrogram/methods/pyromod/__init__.py index a88d70cf4..1db85ac2b 100644 --- a/hydrogram/methods/pyromod/__init__.py +++ b/hydrogram/methods/pyromod/__init__.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/ask.py b/hydrogram/methods/pyromod/ask.py index e3770a817..3d80bba46 100644 --- a/hydrogram/methods/pyromod/ask.py +++ b/hydrogram/methods/pyromod/ask.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/get_listener_matching_with_data.py b/hydrogram/methods/pyromod/get_listener_matching_with_data.py index 9655119e5..606f8ca14 100644 --- a/hydrogram/methods/pyromod/get_listener_matching_with_data.py +++ b/hydrogram/methods/pyromod/get_listener_matching_with_data.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/get_listener_matching_with_identifier_pattern.py b/hydrogram/methods/pyromod/get_listener_matching_with_identifier_pattern.py index 0edc7b160..7a10a6521 100644 --- a/hydrogram/methods/pyromod/get_listener_matching_with_identifier_pattern.py +++ b/hydrogram/methods/pyromod/get_listener_matching_with_identifier_pattern.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/get_many_listeners_matching_with_data.py b/hydrogram/methods/pyromod/get_many_listeners_matching_with_data.py index 7c254fbeb..c6671e479 100644 --- a/hydrogram/methods/pyromod/get_many_listeners_matching_with_data.py +++ b/hydrogram/methods/pyromod/get_many_listeners_matching_with_data.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/get_many_listeners_matching_with_identifier_pattern.py b/hydrogram/methods/pyromod/get_many_listeners_matching_with_identifier_pattern.py index 608004913..20724cf5f 100644 --- a/hydrogram/methods/pyromod/get_many_listeners_matching_with_identifier_pattern.py +++ b/hydrogram/methods/pyromod/get_many_listeners_matching_with_identifier_pattern.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/listen.py b/hydrogram/methods/pyromod/listen.py index 9598307a1..ae347cd5b 100644 --- a/hydrogram/methods/pyromod/listen.py +++ b/hydrogram/methods/pyromod/listen.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/register_next_step_handler.py b/hydrogram/methods/pyromod/register_next_step_handler.py index 251fc40dc..bfb6eb217 100644 --- a/hydrogram/methods/pyromod/register_next_step_handler.py +++ b/hydrogram/methods/pyromod/register_next_step_handler.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/remove_listener.py b/hydrogram/methods/pyromod/remove_listener.py index 97be66361..56bec236b 100644 --- a/hydrogram/methods/pyromod/remove_listener.py +++ b/hydrogram/methods/pyromod/remove_listener.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/stop_listener.py b/hydrogram/methods/pyromod/stop_listener.py index 0b62c96a2..134d55497 100644 --- a/hydrogram/methods/pyromod/stop_listener.py +++ b/hydrogram/methods/pyromod/stop_listener.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/methods/pyromod/stop_listening.py b/hydrogram/methods/pyromod/stop_listening.py index ec814a690..b243bf88e 100644 --- a/hydrogram/methods/pyromod/stop_listening.py +++ b/hydrogram/methods/pyromod/stop_listening.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/nav/__init__.py b/hydrogram/nav/__init__.py index 399aaf674..0e0475dba 100644 --- a/hydrogram/nav/__init__.py +++ b/hydrogram/nav/__init__.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/nav/pagination.py b/hydrogram/nav/pagination.py index a3091ba0b..d31e51b3a 100644 --- a/hydrogram/nav/pagination.py +++ b/hydrogram/nav/pagination.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/types/pyromod/__init__.py b/hydrogram/types/pyromod/__init__.py index f3dbffdf5..15d189471 100644 --- a/hydrogram/types/pyromod/__init__.py +++ b/hydrogram/types/pyromod/__init__.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/types/pyromod/identifier.py b/hydrogram/types/pyromod/identifier.py index 6f82994c9..40ea6b81e 100644 --- a/hydrogram/types/pyromod/identifier.py +++ b/hydrogram/types/pyromod/identifier.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/types/pyromod/listener.py b/hydrogram/types/pyromod/listener.py index 9553cd162..d3c7221e5 100644 --- a/hydrogram/types/pyromod/listener.py +++ b/hydrogram/types/pyromod/listener.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/hydrogram/types/pyromod/listener_types.py b/hydrogram/types/pyromod/listener_types.py index 77b759544..3d6dcfa4b 100644 --- a/hydrogram/types/pyromod/listener_types.py +++ b/hydrogram/types/pyromod/listener_types.py @@ -1,6 +1,6 @@ # Hydrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2020-present Cezar H. -# Copyright (C) 2023-present Amano LLC +# Copyright (C) 2023-present Hydrogram # # This file is part of Hydrogram. # diff --git a/news/11.feature.rst b/news/11.feature.rst index 61242f8c6..39063e768 100644 --- a/news/11.feature.rst +++ b/news/11.feature.rst @@ -1 +1 @@ -Added the attribute `is_participants_hidden`` to the `Chat` type. If the list of members is hidden, `True` will be returned; otherwise, `False` will be returned. +Added the attribute `is_participants_hidden` to the `Chat` type. If the list of members is hidden, `True` will be returned; otherwise, `False` will be returned. diff --git a/news/15.fix.rst b/news/15.bugfix.rst similarity index 100% rename from news/15.fix.rst rename to news/15.bugfix.rst diff --git a/pyproject.toml b/pyproject.toml index 1ca955e49..b8161f1cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,11 +60,11 @@ dev-dependencies = [ [project.optional-dependencies] docs = [ - "Sphinx>=7.2.6", - "furo>=2023.9.10", - "sphinx-autobuild>=2021.3.14", + "Sphinx>=7.3.7", + "furo>=2024.5.6", + "sphinx-autobuild>=2024.4.16", "sphinx-copybutton>=0.5.2", - "pygments>=2.17.2", + "pygments>=2.18.0", "towncrier>=23.11.0", "sphinxcontrib-towncrier>=0.4.0a0", ]