Skip to content

Commit c6d7be4

Browse files
committed
Fixed import routers
1 parent d0691ce commit c6d7be4

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to FastOpenAPI are documented in this file.
44

55
FastOpenAPI follows the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.
66

7+
## [0.3.1] - 2025-03-15
8+
9+
### Fixed
10+
- router imports `ModuleNotFoundError`
11+
712
## [0.3.0] - 2025-03-15
813

914
### Added

fastopenapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.0"
1+
__version__ = "0.3.1"

fastopenapi/routers/__init__.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,32 @@
1-
from fastopenapi.routers.falcon import FalconRouter
2-
from fastopenapi.routers.flask import FlaskRouter
3-
from fastopenapi.routers.quart import QuartRouter
4-
from fastopenapi.routers.sanic import SanicRouter
5-
from fastopenapi.routers.starlette import StarletteRouter
1+
class MissingRouter:
2+
def __init__(self, *args, **kwargs):
3+
raise ImportError("This framework is not installed.")
4+
5+
6+
try:
7+
from fastopenapi.routers.falcon import FalconRouter
8+
except ModuleNotFoundError:
9+
FalconRouter = MissingRouter
10+
11+
try:
12+
from fastopenapi.routers.flask import FlaskRouter
13+
except ModuleNotFoundError:
14+
FlaskRouter = MissingRouter
15+
16+
try:
17+
from fastopenapi.routers.quart import QuartRouter
18+
except ModuleNotFoundError:
19+
QuartRouter = MissingRouter
20+
21+
try:
22+
from fastopenapi.routers.sanic import SanicRouter
23+
except ModuleNotFoundError:
24+
SanicRouter = MissingRouter
25+
26+
try:
27+
from fastopenapi.routers.starlette import StarletteRouter
28+
except ModuleNotFoundError:
29+
StarletteRouter = MissingRouter
630

731
__all__ = [
832
"FalconRouter",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "fastopenapi"
3-
version = "0.3.0"
3+
version = "0.3.1"
44
description = "FastOpenAPI is a library for generating and integrating OpenAPI schemas using Pydantic."
55
authors = [
66
{name = "Nikita Ryzhenkov", email = "[email protected]"}

0 commit comments

Comments
 (0)