Skip to content

Commit 138a4be

Browse files
committed
Release v0.1.19
#### Added - Unified import interface: all core classes and functions can now be imported directly from `api_exception` (e.g. `from api_exception import ResponseModel, APIException`). - Cleaner `__init__.py` exports with `__all__`. #### Changed - Internal imports refactored, simplified folder structure for `enums.py`, `response_model.py`, `rfc7807_model.py`. #### Fixed - Example and README imports updated to use new unified style.
1 parent cf4cabb commit 138a4be

File tree

15 files changed

+62
-40
lines changed

15 files changed

+62
-40
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,22 @@ Benchmark scripts and raw Locust reports are available in the [benchmark](https:
410410

411411
## 📜 Changelog
412412

413-
**v0.1.18 - 2025-08-17**
413+
**v0.1.19 - 2025-08-18**
414+
**Initial stable and suggested version**
415+
416+
417+
#### Added
418+
- Unified import interface: all core classes and functions can now be imported directly from `api_exception` (e.g. `from api_exception import ResponseModel, APIException`).
419+
- Cleaner `__init__.py` exports with `__all__`.
420+
421+
#### Changed
422+
- Internal imports refactored, simplified folder structure for `enums.py`, `response_model.py`, `rfc7807_model.py`.
423+
424+
#### Fixed
425+
- Example and README imports updated to use new unified style.
414426

415-
**Initial stable version**
427+
428+
**v0.1.18 - 2025-08-17**
416429

417430
#### Added
418431
- Global logging control (`set_global_log`) with `log` param in `register_exception_handlers`.

api_exception/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
from fastapi.responses import JSONResponse
66
from starlette.status import HTTP_422_UNPROCESSABLE_ENTITY
77

8-
from schemas.rfc7807_model import RFC7807ResponseModel
8+
from api_exception.rfc7807_model import RFC7807ResponseModel
99
from .logger import logger, add_file_handler
1010
from .exception import APIException, set_default_http_codes, DEFAULT_HTTP_CODES, set_global_log
11-
from custom_enum.enums import ExceptionCode, ExceptionStatus, BaseExceptionCode, ResponseFormat
12-
from schemas.response_model import ResponseModel
11+
from api_exception.enums import ExceptionCode, ExceptionStatus, BaseExceptionCode, ResponseFormat
12+
from api_exception.response_model import ResponseModel
1313
from .response_utils import APIResponse
1414
import traceback
1515

File renamed without changes.

api_exception/exception.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import traceback
33
from typing import Union
44

5-
from schemas.rfc7807_model import RFC7807ResponseModel
5+
from api_exception.rfc7807_model import RFC7807ResponseModel
66
from .logger import logger
7-
from custom_enum.enums import ExceptionCode, ExceptionStatus
8-
from schemas.response_model import ResponseModel
7+
from api_exception.enums import ExceptionCode, ExceptionStatus
8+
from api_exception.response_model import ResponseModel
99

1010
GLOBAL_LOG: bool = True
1111

schemas/response_model.py renamed to api_exception/response_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Generic, TypeVar, Optional
2-
from pydantic import BaseModel, Field, ConfigDict
3-
from custom_enum.enums import ExceptionStatus
2+
from pydantic import BaseModel, Field
3+
from api_exception.enums import ExceptionStatus
44

55
# Generic type for response data
66
DataT = TypeVar('DataT')

api_exception/response_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Dict
2-
from schemas.response_model import ResponseModel
3-
from custom_enum.enums import ExceptionStatus, BaseExceptionCode
4-
from schemas.rfc7807_model import RFC7807ResponseModel
2+
from api_exception.response_model import ResponseModel
3+
from api_exception.enums import ExceptionStatus, BaseExceptionCode
4+
from api_exception.rfc7807_model import RFC7807ResponseModel
55

66

77
class APIResponse:
File renamed without changes.

docs/advanced/logging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ You get two powerful behaviors:
4040
If you want to log your own events (not just exceptions), you can use the built-in logger:
4141

4242
```python
43-
from api_exception.logger import logger
43+
from api_exception import logger
4444
logger.warning("This will be logged to both console and file")
4545
logger.info("This INFO log will also be written to the file"
4646
```
4747
Also you can call add_file_handler to write log to file
4848
```python
49-
from api_exception.logger import add_file_handler,logger
49+
from api_exception import add_file_handler,logger
5050
add_file_handler("api_exception.log", level=logging.DEBUG)
5151
logger.warning("This will be logged to both console and file")
5252
```

docs/advanced/rfc7807.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ RFC 7807 ensures every failure tells the same story — clearly, consistently, a
2323
To enable RFC 7807 response formatting across your application:
2424

2525
```python
26-
from api_exception import register_exception_handlers
27-
from api_exception.enums import ResponseFormat
26+
from api_exception import register_exception_handlers, ResponseFormat
2827
from fastapi import FastAPI
2928

3029
app = FastAPI()
@@ -39,8 +38,8 @@ This will return error responses with the application/problem+json content type,
3938
### 🧪 RFC7807 Usage Example
4039
```python
4140
from api_exception import APIException, APIResponse
42-
from api_exception.enums import ResponseFormat
43-
from api_exception.models import ResponseModel
41+
from api_exception import ResponseFormat
42+
from api_exception import ResponseModel
4443
from fastapi import FastAPI
4544
from .schemas import UserResponse
4645
from .exceptions import CustomExceptionCode

docs/advanced/swagger.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ In **Swagger UI**, your custom error cases will show up clearly alongside your s
6060
The exception messages will be formatted as RFC 7807.
6161

6262
```python
63-
from schemas.response_model import ResponseModel
64-
from api_exception import APIResponse
63+
from api_exception import ResponseModel, APIResponse
64+
6565

6666
@app.get(
6767
"/rfc7807",

0 commit comments

Comments
 (0)