oe-python-template-example 0.1.0__py3-none-any.whl → 0.1.1__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_example/api.py +11 -2
- oe_python_template_example/cli.py +3 -0
- {oe_python_template_example-0.1.0.dist-info → oe_python_template_example-0.1.1.dist-info}/METADATA +6 -8
- oe_python_template_example-0.1.1.dist-info/RECORD +10 -0
- oe_python_template_example-0.1.0.dist-info/RECORD +0 -10
- {oe_python_template_example-0.1.0.dist-info → oe_python_template_example-0.1.1.dist-info}/WHEEL +0 -0
- {oe_python_template_example-0.1.0.dist-info → oe_python_template_example-0.1.1.dist-info}/entry_points.txt +0 -0
- {oe_python_template_example-0.1.0.dist-info → oe_python_template_example-0.1.1.dist-info}/licenses/LICENSE +0 -0
@@ -8,6 +8,7 @@ This module provides a webservice API with several endpoints:
|
|
8
8
|
The endpoints use Pydantic models for request and response validation.
|
9
9
|
"""
|
10
10
|
|
11
|
+
import os
|
11
12
|
from collections.abc import Generator
|
12
13
|
from enum import StrEnum
|
13
14
|
from typing import Annotated
|
@@ -18,6 +19,8 @@ from pydantic import BaseModel, Field
|
|
18
19
|
from oe_python_template_example import Service
|
19
20
|
|
20
21
|
HELLO_WORLD_EXAMPLE = "Hello, world!"
|
22
|
+
UVICORN_HOST = os.environ.get("UVICORN_HOST", "127.0.0.1")
|
23
|
+
UVICORN_PORT = os.environ.get("UVICORN_PORT", "8000")
|
21
24
|
|
22
25
|
|
23
26
|
def get_service() -> Generator[Service, None, None]:
|
@@ -47,12 +50,18 @@ api = FastAPI(
|
|
47
50
|
{
|
48
51
|
"name": "v1",
|
49
52
|
"description": "API version 1, check link on the right",
|
50
|
-
"externalDocs": {
|
53
|
+
"externalDocs": {
|
54
|
+
"description": "sub-docs",
|
55
|
+
"url": f"http://{UVICORN_HOST}:{UVICORN_PORT}/api/v1/docs",
|
56
|
+
},
|
51
57
|
},
|
52
58
|
{
|
53
59
|
"name": "v2",
|
54
60
|
"description": "API version 2, check link on the right",
|
55
|
-
"externalDocs": {
|
61
|
+
"externalDocs": {
|
62
|
+
"description": "sub-docs",
|
63
|
+
"url": f"http://{UVICORN_HOST}:{UVICORN_PORT}/api/v2/docs",
|
64
|
+
},
|
56
65
|
},
|
57
66
|
],
|
58
67
|
)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"""CLI (Command Line Interface) of OE Python Template Example."""
|
2
2
|
|
3
|
+
import os
|
3
4
|
from enum import StrEnum
|
4
5
|
from typing import Annotated
|
5
6
|
|
@@ -49,6 +50,8 @@ def serve(
|
|
49
50
|
) -> None:
|
50
51
|
"""Start the API server."""
|
51
52
|
console.print(f"Starting API server at http://{host}:{port}")
|
53
|
+
os.environ["UVICORN_HOST"] = host
|
54
|
+
os.environ["UVICORN_PORT"] = str(port)
|
52
55
|
uvicorn.run(
|
53
56
|
"oe_python_template_example.api:api",
|
54
57
|
host=host,
|
{oe_python_template_example-0.1.0.dist-info → oe_python_template_example-0.1.1.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: oe-python-template-example
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.1
|
4
4
|
Summary: 🧠 Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
|
5
5
|
Project-URL: Homepage, https://oe-python-template-example.readthedocs.io/en/latest/
|
6
6
|
Project-URL: Documentation, https://oe-python-template-example.readthedocs.io/en/latest/
|
@@ -172,16 +172,14 @@ Executing the command line interface (CLI) in an isolated Python environment is
|
|
172
172
|
```shell
|
173
173
|
uvx oe-python-template-example hello-world # prints "Hello, world! [..]"
|
174
174
|
uvx oe-python-template-example serve # serves webservice API
|
175
|
+
uvx oe-python-template-example serve --port=4711 # serves webservice API on port 4711
|
175
176
|
```
|
176
177
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
```shell
|
178
|
+
Notes:
|
179
|
+
* The API is versioned, mounted at ```/api/v1``` resp. ```/api/v2```
|
180
|
+
* While serving the webservice API go to [http://127.0.0.1:8000/api/v1/hello-world](http://127.0.0.1:8000/api/v1/hello-world) to see the respons of the ```hello-world``` operation.
|
181
|
+
* Interactive documentation is provided at [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
|
183
182
|
|
184
|
-
When running the webservice API, goto http://127.0.0.1:8000/api/v1/docs
|
185
183
|
|
186
184
|
The CLI provides extensive help:
|
187
185
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
oe_python_template_example/__init__.py,sha256=-sCwS9lD6CvgWw88f7snBDF947PWIhEupJVebXL_w1M,314
|
2
|
+
oe_python_template_example/api.py,sha256=-K3cLHgmtmnSfCIM3eyZpxL1R5KDkxFd9OvYv6Pdp4M,6647
|
3
|
+
oe_python_template_example/cli.py,sha256=BHuDCrzYkvJYDdvk06KwkK_sKQx7h7hhRiO0peQMM1s,3474
|
4
|
+
oe_python_template_example/constants.py,sha256=6uQHr2CRgzWQWhUQCRRKiPuFhzKB2iblZk3dIRQ5dDc,358
|
5
|
+
oe_python_template_example/service.py,sha256=XlCrklSRy8_YaYvlVYiDFPUubHHm-J8BPx2f7_niGG4,760
|
6
|
+
oe_python_template_example-0.1.1.dist-info/METADATA,sha256=QM5M_qyG9DY9AH9wUrLQoHa_IoOSjdQSFsCBIxX3Rqo,21949
|
7
|
+
oe_python_template_example-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
8
|
+
oe_python_template_example-0.1.1.dist-info/entry_points.txt,sha256=S2eCPB45b1Wgj_GsDRFAN-e4h7dBA5UPxT8od98erDE,82
|
9
|
+
oe_python_template_example-0.1.1.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
|
10
|
+
oe_python_template_example-0.1.1.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
oe_python_template_example/__init__.py,sha256=-sCwS9lD6CvgWw88f7snBDF947PWIhEupJVebXL_w1M,314
|
2
|
-
oe_python_template_example/api.py,sha256=Z5ZBrz7Ayjoi_h2UfD0Y_v3mlaHAkkXZYWonzB9L2hc,6356
|
3
|
-
oe_python_template_example/cli.py,sha256=PF4B8XygvY72obDFBu4idxNDntNvFbhSi-5Bl3vs4gU,3383
|
4
|
-
oe_python_template_example/constants.py,sha256=6uQHr2CRgzWQWhUQCRRKiPuFhzKB2iblZk3dIRQ5dDc,358
|
5
|
-
oe_python_template_example/service.py,sha256=XlCrklSRy8_YaYvlVYiDFPUubHHm-J8BPx2f7_niGG4,760
|
6
|
-
oe_python_template_example-0.1.0.dist-info/METADATA,sha256=6tmPpUMuhnNOlQYfR1zHL0sACY0Hdw7EYR_5iyZ6ekw,21925
|
7
|
-
oe_python_template_example-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
8
|
-
oe_python_template_example-0.1.0.dist-info/entry_points.txt,sha256=S2eCPB45b1Wgj_GsDRFAN-e4h7dBA5UPxT8od98erDE,82
|
9
|
-
oe_python_template_example-0.1.0.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
|
10
|
-
oe_python_template_example-0.1.0.dist-info/RECORD,,
|
{oe_python_template_example-0.1.0.dist-info → oe_python_template_example-0.1.1.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|