GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Full Support for Bot API 8.0 by Bibo-Joshi · Pull Request #4566 · python-telegram-bot/python-telegram-bot

Conversation

@Bibo-Joshi

@Bibo-Joshi Bibo-Joshi commented Nov 17, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Master PR for all API 8.0 changes.
Closes #4567 when ready

  • PR to metion: Bot API 8.0: Add New Parameters to create_invoice_link #4568, Bot API 8.0: Add New Attributes to SuccessfulPayment #4570, Bot API 8.0: Add Bot.edit_user_star_subscription #4571, Bot API 8.0: PreparedInlineMessage and Bot.save_prepared_inline_message #4574, Bot API 8.0: Gifts #4576, Bot API 8.0: Add Bot.set_user_emoji_status #4572

  • Added .. versionadded:: NEXT.VERSION, .. versionchanged:: NEXT.VERSION, .. deprecated:: NEXT.VERSION or .. versionremoved:: NEXT.VERSION to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)

  • Created new or adapted existing unit tests

  • Documented code changes according to the CSI standard_

  • Added myself alphabetically to AUTHORS.rst (optional)

  • Added new classes & modules to the docs and all suitable __all__ s

  • Checked the Stability Policy in case of deprecations or changes to documented behavior

  • Check the diff files in this channel for documentation updates

If the PR contains API changes (otherwise, you can ignore this passage)

  • Checked the Bot API specific sections of the Stability Policy

  • Created a PR to remove functionality deprecated in the previous Bot API release (see here)

  • New classes:

    • Added self._id_attrs and corresponding documentation
    • __init__ accepts api_kwargs as kw-only
  • Added new shortcuts:

    • In telegram.Chat & telegram.User for all methods that accept chat/user_id
    • In telegram.Message for all methods that accept chat_id and message_id
    • For new telegram.Message shortcuts: Added quote argument if methods accepts reply_to_message_id
    • In telegram.CallbackQuery for all methods that accept either chat_id and message_id or inline_message_id
  • If relevant:

    • Added new constants at telegram.constants and shortcuts to them as class variables

    • Link new and existing constants in docstrings instead of hard-coded numbers and strings

    • Add new message types to telegram.Message.effective_attachment

    • Added new handlers for new update types

      • Add the handlers to the warning loop in the telegram.ext.ConversationHandler
    • Added new filters for new message (sub)types

    • Added or updated documentation for the changed class(es) and/or method(s)

    • Added the new method(s) to _extbot.py

    • Added or updated bot_methods.rst

    • Updated the Bot API version number in all places: README.rst (including the badge) and telegram.constants.BOT_API_VERSION_INFO

    • Added logic for arbitrary callback data in telegram.ext.ExtBot for new methods that either accept a reply_markup in some form or have a return type that is/contains telegram.Message

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Bibo-Joshi
Update Bot API Version Number
8192822
@Bibo-Joshi Bibo-Joshi added ⚙️ bot-api affected functionality: bot-api 🔌 enhancement pr description: enhancement labels Nov 17, 2024
Bibo-Joshi added 3 commits November 28, 2024 19:10
@Bibo-Joshi
Bot API 8.0: Add New Parameters to create_invoice_link (#4568)
ec9f92a
@Bibo-Joshi
Bot API 8.0: Add New Attributes to SuccessfulPayment (#4570)
c6f4529
@Bibo-Joshi
Bot API 8.0: Add Bot.edit_user_star_subscription (#4571)
90c3f08
@codecov

codecov Bot commented Nov 28, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
6135 1 6134 224
View the top 1 failed tests by shortest run time
tests.ext.test_application.TestApplication::test_stop_running[polling]
Stack Traces | 0.522s run time
self = <tests.ext.test_application.TestApplication object at 0x7fd8a93a18b0>
one_time_bot = PytestExtBot[token=696188732:AAGVwEKfHHlNjscxEDNKAwkhGstZ_ko1mC0]
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fd8a4d57310>
method = 'polling'

    @pytest.mark.parametrize("method", ["polling", "webhook"])
    def test_stop_running(self, one_time_bot, monkeypatch, method):
        # asyncio.Event() seems to be hard to use across different threads (awaiting in main
        # thread, setting in another thread), so we use threading.Event() instead.
        # This requires the use of run_in_executor, but that's fine.
        put_update_event = threading.Event()
        callback_done_event = threading.Event()
        called_stop_running = threading.Event()
        assertions = {}
    
        async def post_init(app):
            # Simply calling app.update_queue.put_nowait(method) in the thread_target doesn't work
            # for some reason (probably threading magic), so we use an event from the thread_target
            # to put the update into the queue in the main thread.
            async def task(app):
                await asyncio.get_running_loop().run_in_executor(None, put_update_event.wait)
                await app.update_queue.put(method)
    
            app.create_task(task(app))
    
        app = (
            ApplicationBuilder()
            .application_class(PytestApplication)
            .updater(PytestUpdater(one_time_bot, asyncio.Queue()))
            .post_init(post_init)
            .build()
        )
        monkeypatch.setattr(app.bot, "get_updates", empty_get_updates)
    
        events = []
        monkeypatch.setattr(
            app.updater,
            "stop",
            call_after(app.updater.stop, lambda _: events.append("updater.stop")),
        )
        monkeypatch.setattr(
            app,
            "stop",
            call_after(app.stop, lambda _: events.append("app.stop")),
        )
        monkeypatch.setattr(
            app,
            "shutdown",
            call_after(app.shutdown, lambda _: events.append("app.shutdown")),
        )
        monkeypatch.setattr(app.bot, "set_webhook", return_true)
        monkeypatch.setattr(app.bot, "delete_webhook", return_true)
    
        def thread_target():
            waited = 0
            while not app.running:
                time.sleep(0.05)
                waited += 0.05
                if waited > 5:
                    pytest.fail("App apparently won't start")
    
            time.sleep(0.1)
            assertions["called_stop_running_not_set"] = not called_stop_running.is_set()
    
            put_update_event.set()
            time.sleep(0.1)
    
            assertions["called_stop_running_set"] = called_stop_running.is_set()
    
            # App should have entered `stop` now but not finished it yet because the callback
            # is still running
            assertions["updater.stop_event"] = events == ["updater.stop"]
            assertions["app.running_False"] = not app.running
    
            callback_done_event.set()
            time.sleep(0.1)
    
            # Now that the update is fully handled, we expect the full shutdown
            assertions["events"] = events == ["updater.stop", "app.stop", "app.shutdown"]
    
        async def callback(update, context):
            context.application.stop_running()
            called_stop_running.set()
            await asyncio.get_running_loop().run_in_executor(None, callback_done_event.wait)
    
        app.add_handler(TypeHandler(object, callback))
    
        thread = Thread(target=thread_target)
        thread.start()
    
        if method == "polling":
            app.run_polling(close_loop=False, drop_pending_updates=True)
        else:
            ip = "127.0.0.1"
            port = randrange(1024, 49152)
    
            app.run_webhook(
                ip_address=ip,
                port=port,
                url_path="TOKEN",
                drop_pending_updates=False,
                close_loop=False,
            )
    
        thread.join()
    
        assert len(assertions) == 5
        for key, value in assertions.items():
>           assert value, f"assertion '{key}' failed!"
E           AssertionError: assertion 'updater.stop_event' failed!
E           assert False

tests/ext/test_application.py:2547: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Bibo-Joshi added 6 commits November 28, 2024 19:37
@Bibo-Joshi
Bot API 8.0: PreparedInlineMessage and `Bot.save_prepared_inline_me…
3f83bec
…ssage` (#4574)
@Bibo-Joshi
Bot API 8.0: Gifts (#4576)
e785649
@Bibo-Joshi
Bot API 8.0: Add Bot.set_user_emoji_status (#4572)
59aabc7
@Bibo-Joshi
Address test_official
eacb370
@Bibo-Joshi
Small doc fixes
e0c937d
@Bibo-Joshi
missing versionadded
85ee23c
Bibo-Joshi
Bibo-Joshi commented Nov 28, 2024
View reviewed changes

@Bibo-Joshi Bibo-Joshi left a comment

Copy link
Copy Markdown
Member Author

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.

I've now merged everything in the "master" api-8.0 PR, given it another once-over and compared with the html diff from the channel. LGTM now.
Additional reviews are very welcome! the individual prs should be fine for that, I've only changed a handful of things directly in this PR here

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Bibo-Joshi
Bibo-Joshi merged commit ef1685c into master Dec 1, 2024
@Bibo-Joshi
Bibo-Joshi deleted the api-8.0 branch December 1, 2024 09:26
@s750Bot

This comment was marked as spam.

Sign in to view
@s750Bot

This comment was marked as spam.

Sign in to view
cuevasrja pushed a commit to USB-CI3715/python-telegram-bot that referenced this pull request Dec 9, 2024
@Bibo-Joshi @cuevasrja
Full Support for Bot API 8.0 (python-telegram-bot#4566, python-telegr…
5da7633
…am-bot#4568, python-telegram-bot#4570, python-telegram-bot#4571, python-telegram-bot#4574, python-telegram-bot#4576, python-telegram-bot#4572)
cuevasrja added a commit to USB-CI3715/python-telegram-bot that referenced this pull request Dec 13, 2024
@Jeam-zx @Bibo-Joshi
Snehashish Biswas @Poolitzer @dependabot @nemacysts @cuevasrja
Refactorización de importaciones de datetime para mantener la coheren…
f5233a4
…cia entre módulos (#1)

* Refactor datetime imports to use alias for consistency

* Refactor datetime imports to use alias for consistency across modules

* Refactor datetime imports to use alias for consistency in ChatMemberUpdated, Giveaway, Message, MessageOrigin modules

* Refactor datetime imports to use alias for consistency in ChatJoinRequest and ChatMember modules

* Full Support for Bot API 8.0 (python-telegram-bot#4566, python-telegram-bot#4568, python-telegram-bot#4570, python-telegram-bot#4571, python-telegram-bot#4574, python-telegram-bot#4576, python-telegram-bot#4572)

* Documentation Improvements (python-telegram-bot#4573, python-telegram-bot#4565)

Co-authored-by: Snehashish Biswas <[email protected]>
Co-authored-by: poolitzer <[email protected]>

* Bump Version to v21.8 (python-telegram-bot#4583)

* Bump `srvaroa/labeler` from 1.11.1 to 1.12.0 (python-telegram-bot#4586)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump `pylint` to v3.3.2 to Improve Python 3.13 Support (python-telegram-bot#4590)

* Bump `codecov/codecov-action` from 4 to 5 (python-telegram-bot#4585)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Allow `Sequence` Input for `allowed_updates` in `Application` and `Updater` Methods (python-telegram-bot#4589)

* Full Support for Bot API 8.1 (python-telegram-bot#4594)

* Use `MessageLimit.DEEP_LINK_LENGTH` in `helpers.create_deep_linked_url` (python-telegram-bot#4597)

* Bump `pytest` from 8.3.3 to 8.3.4 (python-telegram-bot#4596)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bibo-Joshi <[email protected]>

* Update `aiolimiter` requirement from ~=1.1.0 to >=1.1,<1.3 (python-telegram-bot#4595)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Bibo-Joshi <[email protected]>

* Bump Version to v21.9 (python-telegram-bot#4601)

* Reorder imports to unify `datetime`  usage across modules

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Bibo-Joshi <[email protected]>
Co-authored-by: Snehashish Biswas <[email protected]>
Co-authored-by: poolitzer <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Luis Pérez <[email protected]>
Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>
Co-authored-by: Juan Andrés Cuevas <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

⚙️ bot-api affected functionality: bot-api 🔌 enhancement pr description: enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bot API 8.0

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Bibo-Joshi @s750Bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.