fastapi-cbx 1.0.2__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastapi_cbx-1.0.2/fastapi_cbx.egg-info → fastapi_cbx-1.0.3}/PKG-INFO +5 -5
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3}/README.md +3 -3
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3}/cbx.py +2 -1
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3/fastapi_cbx.egg-info}/PKG-INFO +5 -5
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3}/pyproject.toml +2 -2
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3}/LICENSE +0 -0
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3}/fastapi_cbx.egg-info/SOURCES.txt +0 -0
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3}/fastapi_cbx.egg-info/dependency_links.txt +0 -0
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3}/fastapi_cbx.egg-info/requires.txt +0 -0
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3}/fastapi_cbx.egg-info/top_level.txt +0 -0
- {fastapi_cbx-1.0.2 → fastapi_cbx-1.0.3}/setup.cfg +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-cbx
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Minimal class-based routing extension for FastAPI
|
|
5
5
|
Author-email: HeHongye <18348574371@139.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/HeHongyeFY/fastapi-cbx
|
|
7
7
|
Project-URL: Repository, https://github.com/HeHongyeFY/fastapi-cbx
|
|
8
|
-
Requires-Python: >=3.
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
Requires-Dist: fastapi>=0.95.0
|
|
@@ -142,7 +142,7 @@ class MyCBV:
|
|
|
142
142
|
self.heavies = {
|
|
143
143
|
"name": "fastapi-cbx",
|
|
144
144
|
"description": "Minimal class-based routing extension for FastAPI",
|
|
145
|
-
"requires-python": ">=3.
|
|
145
|
+
"requires-python": ">=3.10",
|
|
146
146
|
}
|
|
147
147
|
self.heavies.update(kwargs)
|
|
148
148
|
|
|
@@ -342,8 +342,8 @@ class MyCBR:
|
|
|
342
342
|
4. **No Inheritance Support**
|
|
343
343
|
As a lightweight encapsulation for REST APIs, fastapi-cbx does not consider or support class inheritance scenarios for CBV/CBR. Each route class should be independent and self-contained.
|
|
344
344
|
|
|
345
|
-
5. **Class Initialization Requirement**
|
|
346
|
-
Classes decorated with @cbv(router=APIRouter(prefix='/cbv')) or @cbr(router=APIRouter(prefix="/cbr")) must be initialized before including the router.
|
|
345
|
+
5. **Class Initialization Requirement & Router Ownership**
|
|
346
|
+
Classes decorated with @cbv(router=APIRouter(prefix='/cbv')) or @cbr(router=APIRouter(prefix="/cbr")) must be initialized before including the router. The router passed to the decorator is owned exclusively by that class: do not share it with another `@cbv`/`@cbr` class, and do not register routes on it manually. Each initialization clears the router's routes and rebinds them to the new instance, so any route added to `XXX.router` (even before the first initialization) is silently discarded. If you need additional routes, define them on a separate router and include it into the app.
|
|
347
347
|
|
|
348
348
|
6. **Support & Feedback**
|
|
349
349
|
Feel free to open issues or submit PRs on GitHub. If you find this library useful, please give it a star to support the project.
|
|
@@ -125,7 +125,7 @@ class MyCBV:
|
|
|
125
125
|
self.heavies = {
|
|
126
126
|
"name": "fastapi-cbx",
|
|
127
127
|
"description": "Minimal class-based routing extension for FastAPI",
|
|
128
|
-
"requires-python": ">=3.
|
|
128
|
+
"requires-python": ">=3.10",
|
|
129
129
|
}
|
|
130
130
|
self.heavies.update(kwargs)
|
|
131
131
|
|
|
@@ -325,8 +325,8 @@ class MyCBR:
|
|
|
325
325
|
4. **No Inheritance Support**
|
|
326
326
|
As a lightweight encapsulation for REST APIs, fastapi-cbx does not consider or support class inheritance scenarios for CBV/CBR. Each route class should be independent and self-contained.
|
|
327
327
|
|
|
328
|
-
5. **Class Initialization Requirement**
|
|
329
|
-
Classes decorated with @cbv(router=APIRouter(prefix='/cbv')) or @cbr(router=APIRouter(prefix="/cbr")) must be initialized before including the router.
|
|
328
|
+
5. **Class Initialization Requirement & Router Ownership**
|
|
329
|
+
Classes decorated with @cbv(router=APIRouter(prefix='/cbv')) or @cbr(router=APIRouter(prefix="/cbr")) must be initialized before including the router. The router passed to the decorator is owned exclusively by that class: do not share it with another `@cbv`/`@cbr` class, and do not register routes on it manually. Each initialization clears the router's routes and rebinds them to the new instance, so any route added to `XXX.router` (even before the first initialization) is silently discarded. If you need additional routes, define them on a separate router and include it into the app.
|
|
330
330
|
|
|
331
331
|
6. **Support & Feedback**
|
|
332
332
|
Feel free to open issues or submit PRs on GitHub. If you find this library useful, please give it a star to support the project.
|
|
@@ -18,6 +18,7 @@ class CBV(Generic[T]):
|
|
|
18
18
|
|
|
19
19
|
def __call__(self, *args: Any, **kwargs: Any) -> T:
|
|
20
20
|
self.instance = self.cls(*args, **kwargs)
|
|
21
|
+
self.router.routes.clear()
|
|
21
22
|
for name, status_code in {
|
|
22
23
|
"head": 200,
|
|
23
24
|
"get": 200,
|
|
@@ -57,7 +58,7 @@ class CBR(Generic[T]):
|
|
|
57
58
|
|
|
58
59
|
def __call__(self, *args: Any, **kwargs: Any) -> T:
|
|
59
60
|
self.instance = self.cls(*args, **kwargs)
|
|
60
|
-
|
|
61
|
+
self.router.routes.clear()
|
|
61
62
|
for _name, endpoint in inspect.getmembers(
|
|
62
63
|
self.instance,
|
|
63
64
|
lambda x: inspect.ismethod(x) or inspect.isfunction(x)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-cbx
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Minimal class-based routing extension for FastAPI
|
|
5
5
|
Author-email: HeHongye <18348574371@139.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/HeHongyeFY/fastapi-cbx
|
|
7
7
|
Project-URL: Repository, https://github.com/HeHongyeFY/fastapi-cbx
|
|
8
|
-
Requires-Python: >=3.
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE
|
|
11
11
|
Requires-Dist: fastapi>=0.95.0
|
|
@@ -142,7 +142,7 @@ class MyCBV:
|
|
|
142
142
|
self.heavies = {
|
|
143
143
|
"name": "fastapi-cbx",
|
|
144
144
|
"description": "Minimal class-based routing extension for FastAPI",
|
|
145
|
-
"requires-python": ">=3.
|
|
145
|
+
"requires-python": ">=3.10",
|
|
146
146
|
}
|
|
147
147
|
self.heavies.update(kwargs)
|
|
148
148
|
|
|
@@ -342,8 +342,8 @@ class MyCBR:
|
|
|
342
342
|
4. **No Inheritance Support**
|
|
343
343
|
As a lightweight encapsulation for REST APIs, fastapi-cbx does not consider or support class inheritance scenarios for CBV/CBR. Each route class should be independent and self-contained.
|
|
344
344
|
|
|
345
|
-
5. **Class Initialization Requirement**
|
|
346
|
-
Classes decorated with @cbv(router=APIRouter(prefix='/cbv')) or @cbr(router=APIRouter(prefix="/cbr")) must be initialized before including the router.
|
|
345
|
+
5. **Class Initialization Requirement & Router Ownership**
|
|
346
|
+
Classes decorated with @cbv(router=APIRouter(prefix='/cbv')) or @cbr(router=APIRouter(prefix="/cbr")) must be initialized before including the router. The router passed to the decorator is owned exclusively by that class: do not share it with another `@cbv`/`@cbr` class, and do not register routes on it manually. Each initialization clears the router's routes and rebinds them to the new instance, so any route added to `XXX.router` (even before the first initialization) is silently discarded. If you need additional routes, define them on a separate router and include it into the app.
|
|
347
347
|
|
|
348
348
|
6. **Support & Feedback**
|
|
349
349
|
Feel free to open issues or submit PRs on GitHub. If you find this library useful, please give it a star to support the project.
|
|
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "fastapi-cbx"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.3"
|
|
8
8
|
description = "Minimal class-based routing extension for FastAPI"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
11
|
dependencies = ["fastapi >=0.95.0"]
|
|
12
12
|
authors = [
|
|
13
13
|
{ name = "HeHongye", email = "18348574371@139.com" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|