fastapi-basic 0.0.0__tar.gz → 0.0.99999__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.
Potentially problematic release.
This version of fastapi-basic might be problematic. Click here for more details.
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/PKG-INFO +10 -2
- fastapi_basic-0.0.99999/README.md +12 -0
- fastapi_basic-0.0.99999/fastapi_basic/base_factory.py +29 -0
- fastapi_basic-0.0.99999/fastapi_basic/utils.py +8 -0
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/fastapi_basic.egg-info/PKG-INFO +10 -2
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/fastapi_basic.egg-info/SOURCES.txt +1 -0
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/setup.py +1 -1
- fastapi_basic-0.0.0/README.md +0 -4
- fastapi_basic-0.0.0/fastapi_basic/base_factory.py +0 -18
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/fastapi_basic/__init__.py +0 -0
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/fastapi_basic/base_config.py +0 -0
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/fastapi_basic.egg-info/dependency_links.txt +0 -0
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/fastapi_basic.egg-info/requires.txt +0 -0
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/fastapi_basic.egg-info/top_level.txt +0 -0
- {fastapi_basic-0.0.0 → fastapi_basic-0.0.99999}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: fastapi_basic
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.99999
|
|
4
4
|
Summary: A short description of your module
|
|
5
5
|
Home-page: https://github.com/szx21023/fastapi-base
|
|
6
6
|
Author: szx21023
|
|
@@ -22,6 +22,14 @@ Dynamic: requires-python
|
|
|
22
22
|
Dynamic: summary
|
|
23
23
|
|
|
24
24
|
# fastapi-base
|
|
25
|
-
|
|
25
|
+
how to release module
|
|
26
|
+
1. install relational modules
|
|
27
|
+
```
|
|
28
|
+
pip install setuptools wheel twine
|
|
29
|
+
```
|
|
30
|
+
2. modify setup.py(optional)
|
|
31
|
+
3. build env && upload to pypi
|
|
32
|
+
```
|
|
26
33
|
python setup.py sdist bdist_wheel
|
|
27
34
|
twine upload dist/*
|
|
35
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from abc import ABCMeta, abstractmethod
|
|
2
|
+
from functools import lru_cache
|
|
3
|
+
import os, dotenv
|
|
4
|
+
|
|
5
|
+
from fastapi import FastAPI
|
|
6
|
+
|
|
7
|
+
from .utils import update_dict_with_cast
|
|
8
|
+
|
|
9
|
+
class BaseFactory(metaclass=ABCMeta):
|
|
10
|
+
@abstractmethod
|
|
11
|
+
@lru_cache()
|
|
12
|
+
def get_app_config(self):
|
|
13
|
+
"""
|
|
14
|
+
Each factory should define what config it wants.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def create_app(self):
|
|
18
|
+
"""
|
|
19
|
+
Create an application instance.
|
|
20
|
+
"""
|
|
21
|
+
self.__load_local_config()
|
|
22
|
+
app_config = self.get_app_config()
|
|
23
|
+
app = FastAPI(docs_url=app_config.get('DOCS_URL'), redoc_url=app_config.get('REDOC_URL'), openapi_url=app_config.get('OPENAPI_URL'))
|
|
24
|
+
app.state.config = app_config
|
|
25
|
+
return app
|
|
26
|
+
|
|
27
|
+
def __load_local_config(self):
|
|
28
|
+
dotenv.load_dotenv(override=True)
|
|
29
|
+
update_dict_with_cast(self.get_app_config(), os.environ)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
def update_dict_with_cast(curr_conf: dict, new_conf: dict):
|
|
4
|
+
for key in curr_conf.keys():
|
|
5
|
+
if key in new_conf:
|
|
6
|
+
key_type = type(curr_conf[key])
|
|
7
|
+
cast_func = key_type if key_type in (str, int) else json.loads
|
|
8
|
+
curr_conf[key] = cast_func(new_conf[key])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: fastapi_basic
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.99999
|
|
4
4
|
Summary: A short description of your module
|
|
5
5
|
Home-page: https://github.com/szx21023/fastapi-base
|
|
6
6
|
Author: szx21023
|
|
@@ -22,6 +22,14 @@ Dynamic: requires-python
|
|
|
22
22
|
Dynamic: summary
|
|
23
23
|
|
|
24
24
|
# fastapi-base
|
|
25
|
-
|
|
25
|
+
how to release module
|
|
26
|
+
1. install relational modules
|
|
27
|
+
```
|
|
28
|
+
pip install setuptools wheel twine
|
|
29
|
+
```
|
|
30
|
+
2. modify setup.py(optional)
|
|
31
|
+
3. build env && upload to pypi
|
|
32
|
+
```
|
|
26
33
|
python setup.py sdist bdist_wheel
|
|
27
34
|
twine upload dist/*
|
|
35
|
+
```
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='fastapi_basic', # 模組名稱
|
|
5
|
-
version='0.0.
|
|
5
|
+
version='0.0.99999', # 版號版號
|
|
6
6
|
description='A short description of your module', # 模塊描述
|
|
7
7
|
long_description=open('README.md').read(), # 詳細描述,通常是 README 文件的内容
|
|
8
8
|
long_description_content_type='text/markdown', # markdown 格式
|
fastapi_basic-0.0.0/README.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from abc import ABCMeta, abstractmethod
|
|
2
|
-
|
|
3
|
-
from fastapi import FastAPI
|
|
4
|
-
|
|
5
|
-
class BaseFactory(metaclass=ABCMeta):
|
|
6
|
-
@abstractmethod
|
|
7
|
-
def get_app_config(self):
|
|
8
|
-
"""
|
|
9
|
-
Each factory should define what config it wants.
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
def create_app(self):
|
|
13
|
-
"""
|
|
14
|
-
Create an application instance.
|
|
15
|
-
"""
|
|
16
|
-
settings = self.get_app_config()
|
|
17
|
-
app = FastAPI(docs_url=settings.get('DOCS_URL'), redoc_url=settings.get('REDOC_URL'), openapi_url=settings.get('OPENAPI_URL'))
|
|
18
|
-
return app
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|