Skip to content

Commit 3bc1a77

Browse files
committed
rearrangement lib dependencies
1 parent 9fc91b2 commit 3bc1a77

File tree

15 files changed

+40
-58
lines changed

15 files changed

+40
-58
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install Flit
1818
run: pip install flit
1919
- name: Install Dependencies
20-
run: flit install --symlink
20+
run: make install
2121
- name: Install build dependencies
2222
run: pip install build
2323
- name: Build distribution

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install Flit
1919
run: pip install flit
2020
- name: Install Dependencies
21-
run: flit install --symlink
21+
run: make install
2222
- name: Test
2323
run: make test-cov
2424
- name: Coverage

.github/workflows/test_full.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install Flit
3434
run: pip install flit
3535
- name: Install Dependencies
36-
run: flit install --symlink
36+
run: make install
3737
- name: Test
3838
run: pytest tests
3939

@@ -48,9 +48,7 @@ jobs:
4848
- name: Install Flit
4949
run: pip install flit
5050
- name: Install Dependencies
51-
run: flit install --symlink
52-
- name: Black
53-
run: black --check ellar_django tests
51+
run: make install
5452
- name: Ruff Linting Check
5553
run: ruff check ellar_django tests
5654
- name: mypy

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ clean: ## Removing cached python compiled files
1111
find . -name __pycache__ | xargs rm -rfv
1212

1313
install: ## Install dependencies
14-
flit install --deps develop --symlink
14+
pip install -r requirements.txt
15+
flit install --symlink
1516

1617
install-full: ## Install dependencies
1718
make install
1819
pre-commit install -f
1920

2021
lint: ## Run code linters
21-
black --check ellar_django tests
2222
ruff check ellar_django tests
2323
mypy ellar_django
2424

2525
fmt format: ## Run code formatters
26-
black ellar_django tests
26+
ruff format ellar_django tests
2727
ruff check --fix ellar_django tests
2828

2929
test: ## Run tests

ellar_django/commands.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import sys
22

3-
from ellar.common.commands import command
3+
import click
44

55
HELP_MESSAGE = """
66
Ellar will always intercept and command with '--help'.
77
88
So if you want to get help on any django command,
99
simply wrap the command and --help in quotes
1010
11-
For example: ellar django 'migrate --help'
11+
For example: ellar django 'migrate --help' or python manage.py django 'migrate --help'
1212
"""
1313

1414

15-
@command(
15+
@click.command(
1616
name="django",
1717
context_settings={"ignore_unknown_options": True, "allow_extra_args": True},
1818
help=HELP_MESSAGE,
@@ -21,6 +21,11 @@ def django_command_wrapper() -> None:
2121
from django.core.management import execute_from_command_line
2222

2323
args = []
24-
for item in sys.argv[1:]:
24+
skip = 1
25+
26+
if "manage.py" in sys.argv:
27+
skip = 2
28+
29+
for item in sys.argv[skip:]:
2530
args.extend(item.split(" "))
2631
execute_from_command_line(args)

ellar_django/module.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
from django.core.asgi import get_asgi_application
44
from ellar.common import IModuleSetup, Module, ModuleRouter
5-
from ellar.common.routing import Mount
65
from ellar.core import DynamicModule, Request
7-
from ellar.core.routing import ModuleRouterFactory
6+
from ellar.core.router_builders import ModuleRouterBuilder
87
from starlette.responses import RedirectResponse
8+
from starlette.routing import Mount
99

1010
from .commands import django_command_wrapper
1111

@@ -22,9 +22,13 @@ class DjangoModule(IModuleSetup):
2222
@classmethod
2323
def setup(cls, settings_module: str, path_prefix: str = "/dj") -> "DynamicModule":
2424
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_module)
25-
ModuleRouterFactory.build(_router)
25+
ModuleRouterBuilder.build(_router)
2626

2727
mount = Mount(
28-
path_prefix, routes=[_router, Mount("/", app=get_asgi_application())]
28+
path_prefix,
29+
routes=[
30+
_router, # type:ignore[list-item]
31+
Mount("/", app=get_asgi_application()),
32+
],
2933
)
3034
return DynamicModule(cls, routers=[mount])

pyproject.toml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ classifiers = [
4747
]
4848

4949
dependencies = [
50-
"ellar-cli >= 0.2.0",
51-
"Django >= 3.0",
50+
"ellar-cli >= 0.3.7",
51+
"Django >= 3.1",
5252
]
5353

5454

@@ -57,21 +57,6 @@ Documentation = "https://github.com/python-ellar/ellar-django-module"
5757
Source = "https://github.com/python-ellar/ellar-django-module"
5858
Homepage = "https://python-ellar.github.io/ellar-django-module/"
5959

60-
[project.optional-dependencies]
61-
test = [
62-
"pytest >= 7.1.3,<8.0.0",
63-
"pytest-django",
64-
"pytest-cov >= 2.12.0,<5.0.0",
65-
"mypy == 1.7.1",
66-
"ruff ==0.1.7",
67-
"black == 23.11.0",
68-
"pytest-asyncio",
69-
"autoflake",
70-
]
71-
dev = [
72-
"pre-commit"
73-
]
74-
7560
[tool.ruff]
7661
select = [
7762
"E", # pycodestyle errors

requirements-tests.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
autoflake
2+
mypy == 1.8.0
3+
pytest >=7.1.3,<9.0.0
4+
pytest-asyncio
5+
pytest-cov >=2.12.0,<5.0.0
6+
ruff ==0.3.0

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-e .
2+
-r requirements-tests.txt
3+
4+
pre-commit >=2.17.0,<4.0.0

tests/example_app/apps/event/controllers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class MyController(ControllerBase):
88
def index(self):
99
return {'detail': "Welcome Dog's Resources"}
1010
"""
11+
1112
import typing as t
1213

1314
from ellar.common import Controller, ControllerBase, get, post

0 commit comments

Comments
 (0)