oe-python-template 0.9.7__py3-none-any.whl → 0.10.0__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.
Files changed (37) hide show
  1. oe_python_template/__init__.py +3 -17
  2. oe_python_template/api.py +42 -148
  3. oe_python_template/cli.py +13 -141
  4. oe_python_template/constants.py +6 -9
  5. oe_python_template/hello/__init__.py +17 -0
  6. oe_python_template/hello/_api.py +94 -0
  7. oe_python_template/hello/_cli.py +47 -0
  8. oe_python_template/hello/_constants.py +4 -0
  9. oe_python_template/hello/_models.py +28 -0
  10. oe_python_template/hello/_service.py +96 -0
  11. oe_python_template/{settings.py → hello/_settings.py} +6 -4
  12. oe_python_template/system/__init__.py +17 -0
  13. oe_python_template/system/_api.py +78 -0
  14. oe_python_template/system/_cli.py +165 -0
  15. oe_python_template/system/_service.py +163 -0
  16. oe_python_template/utils/__init__.py +57 -0
  17. oe_python_template/utils/_api.py +18 -0
  18. oe_python_template/utils/_cli.py +68 -0
  19. oe_python_template/utils/_console.py +14 -0
  20. oe_python_template/utils/_constants.py +48 -0
  21. oe_python_template/utils/_di.py +70 -0
  22. oe_python_template/utils/_health.py +107 -0
  23. oe_python_template/utils/_log.py +122 -0
  24. oe_python_template/utils/_logfire.py +67 -0
  25. oe_python_template/utils/_process.py +41 -0
  26. oe_python_template/utils/_sentry.py +96 -0
  27. oe_python_template/utils/_service.py +39 -0
  28. oe_python_template/utils/_settings.py +68 -0
  29. oe_python_template/utils/boot.py +86 -0
  30. {oe_python_template-0.9.7.dist-info → oe_python_template-0.10.0.dist-info}/METADATA +77 -51
  31. oe_python_template-0.10.0.dist-info/RECORD +34 -0
  32. oe_python_template/models.py +0 -44
  33. oe_python_template/service.py +0 -68
  34. oe_python_template-0.9.7.dist-info/RECORD +0 -12
  35. {oe_python_template-0.9.7.dist-info → oe_python_template-0.10.0.dist-info}/WHEEL +0 -0
  36. {oe_python_template-0.9.7.dist-info → oe_python_template-0.10.0.dist-info}/entry_points.txt +0 -0
  37. {oe_python_template-0.9.7.dist-info → oe_python_template-0.10.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,86 @@
1
+ """Boot sequence."""
2
+
3
+ import os
4
+ import sys
5
+
6
+ from ._log import logging_initialize
7
+ from ._logfire import logfire_initialize
8
+ from ._sentry import sentry_initialize
9
+
10
+ _boot_called = False
11
+
12
+
13
+ def boot(modules_to_instrument: list[str]) -> None:
14
+ """Boot the application.
15
+
16
+ Args:
17
+ modules_to_instrument (list): List of modules to be instrumented.
18
+ repository_url (str): URL of the repository.
19
+ repository_root_path (str): The root path of the repository. Default is the root path.
20
+ """
21
+ global _boot_called # noqa: PLW0603
22
+ if _boot_called:
23
+ return
24
+ _boot_called = True
25
+ sentry_initialize()
26
+ log_to_logfire = logfire_initialize(modules_to_instrument)
27
+ logging_initialize(log_to_logfire)
28
+ _amend_library_path()
29
+ _parse_env_args()
30
+ _log_boot_message()
31
+
32
+
33
+ from ._constants import __project_name__, __version__ # noqa: E402
34
+ from ._log import get_logger # noqa: E402
35
+ from ._process import get_process_info # noqa: E402
36
+
37
+
38
+ def _parse_env_args() -> None:
39
+ """Parse --env arguments from command line and add to environment if prefix matches.
40
+
41
+ - Last but not least removes those args so typer does not complain about them.
42
+ """
43
+ i = 1 # Start after script name
44
+ to_remove = []
45
+ prefix = f"{__project_name__.upper()}_"
46
+
47
+ while i < len(sys.argv):
48
+ current_arg = sys.argv[i]
49
+
50
+ # Handle "--env KEY=VALUE" or "-e KEY=VALUE" format (two separate arguments)
51
+ if (current_arg in {"--env", "-e"}) and i + 1 < len(sys.argv):
52
+ key_value = sys.argv[i + 1]
53
+ if "=" in key_value:
54
+ key, value = key_value.split("=", 1)
55
+ if key.startswith(prefix):
56
+ os.environ[key] = value.strip("\"'")
57
+ to_remove.extend([i, i + 1])
58
+ i += 2
59
+ continue
60
+
61
+ i += 1
62
+
63
+ # Remove processed arguments from sys.argv in reverse order
64
+ for index in sorted(to_remove, reverse=True):
65
+ del sys.argv[index]
66
+
67
+
68
+ def _amend_library_path() -> None:
69
+ """Patch environment variables before any other imports."""
70
+ if "DYLD_FALLBACK_LIBRARY_PATH" not in os.environ:
71
+ os.environ["DYLD_FALLBACK_LIBRARY_PATH"] = f"{os.getenv('HOMEBREW_PREFIX', '/opt/homebrew')}/lib/"
72
+
73
+
74
+ def _log_boot_message() -> None:
75
+ """Log boot message with version and process information."""
76
+ logger = get_logger(__name__)
77
+ process_info = get_process_info()
78
+ logger.info(
79
+ "⭐ Booting %s v%s (project root %s, pid %s), parent '%s' (pid %s)",
80
+ __project_name__,
81
+ __version__,
82
+ process_info.project_root,
83
+ process_info.pid,
84
+ process_info.parent.name,
85
+ process_info.parent.pid,
86
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oe-python-template
3
- Version: 0.9.7
3
+ Version: 0.10.0
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/
@@ -49,13 +49,24 @@ Classifier: Programming Language :: Python :: 3.13
49
49
  Classifier: Typing :: Typed
50
50
  Requires-Python: <4.0,>=3.11
51
51
  Requires-Dist: fastapi[all,standard]>=0.115.12
52
+ Requires-Dist: logfire[system-metrics]>=3.13.1
53
+ Requires-Dist: opentelemetry-instrumentation-fastapi>=0.53b0
54
+ Requires-Dist: opentelemetry-instrumentation-httpx>=0.53b0
55
+ Requires-Dist: opentelemetry-instrumentation-jinja2>=0.53b0
56
+ Requires-Dist: opentelemetry-instrumentation-requests>=0.53b0
57
+ Requires-Dist: opentelemetry-instrumentation-sqlite3>=0.53b0
58
+ Requires-Dist: opentelemetry-instrumentation-tornado>=0.53b0
59
+ Requires-Dist: opentelemetry-instrumentation-urllib3>=0.53b0
60
+ Requires-Dist: opentelemetry-instrumentation-urllib>=0.53b0
61
+ Requires-Dist: psutil>=7.0.0
52
62
  Requires-Dist: pydantic-settings>=2.8.1
53
- Requires-Dist: pydantic>=2.11.1
63
+ Requires-Dist: pydantic>=2.11.3
64
+ Requires-Dist: sentry-sdk>=2.25.1
54
65
  Requires-Dist: typer>=0.15.1
55
66
  Provides-Extra: examples
56
67
  Requires-Dist: jinja2>=3.1.6; extra == 'examples'
57
68
  Requires-Dist: jupyter>=1.1.1; extra == 'examples'
58
- Requires-Dist: marimo>=0.12.2; extra == 'examples'
69
+ Requires-Dist: marimo>=0.12.8; extra == 'examples'
59
70
  Requires-Dist: streamlit>=1.44.1; extra == 'examples'
60
71
  Description-Content-Type: text/markdown
61
72
 
@@ -89,6 +100,8 @@ Description-Content-Type: text/markdown
89
100
  [![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-orange.json)](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template)
90
101
  [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTE3IDE2VjdsLTYgNU0yIDlWOGwxLTFoMWw0IDMgOC04aDFsNCAyIDEgMXYxNGwtMSAxLTQgMmgtMWwtOC04LTQgM0gzbC0xLTF2LTFsMy0zIi8+PC9zdmc+)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template)
91
102
  [![Open in GitHub Codespaces](https://img.shields.io/static/v1?label=GitHub%20Codespaces&message=Open&color=blue&logo=github)](https://github.com/codespaces/new/helmut-hoffer-von-ankershoffen/oe-python-template)
103
+ [![Vercel Deploy](https://deploy-badge.vercel.app/vercel/oe-python-template?root=docs)](https://oe-python-template.vercel.app/docs)
104
+ [![Better Stack Uptime](https://uptime.betterstack.com/status-badges/v1/monitor/1vze5.svg)](https://helmut-hoffer-von-ankershoffen.betteruptime.com/)
92
105
 
93
106
  <!---
94
107
  [![ghcr.io - Version](https://ghcr-badge.egpl.dev/helmut-hoffer-von-ankershoffen/oe-python-template/tags?color=%2344cc11&ignore=0.0%2C0%2Clatest&n=3&label=ghcr.io&trim=)](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template/pkgs/container/oe-python-template)
@@ -124,33 +137,40 @@ Projects generated with this template come with a comprehensive development tool
124
137
  8. CI/CD pipeline can be run locally with [act](https://github.com/nektos/act)
125
138
  9. Code quality and security checks with [SonarQube](https://www.sonarsource.com/products/sonarcloud) and [GitHub CodeQL](https://codeql.github.com/)
126
139
  10. Dependency monitoring and vulnerability scanning with [pip-audit](https://pypi.org/project/pip-audit/), [trivy](https://trivy.dev/latest/), [Renovate](https://github.com/renovatebot/renovate), and [GitHub Dependabot](https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide)
127
- 11. Licenses of dependencies extracted with [pip-licenses](https://pypi.org/project/pip-licenses/), matched with allow list, and published as release artifacts in CSV and JSON format for further compliance checks
128
- 12. Generation of attributions from extracted licenses
129
- 13. Software Bill of Materials (SBOM) generated in [CycloneDX](https://cyclonedx.org/) and [SPDX](https://spdx.dev/) formats with [cyclonedx-python](https://github.com/CycloneDX/cyclonedx-python) resp. [trivy](https://trivy.dev/latest/), published as release artifacts
130
- 14. Version and release management with [bump-my-version](https://callowayproject.github.io/bump-my-version/)
131
- 15. Changelog and release notes generated with [git-cliff](https://git-cliff.org/)
132
- 16. Documentation generated with [Sphinx](https://www.sphinx-doc.org/en/master/) including reference documentation for the library, CLI, and API
133
- 17. Documentation published to [Read The Docs](https://readthedocs.org/) including generation of PDF and single page HTML versions
134
- 18. Interactive OpenAPI specification with [Swagger](https://swagger.io/)
135
- 19. Python package published to [PyPI](https://pypi.org/)
136
- 20. Docker images published to [Docker.io](https://hub.docker.com/) and [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) with [artifact attestations](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds)
137
- 21. One-click development environments with [Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) and [GitHub Codespaces](https://github.com/features/codespaces)
138
- 22. Settings for use with [VSCode](https://code.visualstudio.com/)
139
- 23. Settings and custom instructions for use with [GitHub Copilot](https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot)
140
+ 11. Error monitoring and profiling with [Sentry](https://sentry.io/) (optional)
141
+ 12. Logging and metrics with [Logfire](https://logfire.dev/) (optional)
142
+ 13. Prepared for uptime monitoring with [betterstack](https://betterstack.com/) or alternatives
143
+ 13. Licenses of dependencies extracted with [pip-licenses](https://pypi.org/project/pip-licenses/), matched with allow list, and published as release artifacts in CSV and JSON format for further compliance checks
144
+ 14. Generation of attributions from extracted licenses
145
+ 15. Software Bill of Materials (SBOM) generated in [CycloneDX](https://cyclonedx.org/) and [SPDX](https://spdx.dev/) formats with [cyclonedx-python](https://github.com/CycloneDX/cyclonedx-python) resp. [trivy](https://trivy.dev/latest/), published as release artifacts
146
+ 16. Version and release management with [bump-my-version](https://callowayproject.github.io/bump-my-version/)
147
+ 17. Changelog and release notes generated with [git-cliff](https://git-cliff.org/)
148
+ 18. Documentation generated with [Sphinx](https://www.sphinx-doc.org/en/master/) including reference documentation for the library, CLI, and API
149
+ 19. Documentation published to [Read The Docs](https://readthedocs.org/) including generation of PDF and single page HTML versions
150
+ 20. Interactive OpenAPI specification with [Swagger](https://swagger.io/)
151
+ 21. Python package published to [PyPI](https://pypi.org/)
152
+ 22. Docker images published to [Docker.io](https://hub.docker.com/) and [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) with [artifact attestations](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds)
153
+ 23. One-click development environments with [Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) and [GitHub Codespaces](https://github.com/features/codespaces)
154
+ 24. Settings for use with [VSCode](https://code.visualstudio.com/)
155
+ 25. Settings and custom instructions for use with [GitHub Copilot](https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot)
156
+ 26. API deployed as serverless function to [Vercel](https://vercel.com/) (optional)
140
157
 
141
158
  ### Application Features
142
159
 
143
- Beyond development tooling, projects generated with this template include the code, documentation, and configuration of a fully functioning demo application and service. This reference implementation serves as a starting point for your own business logic with modern patterns and practices already in place:
144
-
145
- 1. Service architecture suitable for use as shared library
146
- 2. Validation with [pydantic](https://docs.pydantic.dev/)
147
- 3. Command-line interface (CLI) with [Typer](https://typer.tiangolo.com/)
148
- 4. Versioned Web API with [FastAPI](https://fastapi.tiangolo.com/)
149
- 5. [Interactive Jupyter notebook](https://jupyter.org/) and [reactive Marimo notebook](https://marimo.io/)
150
- 6. Simple Web UI with [Streamlit](https://streamlit.io/)
151
- 7. Configuration to run the CLI and API in a Docker container including setup for [Docker Compose](https://docs.docker.com/get-started/docker-concepts/the-basics/what-is-docker-compose/)
152
- 8. Documentation including badges, setup instructions, contribution guide and security policy
153
- 9. Preparation to deploy API as serverless function to Vercel
160
+ Beyond development tooling, projects generated with this template include the code, documentation, and configuration of a fully functioning application and service. This reference implementation serves as a starting point for your own business logic with modern patterns and enterprise practices already in place:
161
+
162
+ 1. Usable as library with "Hello" module exposing a simple service
163
+ 2. Command-line interface (CLI) with [Typer](https://typer.tiangolo.com/)
164
+ 3. Versioned webservice API with [FastAPI](https://fastapi.tiangolo.com/)
165
+ 4. [Interactive Jupyter notebook](https://jupyter.org/) and [reactive Marimo notebook](https://marimo.io/)
166
+ 5. Simple Web UI with [Streamlit](https://streamlit.io/)
167
+ 6. Configuration to run the CLI and API in a Docker container including setup for [Docker Compose](https://docs.docker.com/get-started/docker-concepts/the-basics/what-is-docker-compose/)
168
+ 7. Validation and settings management with [pydantic](https://docs.pydantic.dev/)
169
+ 8. Info command enabling to inspect the runtime, compiled settings, and further info provided dynamically by modules
170
+ 9. Health endpoint exposing system health dynamically aggregated from all modules and dependencies
171
+ 10. Flexible logging and instrumentation, including support for [Sentry](https://sentry.io/) and [Logfire](https://logfire.dev/)
172
+ 11. Modular architecture including auto-registration of services, CLI commands and API routes exposed by modules
173
+ 12. Documentation including dynamic badges, setup instructions, contribution guide and security policy
154
174
 
155
175
  Explore [here](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example) for what's generated out of the box.
156
176
 
@@ -273,7 +293,7 @@ The following examples run from source - clone this repository using
273
293
  from dotenv import load_dotenv
274
294
  from rich.console import Console
275
295
 
276
- from oe_python_template import Service
296
+ from oe_python_template.hello import Service
277
297
 
278
298
  console = Console()
279
299
 
@@ -355,13 +375,15 @@ uvx oe-python-template --help
355
375
  Execute commands:
356
376
 
357
377
  ```shell
358
- uvx oe-python-template hello-world
359
- uvx oe-python-template echo --help
360
- uvx oe-python-template echo "Lorem"
361
- uvx oe-python-template echo "Lorem" --json
362
- uvx oe-python-template openapi
363
- uvx oe-python-template openapi --output-format=json
364
- uvx oe-python-template serve
378
+ uvx oe-python-template hello world
379
+ uvx oe-python-template hello echo --help
380
+ uvx oe-python-template hello echo "Lorem"
381
+ uvx oe-python-template hello echo "Lorem" --json
382
+ uvx oe-python-template system info
383
+ uvx oe-python-template system health
384
+ uvx oe-python-template system openapi
385
+ uvx oe-python-template system openapi --output-format=json
386
+ uvx oe-python-template system serve
365
387
  ```
366
388
 
367
389
  See the [reference documentation of the CLI](https://oe-python-template.readthedocs.io/en/latest/cli_reference.html) for detailed documentation of all CLI commands and options.
@@ -384,19 +406,21 @@ You can as well run the CLI within Docker.
384
406
 
385
407
  ```shell
386
408
  docker run helmuthva/oe-python-template --help
387
- docker run helmuthva/oe-python-template hello-world
388
- docker run helmuthva/oe-python-template echo --help
389
- docker run helmuthva/oe-python-template echo "Lorem"
390
- docker run helmuthva/oe-python-template echo "Lorem" --json
391
- docker run helmuthva/oe-python-template openapi
392
- docker run helmuthva/oe-python-template openapi --output-format=json
393
- docker run helmuthva/oe-python-template serve
409
+ docker run helmuthva/oe-python-template hello world
410
+ docker run helmuthva/oe-python-template hello echo --help
411
+ docker run helmuthva/oe-python-template hello echo "Lorem"
412
+ docker run helmuthva/oe-python-template hello echo "Lorem" --json
413
+ docker run helmuthva/oe-python-template system info
414
+ docker run helmuthva/oe-python-template system health
415
+ docker run helmuthva/oe-python-template system openapi
416
+ docker run helmuthva/oe-python-template system openapi --output-format=json
417
+ docker run helmuthva/oe-python-template system serve
394
418
  ```
395
419
 
396
420
  Execute command:
397
421
 
398
422
  ```shell
399
- docker run --env THE_VAR=MY_VALUE helmuthva/oe-python-template echo "Lorem Ipsum"
423
+ docker run --env THE_VAR=MY_VALUE helmuthva/oe-python-template hello echo "Lorem Ipsum"
400
424
  ```
401
425
 
402
426
  Or use docker compose
@@ -405,12 +429,14 @@ The .env is passed through from the host to the Docker container.
405
429
 
406
430
  ```shell
407
431
  docker compose run --remove-orphans oe-python-template --help
408
- docker compose run --remove-orphans oe-python-template hello-world
409
- docker compose run --remove-orphans oe-python-template echo --help
410
- docker compose run --remove-orphans oe-python-template echo "Lorem"
411
- docker compose run --remove-orphans oe-python-template echo "Lorem" --json
412
- docker compose run --remove-orphans oe-python-template openapi
413
- docker compose run --remove-orphans oe-python-template openapi --output-format=json
432
+ docker compose run --remove-orphans oe-python-template hello world
433
+ docker compose run --remove-orphans oe-python-template hello echo --help
434
+ docker compose run --remove-orphans oe-python-template hello echo "Lorem"
435
+ docker compose run --remove-orphans oe-python-template hello echo "Lorem" --json
436
+ docker compose run --remove-orphans oe-python-template system info
437
+ docker compose run --remove-orphans oe-python-template system health
438
+ docker compose run --remove-orphans oe-python-template system openapi
439
+ docker compose run --remove-orphans oe-python-template system openapi --output-format=json
414
440
  echo "Running OE Python Template's API container as a daemon ..."
415
441
  docker compose up -d
416
442
  echo "Waiting for the API server to start ..."
@@ -419,7 +445,7 @@ echo "Checking health of v1 API ..."
419
445
  curl http://127.0.0.1:8000/api/v1/healthz
420
446
  echo ""
421
447
  echo "Saying hello world with v1 API ..."
422
- curl http://127.0.0.1:8000/api/v1/hello-world
448
+ curl http://127.0.0.1:8000/api/v1/hello/world
423
449
  echo ""
424
450
  echo "Swagger docs of v1 API ..."
425
451
  curl http://127.0.0.1:8000/api/v1/docs
@@ -428,7 +454,7 @@ echo "Checking health of v2 API ..."
428
454
  curl http://127.0.0.1:8000/api/v2/healthz
429
455
  echo ""
430
456
  echo "Saying hello world with v1 API ..."
431
- curl http://127.0.0.1:8000/api/v2/hello-world
457
+ curl http://127.0.0.1:8000/api/v2/hello/world
432
458
  echo ""
433
459
  echo "Swagger docs of v2 API ..."
434
460
  curl http://127.0.0.1:8000/api/v2/docs
@@ -0,0 +1,34 @@
1
+ oe_python_template/__init__.py,sha256=_Z3Xb-x95UODU66avOiwROVaouk_s0ZNB25KFnPoS40,226
2
+ oe_python_template/api.py,sha256=_01uucVgj32At44Hp__DfYhMG943Vl33Xh52B2H8_a0,2084
3
+ oe_python_template/cli.py,sha256=o2XcJrLCkdmrIZCvGPmxNfRe4Ofb1UEv61MIQM4YLV0,663
4
+ oe_python_template/constants.py,sha256=HShGdRFL8v7AWBUgHAU2sF6ttomtx3znCERZKfRJ-jQ,155
5
+ oe_python_template/hello/__init__.py,sha256=7C7gIdxkydk79-4QPyVqyUHhqP3RMFShSptzE_2J9jo,289
6
+ oe_python_template/hello/_api.py,sha256=hWWlEDUfFY1se2ZzhqGMfPyD3FPwuA-YzxG9Q9z4F2o,2294
7
+ oe_python_template/hello/_cli.py,sha256=mSNmRj_VRoRfCAR1I8tssZqZCTmT6jgzsNWrTtlFP7Y,1184
8
+ oe_python_template/hello/_constants.py,sha256=6aRleAIcdgC13TeTzI07YwjoSwqGb2g131dw8aEoM4I,109
9
+ oe_python_template/hello/_models.py,sha256=JtI7wGT72u23NOxFa-oeWzdyiMg7PnHL5eg22im2_yQ,574
10
+ oe_python_template/hello/_service.py,sha256=-rUlt54EAafMhLSo-IBsWMe6mjLTIlYfhxCFKVl8C8s,3004
11
+ oe_python_template/hello/_settings.py,sha256=1z77_B4pWFx_ag9EasgUM01MjKeBwiAhnkhL9XjlR9I,984
12
+ oe_python_template/system/__init__.py,sha256=u6UcW5_-5hT1Iqlv2NrDGW2QYVCryu2_bDkJKxl9z-c,379
13
+ oe_python_template/system/_api.py,sha256=-uorLNHyDHKll9IUp_1fadMQ-BATXTK33gdmfflTaWo,2444
14
+ oe_python_template/system/_cli.py,sha256=J_4upBBdbSxbONPYmOZPbuhZcKjfnPIUeZpp0L7lY-Q,4846
15
+ oe_python_template/system/_service.py,sha256=PSM22bV-0MYnh3KI41z0UiGhzWpvJBBMzFflwrRMw4U,5513
16
+ oe_python_template/utils/__init__.py,sha256=XCu2HmU4JHzd4h5wU9lwNI7CSt1uf9sSh358RTtGAF0,1359
17
+ oe_python_template/utils/_api.py,sha256=w3hPQK1pL2gBI4_1qNWNa2b4S_oH-8mY-ckRX0KrCWM,617
18
+ oe_python_template/utils/_cli.py,sha256=J_mFtXZ1gGeovGrE5i3wlokTOBfiTTKEz5magiRP7GA,2091
19
+ oe_python_template/utils/_console.py,sha256=u0-utcdRmVu4rabrYUyNOx8yPxLhxB3E92m22kSCwPQ,293
20
+ oe_python_template/utils/_constants.py,sha256=72gJp53wLIyorzGXdA1h6alXmaUWpvEVOXZ8EJ1HOIA,1712
21
+ oe_python_template/utils/_di.py,sha256=KdjiD4xZ_QSfbddkKWwsPJmG5YrIg6dzuBrlsd-FhxA,2189
22
+ oe_python_template/utils/_health.py,sha256=35QOWe2r5InrEpGtuVMym9dI5aRHS0HWf4BHBRAUIj0,4102
23
+ oe_python_template/utils/_log.py,sha256=ZW4gs540SdjVK-2KeheLfDY15d_3xpO5FyGn7wTXyaM,3592
24
+ oe_python_template/utils/_logfire.py,sha256=zLkrgukvJpPZ8vQpawgDViPMMWza1APFlIIlKVny_ak,1893
25
+ oe_python_template/utils/_process.py,sha256=40R0NZMqJUn0iUPERzohSUpJgU1HcJApIg1HipIxFCw,941
26
+ oe_python_template/utils/_sentry.py,sha256=ChSvJu-B_oby5F6oqycJ6McYzy15jRj9yZgG5apOsY4,2999
27
+ oe_python_template/utils/_service.py,sha256=atHAejvBucKXjzhsMSdOBBFa7rRD74zcV70Pp0pl0Tg,1038
28
+ oe_python_template/utils/_settings.py,sha256=lA47dtwMHgO62j3R6i1W7sTidrQwVNloOGGxbS2rz6Q,1843
29
+ oe_python_template/utils/boot.py,sha256=TBgmqbtIryQz0cAozYzxhYQRIldfbJ6v9R-rH6sO9mY,2696
30
+ oe_python_template-0.10.0.dist-info/METADATA,sha256=49lhRarpN3-TcBlFQNZYw5AXfQc3ZTd-3czwHs9xau8,31916
31
+ oe_python_template-0.10.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
32
+ oe_python_template-0.10.0.dist-info/entry_points.txt,sha256=IroSSWhLGxus9rxcashkYQda39TTvf7LbUMYtOKXUBE,66
33
+ oe_python_template-0.10.0.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
34
+ oe_python_template-0.10.0.dist-info/RECORD,,
@@ -1,44 +0,0 @@
1
- """Models used throughout OE Python Template's codebase ."""
2
-
3
- from enum import StrEnum
4
-
5
- from pydantic import BaseModel, Field
6
-
7
- UTTERANCE_EXAMPLE = "Hello, world!"
8
- ECHO_EXAMPLE = "HELLO, WORLD!"
9
-
10
-
11
- class Utterance(BaseModel):
12
- """Model representing a text utterance."""
13
-
14
- text: str = Field(
15
- ...,
16
- min_length=1,
17
- description="The utterance to echo back",
18
- examples=[UTTERANCE_EXAMPLE],
19
- )
20
-
21
-
22
- class Echo(BaseModel):
23
- """Response model for echo endpoint."""
24
-
25
- text: str = Field(
26
- ...,
27
- min_length=1,
28
- description="The echo",
29
- examples=[ECHO_EXAMPLE],
30
- )
31
-
32
-
33
- class HealthStatus(StrEnum):
34
- """Health status enumeration."""
35
-
36
- UP = "UP"
37
- DOWN = "DOWN"
38
-
39
-
40
- class Health(BaseModel):
41
- """Health status model."""
42
-
43
- status: HealthStatus
44
- reason: str | None = None
@@ -1,68 +0,0 @@
1
- """Service of OE Python Template."""
2
-
3
- import os
4
-
5
- from dotenv import load_dotenv
6
-
7
- from .models import Echo, Utterance
8
- from .settings import Language, Settings
9
-
10
- load_dotenv()
11
- THE_VAR = os.getenv("THE_VAR", "not defined")
12
-
13
-
14
- class Service:
15
- """Service of OE Python Template."""
16
-
17
- _settings: Settings
18
-
19
- def __init__(self) -> None:
20
- """Initialize service."""
21
- self._settings = Settings() # pyright: ignore[reportCallIssue] - false positive
22
- self.is_healthy = True
23
-
24
- def healthy(self) -> bool:
25
- """
26
- Check if the service is healthy.
27
-
28
- Returns:
29
- bool: True if the service is healthy, False otherwise.
30
- """
31
- return self.is_healthy
32
-
33
- def info(self) -> str:
34
- """
35
- Get info about configuration of service.
36
-
37
- Returns:
38
- str: Service configuration.
39
- """
40
- return self._settings.model_dump_json()
41
-
42
- def get_hello_world(self) -> str:
43
- """
44
- Get a hello world message.
45
-
46
- Returns:
47
- str: Hello world message.
48
- """
49
- match self._settings.language:
50
- case Language.GERMAN:
51
- return "Hallo, Welt!"
52
- return "Hello, world!"
53
-
54
- @staticmethod
55
- def echo(utterance: Utterance) -> Echo:
56
- """
57
- Loudly echo utterance.
58
-
59
- Args:
60
- utterance (Utterance): The utterance to echo.
61
-
62
- Returns:
63
- Echo: The loudly echoed utterance.
64
-
65
- Raises:
66
- ValueError: If the utterance is empty or contains only whitespace.
67
- """
68
- return Echo(text=utterance.text.upper())
@@ -1,12 +0,0 @@
1
- oe_python_template/__init__.py,sha256=R49r9JJnOBe4HrPGcu37ySvguxpGzQgTM7LtlyRnUK0,436
2
- oe_python_template/api.py,sha256=j4LHMUDs9xAC_9Rw5p53cr5SycxqAYnGHJ1FdWI-SnY,5010
3
- oe_python_template/cli.py,sha256=X4iga-Y6gL0R2eJ9KtvnpM2jUX8GiaMh0TPTBf5MYvE,3862
4
- oe_python_template/constants.py,sha256=Z1c06l5DeRuFxYVLHihHHTYvr8_Qh0nyzVKOe5X3ZNs,350
5
- oe_python_template/models.py,sha256=L9uwom3TkuOpN3R30bGKEBQKcrLLEMc-O9e8VVSNTGw,838
6
- oe_python_template/service.py,sha256=f_s-NTNcCQb5fWDjW-vNmbp4GCuprOqm8rAp_K_SPIw,1606
7
- oe_python_template/settings.py,sha256=87VZ1IEGbV3ivDjpG6x_Mgs2inH2hVd4ZD7DGsHOYFE,743
8
- oe_python_template-0.9.7.dist-info/METADATA,sha256=DbsHqiDO02Z3fkXOxVL6nPKNl32q7nVMmHPA4v01-jQ,29818
9
- oe_python_template-0.9.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- oe_python_template-0.9.7.dist-info/entry_points.txt,sha256=IroSSWhLGxus9rxcashkYQda39TTvf7LbUMYtOKXUBE,66
11
- oe_python_template-0.9.7.dist-info/licenses/LICENSE,sha256=5H409K6xzz9U5eUaoAHQExNkoWJRlU0LEj6wL2QJ34s,1113
12
- oe_python_template-0.9.7.dist-info/RECORD,,