Skip to content

Commit

Permalink
fix: modules should be reloaded when update plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Cherng <[email protected]>
  • Loading branch information
jfcherng committed Mar 7, 2022
1 parent 6442ca8 commit 153cff0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

10 changes: 10 additions & 0 deletions boot.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
def plugin_reload() -> None:
import sys

prefix = f"{__package__}."
for module_name in tuple(filter(lambda m: m.startswith(prefix) and m != __name__, sys.modules)):
del sys.modules[module_name]


plugin_reload()

from .plugin import set_up
from .plugin import tear_down
from .plugin.commands import * # noqa: F401, F403
Expand Down
16 changes: 16 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[flake8]
max-line-length = 120
extend-ignore = E203
exclude =
.git,
.mypy_cache,
.venv,
branch-*,
libs,
plugin/libs,
stubs,
tests/files,
typings,
venv,
per-file-ignores =
boot.py: E402

0 comments on commit 153cff0

Please sign in to comment.