Skip to content

Suggest to loosen the dependency on aiogram #3

@Agnes-U

Description

@Agnes-U

Hi, your project cocksizebot requires "aiogram==2.19" in its dependency. After analyzing the source code, we found that some other versions of aiogram can also be suitable without affecting your project, i.e., aiogram 2.18. Therefore, we suggest to loosen the dependency on aiogram from "aiogram==2.19" to "aiogram>=2.18,<=2.19" to avoid any possible conflict for importing more packages or for downstream projects that may use cocksizebot.

May I pull a request to loosen the dependency on aiogram?

By the way, could you please tell us whether such dependency analysis may be potentially helpful for maintaining dependencies easier during your development?



For your reference, here are details in our analysis.

Your project cocksizebot(commit id: 90ea7fa) directly uses 11 APIs from package aiogram.

aiogram.types.input_message_content.InputMessageContent.__init__, aiogram.bot.bot.Bot.__init__, aiogram.types.input_message_content.InputTextMessageContent.__init__, aiogram.types.bot_command.BotCommand.__init__, aiogram.types.message.Message.__init__, aiogram.dispatcher.dispatcher.Dispatcher.__init__, aiogram.types.inline_query_result.InlineQueryResultArticle.__init__, aiogram.types.inline_query.InlineQuery.__init__, aiogram.dispatcher.dispatcher.Dispatcher.__init__, aiogram.contrib.fsm_storage.memory.MemoryStorage.__init__, aiogram.utils.executor.start_polling

From which, 29 functions are then indirectly called, including 21 aiogram's internal APIs and 8 outsider APIs, as follows (neglecting some repeated function occurrences).

[/Bitnik212/cocksizebot]
+--aiogram.types.input_message_content.InputMessageContent.__init__
+--aiogram.bot.bot.Bot.__init__
|      +--aiogram.bot.base.BaseBot.__init__
|      |      +--aiogram.bot.api.check_token
|      |      |      +--aiogram.utils.exceptions.ValidationError.__init__
|      |      |      |      +--aiogram.utils.exceptions.TelegramAPIError.__init__
|      |      |      |      |      +--aiogram.utils.exceptions._clean_message
|      |      +--ssl.create_default_context
|      |      +--certifi.where
|      |      +--aiohttp_socks.utils.parse_proxy_url
+--aiogram.types.input_message_content.InputTextMessageContent.__init__
|      +--aiogram.types.input_message_content.InputTextMessageContent.safe_get_parse_mode
|      +--aiogram.types.input_message_content.InputTextMessageContent.safe_get_disable_web_page_preview
+--aiogram.types.bot_command.BotCommand.__init__
+--aiogram.types.message.Message.__init__
+--aiogram.dispatcher.dispatcher.Dispatcher.__init__
|      +--aiogram.dispatcher.storage.DisabledStorage.__init__
|      +--aiogram.dispatcher.filters.factory.FiltersFactory.__init__
|      +--aiogram.dispatcher.handler.Handler.__init__
|      +--aiogram.dispatcher.middlewares.MiddlewareManager.__init__
|      +--aiogram.dispatcher.handler.Handler.register
|      |      +--aiogram.dispatcher.handler._get_spec
|      |      |      +--inspect.getfullargspec
|      |      +--aiogram.dispatcher.filters.filters.get_filters_spec
|      |      |      +--aiogram.dispatcher.filters.filters.get_filter_spec
|      |      |      |      +--inspect.getfullargspec
|      |      |      |      +--inspect.isawaitable
|      |      |      |      +--inspect.iscoroutinefunction
|      |      |      |      +--aiogram.dispatcher.handler.FilterObj.__init__
|      |      +--aiogram.dispatcher.handler.Handler.HandlerObj.__init__
|      +--aiogram.dispatcher.dispatcher.Dispatcher._setup_filters
+--aiogram.types.inline_query_result.InlineQueryResultArticle.__init__
|      +--aiogram.types.inline_query_result.InlineQueryResult.__init__
|      |      +--aiogram.types.inline_query_result.InlineQueryResult.safe_get_parse_mode
+--aiogram.types.inline_query.InlineQuery.__init__
+--aiogram.contrib.fsm_storage.memory.MemoryStorage.__init__
+--aiogram.utils.executor.start_polling
|      +--aiogram.utils.executor.Executor.__init__
|      |      +--secrets.token_urlsafe
|      |      +--aiogram.utils.mixins.ContextInstanceMixin.set_current
|      +--aiogram.utils.executor._setup_callbacks
|      +--aiogram.utils.executor.Executor.start_polling
|      |      +--aiogram.utils.executor.Executor._prepare_polling
|      |      |      +--aiogram.utils.executor.Executor._check_frozen
|      |      +--asyncio.get_event_loop

We scan aiogram's versions among [2.18] and 2.19, the changing functions (diffs being listed below) have none intersection with any function or API we mentioned above (either directly or indirectly called by this project).

diff: 2.19(original) 2.18
['aiogram.dispatcher.dispatcher.Dispatcher.register_poll_answer_handler', 'aiogram.types.sticker_set.StickerSet', 'aiogram.types.chat_join_request.ChatJoinRequest', 'aiogram.dispatcher.dispatcher.Dispatcher.register_poll_handler', 'aiogram.bot.bot.Bot', 'aiogram.dispatcher.dispatcher.Dispatcher', 'aiogram.types.sticker.Sticker', 'aiogram.bot.api.Methods']

As for other packages, the APIs of @outside_package_name are called by aiogram in the call graph and the dependencies on these packages also stay the same in our suggested versions, thus avoiding any outside conflict.

Therefore, we believe that it is quite safe to loose your dependency on aiogram from "aiogram==2.19" to "aiogram>=2.18,<=2.19". This will improve the applicability of cocksizebot and reduce the possibility of any further dependency conflict with other projects/packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions