Skip to content

Commit 905f36b

Browse files
authored
Merge branch 'master' into dependabot/pip/mypy-1.4.1
2 parents f4c1e07 + 9c4624c commit 905f36b

File tree

10 files changed

+45
-27
lines changed

10 files changed

+45
-27
lines changed

.github/workflows/test_full.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ jobs:
4242
run: flit install --symlink
4343
- name: Black
4444
run: black --check ellar_django tests
45-
- name: isort
46-
run: isort --check ellar_django tests
47-
- name: Flake8
48-
run: flake8 ellar_django tests
45+
- name: Ruff Linting Check
46+
run: ruff check ellar_django tests
4947
- name: mypy
5048
run: mypy ellar_django

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ install-full: ## Install dependencies
1919

2020
lint: ## Run code linters
2121
black --check ellar_django tests
22-
isort --check ellar_django tests
23-
autoflake --remove-unused-variables --remove-unused-variables -r ellar_django tests
24-
flake8 ellar_django tests
22+
ruff check ellar_django tests
2523
mypy ellar_django
2624

2725
fmt format: ## Run code formatters
2826
black ellar_django tests
29-
isort ellar_django tests
27+
ruff check --fix ellar_django tests
3028

3129
test: ## Run tests
3230
pytest tests

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<p align="center">
22
<a href="#" target="blank"><img src="https://eadwincode.github.io/ellar/img/EllarLogoB.png" width="200" alt="Ellar Logo" /></a>
33
</p>
4-
5-
A simple way to use Django ORM with Ellar
4+
<p align="center">Ellar - Python ASGI web framework for building fast, efficient and scalable RESTful APIs and server-side application.</p>
65

76
![Test](https://github.com/eadwinCode/ellar-django-module/actions/workflows/test_full.yml/badge.svg)
87
![Coverage](https://img.shields.io/codecov/c/github/eadwinCode/ellar-django-module)
98
[![PyPI version](https://badge.fury.io/py/ellar-django-module.svg)](https://badge.fury.io/py/ellar-django-module)
109
[![PyPI version](https://img.shields.io/pypi/v/ellar-django-module.svg)](https://pypi.python.org/pypi/ellar-django-module)
1110
[![PyPI version](https://img.shields.io/pypi/pyversions/ellar-django-module.svg)](https://pypi.python.org/pypi/ellar-django-module)
1211

12+
## Introduction
13+
A simple way to add use Django ORM with Ellar
14+
1315
## Installation
1416
```shell
1517
pip install ellar-django-module

ellar_django/commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
@command(
1616
name="django",
17-
context_settings=dict(ignore_unknown_options=True, allow_extra_args=True),
17+
context_settings={"ignore_unknown_options": True, "allow_extra_args": True},
1818
help=HELP_MESSAGE,
1919
)
2020
def django_command_wrapper() -> None:

ellar_django/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ def setup(cls, settings_module: str, path_prefix: str = "/dj") -> "DynamicModule
2727
mount = Mount(
2828
path_prefix, routes=[_router, Mount("/", app=get_asgi_application())]
2929
)
30-
return DynamicModule(cls, routers=[mount], commands=[django_command_wrapper]) # type: ignore
30+
return DynamicModule(cls, routers=[mount], commands=[django_command_wrapper])

mypy.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[mypy]
2-
python_version = 3.6
2+
python_version = 3.8
33

44
show_column_numbers = True
55

pyproject.toml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ authors = [
1212
{name = "Ezeudoh Tochukwu", email = "[email protected]"},
1313
]
1414
dynamic = ["version", "description"]
15-
requires-python = ">=3.7"
15+
requires-python = ">=3.8"
1616
readme = "README.md"
1717
home-page = "https://github.com/eadwinCode/ellar-django-module"
1818
classifiers = [
@@ -63,12 +63,32 @@ test = [
6363
"pytest-django",
6464
"pytest-cov >= 2.12.0,<5.0.0",
6565
"mypy == 1.4.1",
66-
"flake8 >= 3.8.3,<7.0.0",
66+
"ruff ==0.0.275",
6767
"black == 22.8.0",
68-
"isort >= 5.0.6,<6.0.0",
6968
"pytest-asyncio",
7069
"autoflake",
7170
]
7271
dev = [
7372
"pre-commit"
7473
]
74+
75+
[tool.ruff]
76+
select = [
77+
"E", # pycodestyle errors
78+
"W", # pycodestyle warnings
79+
"F", # pyflakes
80+
"I", # isort
81+
"C", # flake8-comprehensions
82+
"B", # flake8-bugbear
83+
]
84+
ignore = [
85+
"E501", # line too long, handled by black
86+
"B008", # do not perform function calls in argument defaults
87+
"C901", # too complex
88+
]
89+
90+
[tool.ruff.per-file-ignores]
91+
"__init__.py" = ["F401"]
92+
93+
[tool.ruff.isort]
94+
known-third-party = ["ellar", "Django"]

tests/example_app/root_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class ApplicationModule(ModuleBase):
2424
@exception_handler(404)
2525
def exception_404_handler(cls, ctx: IExecutionContext, exc: Exception) -> Response:
26-
return JSONResponse(dict(detail="Resource not found."))
26+
return JSONResponse({"detail": "Resource not found."})
2727

2828
def register_services(self, container: Container) -> None:
2929
from .services.event_repository import EventRepository

tests/example_app/services/event_repository.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
@injectable
1111
class EventRepository(IEventRepository):
12-
_dummy_data = dict(
13-
title="TestEvent1Title",
14-
start_date=str(datetime.now().date()),
15-
end_date=str((datetime.now() + timedelta(days=5)).date()),
16-
)
12+
_dummy_data = {
13+
"title": "TestEvent1Title",
14+
"start_date": str(datetime.now().date()),
15+
"end_date": str((datetime.now() + timedelta(days=5)).date()),
16+
}
1717

1818
def create_dummy_events(self):
1919
for i in range(3):

tests/test_event_controller.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ class TestEventController:
1111
def test_create_event_works(self, client):
1212
response = client.post(
1313
"/event/",
14-
json=dict(
15-
title="TestEvent1Title",
16-
start_date=str(datetime.now().date()),
17-
end_date=str((datetime.now() + timedelta(days=5)).date()),
18-
),
14+
json={
15+
"title": "TestEvent1Title",
16+
"start_date": str(datetime.now().date()),
17+
"end_date": str((datetime.now() + timedelta(days=5)).date()),
18+
},
1919
)
2020
assert response.status_code == 201
2121
data = response.json()

0 commit comments

Comments
 (0)