oe-python-template 0.10.9__py3-none-any.whl → 0.10.10__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.
oe_python_template/api.py CHANGED
@@ -13,6 +13,7 @@ from .utils import (
13
13
  VersionedAPIRouter,
14
14
  __author_email__,
15
15
  __author_name__,
16
+ __base__url__,
16
17
  __documentation__url__,
17
18
  __repository_url__,
18
19
  locate_implementations,
@@ -26,6 +27,9 @@ CONTACT_EMAIL = __author_email__
26
27
  CONTACT_URL = __repository_url__
27
28
  TERMS_OF_SERVICE_URL = __documentation__url__
28
29
 
30
+ API_BASE_URL = __base__url__
31
+ if not API_BASE_URL:
32
+ API_BASE_URL = f"http://{UVICORN_HOST}:{UVICORN_PORT}"
29
33
 
30
34
  app = FastAPI(
31
35
  root_path="/api",
@@ -42,7 +46,7 @@ app = FastAPI(
42
46
  "description": f"API version {version.lstrip('v')}, check link on the right",
43
47
  "externalDocs": {
44
48
  "description": "sub-docs",
45
- "url": f"http://{UVICORN_HOST}:{UVICORN_PORT}/api/{version}/docs",
49
+ "url": f"{API_BASE_URL}/api/{version}/docs",
46
50
  },
47
51
  }
48
52
  for version, _ in API_VERSIONS.items()
@@ -6,6 +6,7 @@ from ._console import console
6
6
  from ._constants import (
7
7
  __author_email__,
8
8
  __author_name__,
9
+ __base__url__,
9
10
  __documentation__url__,
10
11
  __env__,
11
12
  __env_file__,
@@ -39,6 +40,7 @@ __all__ = [
39
40
  "VersionedAPIRouter",
40
41
  "__author_email__",
41
42
  "__author_name__",
43
+ "__base__url__",
42
44
  "__documentation__url__",
43
45
  "__env__",
44
46
  "__env_file__",
@@ -5,6 +5,10 @@ import sys
5
5
  from importlib import metadata
6
6
  from pathlib import Path
7
7
 
8
+ from dotenv import load_dotenv
9
+
10
+ load_dotenv()
11
+
8
12
  __project_name__ = __name__.split(".")[0]
9
13
  __project_path__ = str(Path(__file__).parent.parent.parent)
10
14
  __version__ = metadata.version(__project_name__)
@@ -21,6 +25,13 @@ env_file_path = os.getenv(f"{__project_name__.upper()}_ENV_FILE")
21
25
  if env_file_path:
22
26
  __env_file__.insert(2, Path(env_file_path))
23
27
 
28
+ vercel_base_url = os.getenv("VERCEL_URL", None)
29
+ if vercel_base_url:
30
+ vercel_base_url = "https://" + vercel_base_url
31
+ __base__url__ = os.getenv(__project_name__.upper() + "_BASE_URL", None)
32
+ if not __base__url__ and vercel_base_url:
33
+ __base__url__ = vercel_base_url
34
+
24
35
 
25
36
  def get_project_url_by_label(prefix: str) -> str:
26
37
  """Get labeled Project-URL.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oe-python-template
3
- Version: 0.10.9
3
+ Version: 0.10.10
4
4
  Summary: 🧠 Copier template to scaffold Python projects compliant with best practices and modern tooling.
5
5
  Project-URL: Homepage, https://oe-python-template.readthedocs.io/en/latest/
6
6
  Project-URL: Documentation, https://oe-python-template.readthedocs.io/en/latest/
@@ -1,5 +1,5 @@
1
1
  oe_python_template/__init__.py,sha256=_Z3Xb-x95UODU66avOiwROVaouk_s0ZNB25KFnPoS40,226
2
- oe_python_template/api.py,sha256=_01uucVgj32At44Hp__DfYhMG943Vl33Xh52B2H8_a0,2084
2
+ oe_python_template/api.py,sha256=tmhLN7uK-zS1OCKS9eAWLCNo1WAOQbgmFkYSLQLd5BA,2190
3
3
  oe_python_template/cli.py,sha256=o2XcJrLCkdmrIZCvGPmxNfRe4Ofb1UEv61MIQM4YLV0,663
4
4
  oe_python_template/constants.py,sha256=HShGdRFL8v7AWBUgHAU2sF6ttomtx3znCERZKfRJ-jQ,155
5
5
  oe_python_template/hello/__init__.py,sha256=7C7gIdxkydk79-4QPyVqyUHhqP3RMFShSptzE_2J9jo,289
@@ -14,11 +14,11 @@ oe_python_template/system/_api.py,sha256=rE9Aau3IIHXdEkOBUXOwJ7SxN3cZpgtYEuojnSW
14
14
  oe_python_template/system/_cli.py,sha256=J_4upBBdbSxbONPYmOZPbuhZcKjfnPIUeZpp0L7lY-Q,4846
15
15
  oe_python_template/system/_service.py,sha256=zdnO6e8ShgrsIK3W2KbIEYpRIp9lQw35f1UFDUn1md8,6334
16
16
  oe_python_template/system/_settings.py,sha256=MwMAJYifJ6jGImeSh4e9shmIXmiUSuQGHXz_Ts0mSdk,901
17
- oe_python_template/utils/__init__.py,sha256=MMpcuyU1gfCC3_h3RavS6SD1cAn1FeaqD1qfu6SrAZ8,1519
17
+ oe_python_template/utils/__init__.py,sha256=MVy9A4miNYBFkNc0f24-KGG25mftb8BzDmyBb43lvQE,1559
18
18
  oe_python_template/utils/_api.py,sha256=w3hPQK1pL2gBI4_1qNWNa2b4S_oH-8mY-ckRX0KrCWM,617
19
19
  oe_python_template/utils/_cli.py,sha256=J_mFtXZ1gGeovGrE5i3wlokTOBfiTTKEz5magiRP7GA,2091
20
20
  oe_python_template/utils/_console.py,sha256=u0-utcdRmVu4rabrYUyNOx8yPxLhxB3E92m22kSCwPQ,293
21
- oe_python_template/utils/_constants.py,sha256=1ocbciHjhmy66uHrTw6p-fbBq_wLl1HaUSu4oTgt8mo,1737
21
+ oe_python_template/utils/_constants.py,sha256=AP1a4kJqyf3HG6YFupUREvlkTX1b-Xx1H4u0O1nMfzc,2054
22
22
  oe_python_template/utils/_di.py,sha256=KdjiD4xZ_QSfbddkKWwsPJmG5YrIg6dzuBrlsd-FhxA,2189
23
23
  oe_python_template/utils/_health.py,sha256=35QOWe2r5InrEpGtuVMym9dI5aRHS0HWf4BHBRAUIj0,4102
24
24
  oe_python_template/utils/_log.py,sha256=ZW4gs540SdjVK-2KeheLfDY15d_3xpO5FyGn7wTXyaM,3592
@@ -28,8 +28,8 @@ oe_python_template/utils/_sentry.py,sha256=2sXrDSZSYoDEM87v7CakJ6eGBtcIhDI48PsQC
28
28
  oe_python_template/utils/_service.py,sha256=atHAejvBucKXjzhsMSdOBBFa7rRD74zcV70Pp0pl0Tg,1038
29
29
  oe_python_template/utils/_settings.py,sha256=owFoaHEzJnVD3EVyOWF4rfIY7g6eLnU6rN0m4VHhCbA,2464
30
30
  oe_python_template/utils/boot.py,sha256=TBgmqbtIryQz0cAozYzxhYQRIldfbJ6v9R-rH6sO9mY,2696
31
- oe_python_template-0.10.9.dist-info/METADATA,sha256=iuEmgiGPdcHSf1J_YTt2WkD7PXIbdG_oQ6X6zBySamE,32094
32
- oe_python_template-0.10.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
33
- oe_python_template-0.10.9.dist-info/entry_points.txt,sha256=IroSSWhLGxus9rxcashkYQda39TTvf7LbUMYtOKXUBE,66
34
- oe_python_template-0.10.9.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
35
- oe_python_template-0.10.9.dist-info/RECORD,,
31
+ oe_python_template-0.10.10.dist-info/METADATA,sha256=G99JFNVdLmPLiq_aOyQ_V2X5bHyV0hTkmqLu97NNA6k,32095
32
+ oe_python_template-0.10.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
33
+ oe_python_template-0.10.10.dist-info/entry_points.txt,sha256=IroSSWhLGxus9rxcashkYQda39TTvf7LbUMYtOKXUBE,66
34
+ oe_python_template-0.10.10.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
35
+ oe_python_template-0.10.10.dist-info/RECORD,,