Skip to content

Commit b8938bc

Browse files
authored
Merge pull request #86 from python-ellar/ellar_074_upgrade
Ellar 0.7.4 Upgrade
2 parents 8366b66 + 029cc68 commit b8938bc

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

ellar_cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Ellar CLI Tool for Scaffolding Ellar Projects, Modules and also running Ellar Commands"""
22

3-
__version__ = "0.4.0"
3+
__version__ = "0.4.1"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dependencies = [
4343
# exclude 0.11.2 and 0.11.3 due to https://github.com/sdispater/tomlkit/issues/225
4444
"tomlkit >=0.11.1,<1.0.0,!=0.11.2,!=0.11.3",
4545
"uvicorn[standard] == 0.29.0",
46-
"ellar >= 0.7.1",
46+
"ellar >= 0.7.4",
4747
"click >= 8.1.7",
4848
]
4949

tests/sample_app/plain_project/plain_project/root_module.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
11
from ellar.app import current_injector
22
from ellar.common import (
33
IExecutionContext,
4+
IModuleSetup,
45
JSONResponse,
56
Module,
67
Response,
78
exception_handler,
89
)
9-
from ellar.core import Config, ModuleBase
10+
from ellar.core import Config, DynamicModule, ModuleBase
1011
from ellar.samples.modules import HomeModule
1112

1213
import ellar_cli.click as click
1314

1415

15-
@click.command()
16-
@click.with_app_context
17-
def plain_project():
18-
"""Project 2 Custom Command"""
19-
assert isinstance(current_injector.get(Config), Config)
20-
print("Plain Project Command works. Executed within application context")
16+
@Module()
17+
class DynamicCommandModule(ModuleBase, IModuleSetup):
18+
@classmethod
19+
def setup(cls) -> "DynamicModule":
20+
@click.command()
21+
@click.with_app_context
22+
def plain_project():
23+
"""Project 2 Custom Command"""
24+
assert isinstance(current_injector.get(Config), Config)
25+
print("Plain Project Command works. Executed within application context")
2126

27+
return DynamicModule(cls, commands=[plain_project])
2228

23-
@Module(modules=[HomeModule], commands=[plain_project])
29+
30+
@Module(modules=[HomeModule, DynamicCommandModule.setup()])
2431
class ApplicationModule(ModuleBase):
2532
@exception_handler(404)
2633
def exception_404_handler(cls, ctx: IExecutionContext, exc: Exception) -> Response:

0 commit comments

Comments
 (0)