perfact-api-app-fastapi 0.6__py2.py3-none-any.whl

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.
File without changes
@@ -0,0 +1,26 @@
1
+ from fastapi import FastAPI
2
+ from perfact.api.app.model.apptblcleanup import AppTblCleanup
3
+ from perfact.api.main.dbsession import APIRouter, DBSession
4
+
5
+ routes = APIRouter()
6
+
7
+
8
+ @routes.api_route("/tablecleanup", methods=["GET", "POST"], tags=["app"])
9
+ async def tablecleanup(session: DBSession) -> dict[str, AppTblCleanup.RunResult]:
10
+ """
11
+ Clean up data according to given rules in apptblcleanup.
12
+ Yields after each processed batch. Returns a mapping from table name to
13
+ number of entries deleted.
14
+ """
15
+
16
+ final_stats = {}
17
+
18
+ for current_stats in AppTblCleanup.run_cleanup_batches(session):
19
+ session.commit()
20
+ final_stats = current_stats
21
+
22
+ return final_stats
23
+
24
+
25
+ def mount(app: FastAPI):
26
+ app.include_router(routes, prefix="/app")
@@ -0,0 +1,51 @@
1
+ Metadata-Version: 2.4
2
+ Name: perfact-api-app-fastapi
3
+ Version: 0.6
4
+ Summary: PerFact API - app FastAPI integration
5
+ Author-email: Viktor Dick <viktor.dick@perfact.de>
6
+ License: GPL-2.0-or-later
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: SQL
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: perfact-api-app
13
+ Requires-Dist: perfact-api-main
14
+
15
+ # perfact-api-app-fastapi
16
+
17
+ FastAPI routes plugin for the `app` namespace of the PerFact API.
18
+
19
+ Registers under the `perfact.assignapi` entry point group and mounts routes at `/app`.
20
+
21
+ ## Installation
22
+
23
+ ```sh
24
+ pip install perfact-api-app-fastapi
25
+ ```
26
+
27
+ ## Development
28
+
29
+ ```sh
30
+ # Install dependencies (editable, from sibling dirs)
31
+ python -m venv .venv && source .venv/bin/activate
32
+ pip install -e ../perfact-api-base-model/
33
+ pip install -e ../perfact-api-main/
34
+ pip install -e ../app/
35
+ pip install -e .
36
+
37
+ # Run all checks
38
+ tox
39
+
40
+ # Individual checks
41
+ ruff format --check src
42
+ ruff check src
43
+ mypy src
44
+ bandit --configfile ../bandit.yml -r src
45
+ ```
46
+
47
+ Entry point changes require re-running `pip install -e .` to regenerate the entry points file in site-packages.
48
+
49
+ ## Maintainers
50
+
51
+ - Viktor Dick <viktor.dick@perfact.de>
@@ -0,0 +1,7 @@
1
+ perfact/api/app_fastapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ perfact/api/app_fastapi/routes.py,sha256=VtTMzz7zQjCRGEcvkBXPV8gCxAZAduz7lqX_zAOf7Uc,764
3
+ perfact_api_app_fastapi-0.6.dist-info/METADATA,sha256=f2KiHG06EhNShOl27D1-GFuloWWLmbmOOPz0HJSPb_s,1246
4
+ perfact_api_app_fastapi-0.6.dist-info/WHEEL,sha256=TdQ5LtNwLuxTCjgxN51AgdU5w-KkB9ttmLbzjTH02pg,109
5
+ perfact_api_app_fastapi-0.6.dist-info/entry_points.txt,sha256=UiFbAScDmFDkMkDto7u8dwvR2QwgZg1dzU3cYRiWmrU,63
6
+ perfact_api_app_fastapi-0.6.dist-info/top_level.txt,sha256=1odO3B1JiDF2Lqgnop8k7K4Xs1y_LdwehM53l1NDOnc,8
7
+ perfact_api_app_fastapi-0.6.dist-info/RECORD,,
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py2-none-any
5
+ Tag: py3-none-any
6
+
@@ -0,0 +1,2 @@
1
+ [perfact.assignapi]
2
+ app = perfact.api.app_fastapi.routes:mount
@@ -0,0 +1 @@
1
+ perfact