Skip to content

Commit 03489a4

Browse files
authored
Merge pull request #243 from python-ellar/app_dependencies
Fix: Moved Passlib and click package as an optional dependency
2 parents 7e5c7fd + c9d0e3a commit 03489a4

File tree

6 files changed

+19
-10
lines changed

6 files changed

+19
-10
lines changed

ellar/app/factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import typing as t
22
from pathlib import Path
33

4-
import click
54
from ellar.common import IApplicationReady, Module
65
from ellar.common.constants import MODULE_METADATA
76
from ellar.common.exceptions import ImproperConfiguration
@@ -28,6 +27,7 @@
2827
from .main import App
2928

3029
if t.TYPE_CHECKING: # pragma: no cover
30+
import click
3131
from ellar.common import ModuleRouter
3232
from ellar.core.routing import EllarControllerMount
3333

@@ -185,7 +185,7 @@ def create_app(
185185
global_guards: t.Optional[
186186
t.List[t.Union[t.Type["GuardCanActivate"], "GuardCanActivate"]]
187187
] = None,
188-
commands: t.Sequence[t.Union[click.Command, click.Group, t.Any]] = (),
188+
commands: t.Sequence[t.Union["click.Command", "click.Group", t.Any]] = (),
189189
config_module: t.Union[str, t.Dict, None] = None,
190190
injector: t.Optional[EllarInjector] = None,
191191
) -> App:

ellar/common/decorators/modules.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import uuid
44
from pathlib import Path
55

6-
import click
76
from ellar.common.compatible import AttributeDict
87
from ellar.common.constants import MODULE_METADATA, MODULE_WATERMARK
98
from ellar.common.exceptions import ImproperConfiguration
@@ -15,6 +14,9 @@
1514
from ellar.utils.importer import get_main_directory_by_stack
1615
from starlette.routing import Host, Mount
1716

17+
if t.TYPE_CHECKING:
18+
import click
19+
1820
_ModuleClass = t.TypeVar("_ModuleClass", bound=t.Type)
1921

2022

@@ -60,7 +62,7 @@ def Module(
6062
base_directory: t.Optional[t.Union[Path, str]] = None,
6163
static_folder: str = "static",
6264
modules: t.Sequence[t.Union[t.Type, t.Any]] = (),
63-
commands: t.Sequence[t.Union[click.Command, click.Group, t.Any]] = (),
65+
commands: t.Sequence[t.Union["click.Command", "click.Group", t.Any]] = (),
6466
) -> t.Callable[[_ModuleClass], _ModuleClass]:
6567
"""
6668
========= MODULE DECORATOR ==============

ellar/core/modules/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import typing as t
33
from functools import cached_property
44

5-
import click
65
from ellar.common import ControllerBase, ModuleRouter
76
from ellar.common.constants import MODULE_METADATA, MODULE_WATERMARK
87
from ellar.common.exceptions import ImproperConfiguration
@@ -23,6 +22,7 @@
2322
from .ref import ModuleRefBase, create_module_ref_factor
2423

2524
if t.TYPE_CHECKING: # pragma: no cover
25+
import click
2626
from ellar.common import IModuleSetup
2727

2828

@@ -43,7 +43,7 @@ class DynamicModule:
4343
default_factory=lambda: ()
4444
)
4545

46-
commands: t.Sequence[t.Union[click.Command, click.Group, t.Any]] = (
46+
commands: t.Sequence[t.Union["click.Command", "click.Group", t.Any]] = (
4747
dataclasses.field(default_factory=lambda: ())
4848
)
4949

ellar/core/security/hashers/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
try:
2+
import passlib # noqa
3+
except Exception: # pragma: no cover
4+
raise Exception(
5+
"passlib package is required. Use `pip install passlib >= 1.7.4`."
6+
) from None
7+
18
import typing as t
29

310
from ellar.utils.crypto import get_random_string

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ dependencies = [
4545
"starlette == 0.38.2",
4646
"pydantic >=2.5.1,<3.0.0",
4747
"typing-extensions>=4.8.0",
48-
"jinja2",
49-
"click >= 8.1.7",
50-
"passlib >= 1.7.4",
48+
"jinja2"
5149
]
5250

5351
[project.urls]
@@ -64,7 +62,8 @@ all = [
6462
"ujson >=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0,<6.0.0",
6563
"orjson >=3.2.1,<4.0.0",
6664
"email_validator >=2.0.0",
67-
"httpx >= 0.22.0"
65+
"httpx >= 0.22.0",
66+
"passlib >= 1.7.4",
6867
]
6968

7069
[tool.ruff]

requirements-tests.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ anyio[trio] >= 3.2.1
33
argon2-cffi == 23.1.0
44
autoflake
55
bcrypt; python_version >= '3.12'
6+
click >= 8.1.7,<9.0.0,
67
email_validator >=1.1.1
78
itsdangerous >=1.1.0,<3.0.0
89
mypy == 1.11.2

0 commit comments

Comments
 (0)