Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: make silverback --help faster #162

Merged
merged 4 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[flake8]
max-line-length = 100
ignore = E704,W503,PYD002
exclude =
venv*
.eggs
Expand Down
24 changes: 21 additions & 3 deletions silverback/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
from .exceptions import CircuitBreaker, SilverbackException
from .main import SilverbackBot
from .state import StateSnapshot
def __getattr__(name: str):
if name == "CircuitBreaker":
Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't look like you are, but one thing to be aware of is autodoc won'tt work for lazy modules like this.
However, it isn't that hard to just add in the docs manually. Example: https://github.com/ApeWorX/ape/blob/main/docs/methoddocs/ape.md

from .exceptions import CircuitBreaker

return CircuitBreaker

elif name == "SilverbackException":
from .exceptions import SilverbackException

return SilverbackException

elif name == "SilverbackBot":
from .main import SilverbackBot

return SilverbackBot

elif name == "StateSnapshot":
from .state import StateSnapshot

return StateSnapshot


__all__ = [
"StateSnapshot",
Expand Down
Loading
Loading