Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Plugin API #43

Merged
merged 14 commits into from
Apr 12, 2022
Merged

Plugin API #43

merged 14 commits into from
Apr 12, 2022

Conversation

cofob
Copy link
Contributor

@cofob cofob commented Mar 10, 2022

Важный check-list

  • Я написал подробное описание моих изменений.
  • Я написал подробную причину моих изменений.
  • Я точно прочитал и использовал все пункты этого списка.
  • Я записал изменение в CHANGELOG.md и добавил номер PR туда.
  • Я запустил make test и с тех пор ничего не менял.
  • Я кофоб.

@cofob cofob changed the base branch from master to aiohttp March 10, 2022 14:46
@cofob cofob force-pushed the feat/plugin-api branch from bdff44c to d1bfacf Compare March 11, 2022 11:38

Arguments:
app: Application instance
config: Config instance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Точки?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А я не работаю в гугле)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(((((((((((((

"""
self.app = app
self.config = config
self.log = get_logger(self.__class__.__name__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ты же его по файлам разделяешь, не по классам.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В других логгерах я поменял на классы, для читаемости и эстатичности

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По файлам был перебор, а тут... У нас для каждого класса свой файл, зачем еще больше разделять? Хотя... это убирает инициализацию логгера при импорте.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, да, давая всё в __init__.py хуячить!

@PerchunPak PerchunPak added enhancement New feature or request python Pull requests that update Python code labels Mar 21, 2022
@PerchunPak PerchunPak added this to the v0.2.0 milestone Mar 21, 2022
@cofob cofob force-pushed the feat/plugin-api branch from f196007 to 284e18a Compare March 22, 2022 13:02
log.info("Enabling `%s`..." % plugins_path)
plugins_module = import_module(plugins_path)
if "setup" in plugins_module.__dir__():
if plugins_module.__api_version__ != 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO мне: переделать ifы в класс с цепочкой обработчиков (паттерн Цепочка обязанностей)

log = get_logger("PluginManager")


def initialize_all() -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Переделай пожалуйста эту функцию в класс, для более легкого тестирования.

@cofob cofob marked this pull request as ready for review April 12, 2022 07:17
@cofob cofob merged commit f88c2ab into aiohttp Apr 12, 2022
@cofob cofob deleted the feat/plugin-api branch April 12, 2022 07:17
cofob added a commit that referenced this pull request Apr 12, 2022
* aiohttp init

* Add changes to CHANGELOG.md

* Change `import ?` to `from ? import ?`

* Change branch `master` to `aiohttp`

* Fix CI

* Move ifmain block to function (#27)

* Change poetry installation (#26)

* Change poetry installation

* Fix typo in word

* Add script to remove residual trash (#28)

* Port logger from django branch 🚚 (#30)

* Port logger from django branch 🚚

* Add log levels

* Add @PerchunPak suggestions

* Add LOG_SEPARATE and LOG_PATH features

* Sync `pyproject.toml` and `docs/requirments.txt`

This fix `readthedocs` build.

* Remove Python3.11 from CICD (#37)

* Remove Python3.11 from CICD

* Add changes from PR to CHANGELOG.md

* Apply codestyle ✏️ [skip ci]

* Update poetry.lock 📈

* Fix typo in poetry command

* Port Config class from `master` (#38)

* Port Config class from `master`

* Add Singleton to Config class

* Make `furo` auto-updateble

* Update poetry.lock 📈

* Fix Docker container build

* Update poetry.lock 📈

* Fix CI pushing in pull requests

(cherry picked from commit 54b39e2)

* Final fix CI pushing in pull requests

(cherry picked from commit e6ab8df)

* Update poetry.lock 📈

* Plugin API (#43)

* Add base aiohttp sub-apps initialization

* Add mako as templating language

* Fix VSC config for Win

* Type init func

* Update [skip ci]

* DL VSC folder

* DL app view

* Add plugin initialization

* TLTD

* Fix tests

* Private methods can start with one _

* Rename variable `e` to `exception`

* Change `pip freeze` to `pip list`

Because it's more understandable

* Remove necessary checks

Co-authored-by: PerchunPak <perchunpak@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants