Skip to content

Commit 9185184

Browse files
fix: update remaining imports and linter configs for DDD structure
1 parent 0c00a02 commit 9185184

File tree

12 files changed

+1842
-30
lines changed

12 files changed

+1842
-30
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ venv
66
*.env
77
*.cache
88
*.egg
9-
.angela
109

1110
__pycache__/
1211
*.py[cod]

backend/app/config.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,28 @@
4141
)
4242

4343

44+
__all__ = [
45+
"API_PREFIX",
46+
"API_VERSION",
47+
"DEVICE_ID_MAX_LENGTH",
48+
"DEVICE_NAME_MAX_LENGTH",
49+
"EMAIL_MAX_LENGTH",
50+
"FULL_NAME_MAX_LENGTH",
51+
"IP_ADDRESS_MAX_LENGTH",
52+
"PASSWORD_HASH_MAX_LENGTH",
53+
"PASSWORD_MAX_LENGTH",
54+
"PASSWORD_MIN_LENGTH",
55+
"TOKEN_HASH_LENGTH",
56+
"Environment",
57+
"HealthStatus",
58+
"SafeEnum",
59+
"Settings",
60+
"TokenType",
61+
"UserRole",
62+
"get_settings",
63+
"settings",
64+
]
65+
4466
_PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent
4567
_ENV_FILE = _PROJECT_ROOT / ".env"
4668

backend/app/core/base_repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
ⒸAngelaMos | 2025
3-
base.py
3+
base_repository.py
44
"""
55

66
from collections.abc import Sequence
@@ -14,7 +14,7 @@
1414
from sqlalchemy import func, select
1515
from sqlalchemy.ext.asyncio import AsyncSession
1616

17-
from models.Base import Base
17+
from .Base import Base
1818

1919

2020
ModelT = TypeVar("ModelT", bound = Base)

backend/app/core/common_schemas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
22
ⒸAngelaMos | 2025
3-
common.py
3+
common_schemas.py
44
"""
55

66
from config import HealthStatus
7-
from schemas.base import BaseSchema
7+
from .base_schema import BaseSchema
88

99

1010
class HealthResponse(BaseSchema):

backend/app/core/dependencies.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
TokenType,
1919
UserRole,
2020
)
21-
from core.database import get_db_session
22-
from core.exceptions import (
21+
from .database import get_db_session
22+
from .exceptions import (
2323
InactiveUser,
2424
PermissionDenied,
2525
TokenError,
2626
TokenRevokedError,
2727
UserNotFound,
2828
)
29-
from models.User import User
30-
from core.security import decode_access_token
31-
from repositories.user import UserRepository
29+
from user.User import User
30+
from .security import decode_access_token
31+
from user.repository import UserRepository
3232

3333

3434
oauth2_scheme = OAuth2PasswordBearer(

backend/app/core/error_schemas.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
errors.py
44
"""
55

6-
from pydantic import Field
7-
from schemas.base import BaseSchema
6+
from typing import ClassVar
7+
from pydantic import Field, ConfigDict
8+
from core.base_schema import BaseSchema
89

910

1011
class ErrorDetail(BaseSchema):
@@ -14,13 +15,13 @@ class ErrorDetail(BaseSchema):
1415
detail: str = Field(..., description = "Human readable error message")
1516
type: str = Field(..., description = "Exception class name")
1617

17-
model_config = {
18-
"json_schema_extra": {
18+
model_config: ClassVar[ConfigDict] = ConfigDict(
19+
json_schema_extra = {
1920
"examples": [
2021
{
2122
"detail": "User with id '123' not found",
2223
"type": "UserNotFound"
2324
}
2425
]
2526
}
26-
}
27+
)

backend/app/core/health_routes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
ⒸAngelaMos | 2025
3-
health.py
3+
health_routes.py
44
"""
55

66
from fastapi import (
@@ -14,11 +14,11 @@
1414
settings,
1515
HealthStatus,
1616
)
17-
from schemas.common import (
17+
from .common_schemas import (
1818
HealthResponse,
1919
HealthDetailedResponse,
2020
)
21-
from core.database import sessionmanager
21+
from .database import sessionmanager
2222

2323

2424
router = APIRouter(tags = ["health"])

backend/app/core/responses.py

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

66
from typing import Any
77

8-
from schemas.errors import ErrorDetail
8+
from .error_schemas import ErrorDetail
99

1010

1111
AUTH_401: dict[int | str,

backend/app/middleware/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
__init__.py
44
"""
55

6-
from middleware.correlation import CorrelationIdMiddleware
6+
from .correlation import CorrelationIdMiddleware
77

88

99
__all__ = [

backend/pyproject.toml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ requires = ["hatchling"]
5151
build-backend = "hatchling.build"
5252

5353
[tool.hatch.build.targets.wheel]
54-
packages = ["src"]
54+
packages = ["app"]
5555

5656
[tool.ruff]
5757
target-version = "py312"
5858
line-length = 88
59-
src = ["src"]
59+
src = ["app"]
6060
exclude = ["alembic"]
6161

6262
[tool.ruff.lint]
@@ -92,9 +92,10 @@ ignore = [
9292
[tool.ruff.lint.per-file-ignores]
9393
"tests/**/*.py" = ["S101", "ARG001"]
9494
"conftest.py" = ["S107"]
95-
"src/core/rate_limit.py" = ["S110"]
96-
"src/config.py" = ["F401"]
97-
"src/schemas/**/*.py" = ["RUF012"]
95+
"app/core/rate_limit.py" = ["S110"]
96+
"app/config.py" = ["F401"]
97+
"app/**/schemas.py" = ["RUF012"]
98+
"app/core/error_schemas.py" = ["RUF012"]
9899

99100
[tool.mypy]
100101
python_version = "3.12"
@@ -111,7 +112,7 @@ module = ["tests.*", "conftest"]
111112
ignore_errors = true
112113

113114
[[tool.mypy.overrides]]
114-
module = ["src.core.logging"]
115+
module = ["core.logging"]
115116
disable_error_code = ["no-any-return"]
116117

117118
[[tool.mypy.overrides]]
@@ -126,21 +127,29 @@ module = [
126127
ignore_missing_imports = true
127128

128129
[[tool.mypy.overrides]]
129-
module = ["src.config"]
130+
module = ["config"]
130131
implicit_reexport = true
131132

132133
[[tool.mypy.overrides]]
133-
module = ["src.core.enums", "src.core.security"]
134+
module = ["core.enums", "core.security"]
134135
disable_error_code = ["return-value", "no-any-return"]
135136

136137
[[tool.mypy.overrides]]
137-
module = ["src.repositories.*"]
138+
module = ["user.repository", "auth.repository", "core.base_repository"]
138139
disable_error_code = ["return-value", "no-any-return", "attr-defined"]
139140

140141
[[tool.mypy.overrides]]
141-
module = ["src.factory"]
142+
module = ["user.service", "auth.service"]
143+
disable_error_code = ["no-any-return"]
144+
145+
[[tool.mypy.overrides]]
146+
module = ["factory"]
142147
disable_error_code = ["arg-type"]
143148

149+
[[tool.mypy.overrides]]
150+
module = ["auth.routes"]
151+
disable_error_code = ["misc"]
152+
144153
[tool.pydantic-mypy]
145154
init_forbid_extra = true
146155
init_typed = true
@@ -187,7 +196,9 @@ disable = [
187196
"C0304", # final-newline-missing
188197
"C0305", # trailing-newlines
189198
"C0411", # wrong-import-order
199+
"C0412", # ungrouped-imports (style preference)
190200
"E0401", # import-error (uuid6/structlog/pwdlib not found by pylint)
201+
"E0611", # no-name-in-module (false positive for config re-exports)
191202
"E1102", # not-callable (false positive for SQLAlchemy func.now/count)
192203
"E1136", # unsubscriptable-object (false positive for generics)
193204
"R0801", # similar-lines

0 commit comments

Comments
 (0)