oe-python-template-example 0.1.0__py3-none-any.whl → 0.1.3__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.
@@ -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": {"description": "sub-docs", "url": "/api/v1/docs"},
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": {"description": "sub-docs", "url": "/api/v2/docs"},
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,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oe-python-template-example
3
- Version: 0.1.0
3
+ Version: 0.1.3
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/
@@ -91,6 +91,10 @@ Description-Content-Type: text/markdown
91
91
 
92
92
  > [!TIP]
93
93
  > 📚 [Online documentation](https://oe-python-template-example.readthedocs.io/en/latest/) - 📖 [PDF Manual](https://oe-python-template-example.readthedocs.io/_/downloads/en/latest/pdf/)
94
+
95
+ > [!NOTE]
96
+ > 🧠 This project was scaffolded using the template [oe-python-template](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template) with [copier](https://copier.readthedocs.io/).
97
+
94
98
  ---
95
99
 
96
100
 
@@ -172,16 +176,14 @@ Executing the command line interface (CLI) in an isolated Python environment is
172
176
  ```shell
173
177
  uvx oe-python-template-example hello-world # prints "Hello, world! [..]"
174
178
  uvx oe-python-template-example serve # serves webservice API
179
+ uvx oe-python-template-example serve --port=4711 # serves webservice API on port 4711
175
180
  ```
176
181
 
177
- When serving the 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 result.
178
-
179
- The API is versioned and provides interactive documentation at [http://127.0.0.1:8000/api/v1/docs](http://127.0.0.1:8000/api/v1/docs) resp. [http://127.0.0.1:8000/api/v2/docs](http://127.0.0.1:8000/api/v2/docs)
180
-
181
-
182
- ```shell
182
+ Notes:
183
+ * The API is versioned, mounted at ```/api/v1``` resp. ```/api/v2```
184
+ * 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.
185
+ * Interactive documentation is provided at [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
183
186
 
184
- When running the webservice API, goto http://127.0.0.1:8000/api/v1/docs
185
187
 
186
188
  The CLI provides extensive help:
187
189
 
@@ -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.3.dist-info/METADATA,sha256=vuWBWxdtyh33kzuX2yKkOpUevqm9AMaARQ0-DBIeqvQ,22153
7
+ oe_python_template_example-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
+ oe_python_template_example-0.1.3.dist-info/entry_points.txt,sha256=S2eCPB45b1Wgj_GsDRFAN-e4h7dBA5UPxT8od98erDE,82
9
+ oe_python_template_example-0.1.3.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
10
+ oe_python_template_example-0.1.3.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,,