oe-python-template-example 0.2.5__tar.gz → 0.2.7__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.
Files changed (95) hide show
  1. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/PKG-INFO +144 -60
  2. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/README.md +143 -59
  3. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/pyproject.toml +15 -4
  4. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/src/oe_python_template_example/__init__.py +5 -0
  5. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/src/oe_python_template_example/api.py +17 -75
  6. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/src/oe_python_template_example/cli.py +4 -3
  7. oe_python_template_example-0.2.7/src/oe_python_template_example/models.py +44 -0
  8. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/src/oe_python_template_example/service.py +19 -1
  9. oe_python_template_example-0.2.5/.act-env-public +0 -1
  10. oe_python_template_example-0.2.5/.copier-answers.yml +0 -23
  11. oe_python_template_example-0.2.5/.devcontainer/Dockerfile +0 -7
  12. oe_python_template_example-0.2.5/.devcontainer/devcontainer.json +0 -51
  13. oe_python_template_example-0.2.5/.devcontainer/onCreateCommand +0 -9
  14. oe_python_template_example-0.2.5/.devcontainer/postAttachCommand +0 -4
  15. oe_python_template_example-0.2.5/.devcontainer/postCreateCommand +0 -4
  16. oe_python_template_example-0.2.5/.env.example +0 -1
  17. oe_python_template_example-0.2.5/.github/copilot-instructions.md +0 -5
  18. oe_python_template_example-0.2.5/.github/dependabot.yml +0 -13
  19. oe_python_template_example-0.2.5/.github/workflows/codeql.yml +0 -100
  20. oe_python_template_example-0.2.5/.github/workflows/docker-image-build-publish.yml +0 -93
  21. oe_python_template_example-0.2.5/.github/workflows/package-build-publish-release.yml +0 -63
  22. oe_python_template_example-0.2.5/.github/workflows/test-and-report.yml +0 -113
  23. oe_python_template_example-0.2.5/.pre-commit-config.yaml +0 -76
  24. oe_python_template_example-0.2.5/.python-version +0 -1
  25. oe_python_template_example-0.2.5/.readthedocs.yml +0 -36
  26. oe_python_template_example-0.2.5/.secrets.baseline +0 -127
  27. oe_python_template_example-0.2.5/.vscode/extensions.json +0 -27
  28. oe_python_template_example-0.2.5/.vscode/settings.json +0 -76
  29. oe_python_template_example-0.2.5/CHANGELOG.md +0 -67
  30. oe_python_template_example-0.2.5/CODEOWNERS +0 -3
  31. oe_python_template_example-0.2.5/CODE_STYLE.md +0 -284
  32. oe_python_template_example-0.2.5/CONTRIBUTING.md +0 -156
  33. oe_python_template_example-0.2.5/Dockerfile +0 -42
  34. oe_python_template_example-0.2.5/RELEASE_NOTES.md +0 -1
  35. oe_python_template_example-0.2.5/SECURITY.md +0 -60
  36. oe_python_template_example-0.2.5/SERVICE_CONNECTIONS.md +0 -85
  37. oe_python_template_example-0.2.5/VERSION +0 -1
  38. oe_python_template_example-0.2.5/bin/git-cliff +0 -0
  39. oe_python_template_example-0.2.5/codecov.yml +0 -11
  40. oe_python_template_example-0.2.5/compose.yaml +0 -35
  41. oe_python_template_example-0.2.5/docs/Makefile +0 -20
  42. oe_python_template_example-0.2.5/docs/make.bat +0 -35
  43. oe_python_template_example-0.2.5/docs/partials/README_footer.md +0 -15
  44. oe_python_template_example-0.2.5/docs/partials/README_header.md +0 -40
  45. oe_python_template_example-0.2.5/docs/partials/README_main.md +0 -252
  46. oe_python_template_example-0.2.5/docs/source/_static/.keep +0 -0
  47. oe_python_template_example-0.2.5/docs/source/_static/openapi.json +0 -262
  48. oe_python_template_example-0.2.5/docs/source/_static/openapi.yaml +0 -210
  49. oe_python_template_example-0.2.5/docs/source/_static/openapi_v1.json +0 -262
  50. oe_python_template_example-0.2.5/docs/source/_static/openapi_v1.yaml +0 -204
  51. oe_python_template_example-0.2.5/docs/source/_static/openapi_v2.json +0 -262
  52. oe_python_template_example-0.2.5/docs/source/_static/openapi_v2.yaml +0 -204
  53. oe_python_template_example-0.2.5/docs/source/api_v1.rst +0 -9
  54. oe_python_template_example-0.2.5/docs/source/api_v2.rst +0 -9
  55. oe_python_template_example-0.2.5/docs/source/code-style.rst +0 -1
  56. oe_python_template_example-0.2.5/docs/source/conf.py +0 -128
  57. oe_python_template_example-0.2.5/docs/source/contributing.rst +0 -1
  58. oe_python_template_example-0.2.5/docs/source/index.rst +0 -40
  59. oe_python_template_example-0.2.5/docs/source/main.rst +0 -1
  60. oe_python_template_example-0.2.5/docs/source/reference.rst +0 -5
  61. oe_python_template_example-0.2.5/docs/source/release-notes.rst +0 -4
  62. oe_python_template_example-0.2.5/docs/source/security.rst +0 -1
  63. oe_python_template_example-0.2.5/examples/__init__.py +0 -1
  64. oe_python_template_example-0.2.5/examples/notebook.ipynb +0 -46
  65. oe_python_template_example-0.2.5/examples/notebook.py +0 -18
  66. oe_python_template_example-0.2.5/examples/script.py +0 -13
  67. oe_python_template_example-0.2.5/examples/streamlit.py +0 -30
  68. oe_python_template_example-0.2.5/git-cliff-2.7.0/CHANGELOG.md +0 -1513
  69. oe_python_template_example-0.2.5/git-cliff-2.7.0/LICENSE-APACHE +0 -176
  70. oe_python_template_example-0.2.5/git-cliff-2.7.0/LICENSE-MIT +0 -22
  71. oe_python_template_example-0.2.5/git-cliff-2.7.0/README.md +0 -95
  72. oe_python_template_example-0.2.5/git-cliff-2.7.0/completions/_git-cliff +0 -86
  73. oe_python_template_example-0.2.5/git-cliff-2.7.0/completions/_git-cliff.ps1 +0 -84
  74. oe_python_template_example-0.2.5/git-cliff-2.7.0/completions/git-cliff.bash +0 -190
  75. oe_python_template_example-0.2.5/git-cliff-2.7.0/completions/git-cliff.elv +0 -78
  76. oe_python_template_example-0.2.5/git-cliff-2.7.0/completions/git-cliff.fish +0 -39
  77. oe_python_template_example-0.2.5/git-cliff-2.7.0/git-cliff-completions +0 -0
  78. oe_python_template_example-0.2.5/git-cliff-2.7.0/git-cliff-mangen +0 -0
  79. oe_python_template_example-0.2.5/git-cliff-2.7.0/man/git-cliff.1 +0 -214
  80. oe_python_template_example-0.2.5/git-cliff-2.7.0-x86_64-unknown-linux-gnu.tar.gz +0 -0
  81. oe_python_template_example-0.2.5/github-action-run +0 -5
  82. oe_python_template_example-0.2.5/logo.png +0 -0
  83. oe_python_template_example-0.2.5/n +0 -28
  84. oe_python_template_example-0.2.5/noxfile.py +0 -235
  85. oe_python_template_example-0.2.5/renovate.json +0 -9
  86. oe_python_template_example-0.2.5/reports/.keep +0 -0
  87. oe_python_template_example-0.2.5/sonar-project.properties +0 -12
  88. oe_python_template_example-0.2.5/tests/__init__.py +0 -1
  89. oe_python_template_example-0.2.5/tests/api_test.py +0 -132
  90. oe_python_template_example-0.2.5/tests/cli_test.py +0 -86
  91. oe_python_template_example-0.2.5/tests/fixtures/.keep +0 -0
  92. oe_python_template_example-0.2.5/uv.lock +0 -4296
  93. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/.gitignore +0 -0
  94. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/LICENSE +0 -0
  95. {oe_python_template_example-0.2.5 → oe_python_template_example-0.2.7}/src/oe_python_template_example/constants.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oe-python-template-example
3
- Version: 0.2.5
3
+ Version: 0.2.7
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/
@@ -104,48 +104,130 @@ Description-Content-Type: text/markdown
104
104
  ---
105
105
 
106
106
 
107
- Example project scaffolded and kept up to date with OE Python Template
108
- (oe-python-template).
107
+ Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
109
108
 
110
- Use Cases:
109
+ ### Scaffolding
110
+
111
+ This [Copier](https://copier.readthedocs.io/en/stable/) template enables you to quickly generate (scaffold) a Python package with fully functioning build and test automation:
112
+
113
+ 1. Projects generated from this template can be [easily updated](https://copier.readthedocs.io/en/stable/updating/) to benefit from improvements and new features of the template.
114
+ 2. During project generation, you can flexibly configure naming of the Python distribution, import package, main author, GitHub repository, organization, and many other aspects to match your specific requirements (see [copier.yml](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template/blob/main/copier.yml) for all available options).
115
+
116
+ ### Development Infrastructure
117
+
118
+ Projects generated with this template come with a comprehensive development toolchain and quality assurance framework that supports the entire software development lifecycle - from coding and testing to documentation, release management, and compliance auditing. This infrastructure automates routine tasks, enforces code quality standards, and streamlines the path to production:
119
+
120
+ 1. Linting with [Ruff](https://github.com/astral-sh/ruff)
121
+ 2. Static type checking with [mypy](https://mypy.readthedocs.io/en/stable/)
122
+ 3. Complete set of [pre-commit](https://pre-commit.com/) hooks including [detect-secrets](https://github.com/Yelp/detect-secrets) and [pygrep](https://github.com/pre-commit/pygrep-hooks)
123
+ 4. Unit and E2E testing with [pytest](https://docs.pytest.org/en/stable/) including parallel test execution
124
+ 5. Matrix testing in multiple environments with [nox](https://nox.thea.codes/en/stable/)
125
+ 6. Test coverage reported with [Codecov](https://codecov.io/) and published as release artifact
126
+ 7. CI/CD pipeline automated with [GitHub Actions](https://github.com/features/actions)
127
+ 8. CI/CD pipeline can be run locally with [act](https://github.com/nektos/act)
128
+ 9. Code quality and security checks with [SonarQube](https://www.sonarsource.com/products/sonarcloud) and [GitHub CodeQL](https://codeql.github.com/)
129
+ 10. Dependency monitoring with [pip-audit](https://pypi.org/project/pip-audit/), [Renovate](https://github.com/renovatebot/renovate), and [GitHub Dependabot](https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide)
130
+ 11. Licenses of dependencies extracted with [pip-licenses](https://pypi.org/project/pip-licenses/) and published as release artifacts in CSV and JSON format for compliance checks
131
+ 12. Software Bill of Materials (SBOM) generated with [cyclonedx-python](https://github.com/CycloneDX/cyclonedx-python) and published as release artifact
132
+ 13. Version and release management with [bump-my-version](https://callowayproject.github.io/bump-my-version/)
133
+ 14. Changelog and release notes generated with [git-cliff](https://git-cliff.org/)
134
+ 15. Documentation generated with [Sphinx](https://www.sphinx-doc.org/en/master/) including reference documentation and PDF export
135
+ 16. Documentation published to [Read The Docs](https://readthedocs.org/)
136
+ 17. Interactive OpenAPI specification with [Swagger](https://swagger.io/)
137
+ 18. Python package published to [PyPI](https://pypi.org/)
138
+ 19. 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)
139
+ 20. One-click development environments with [Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) and [GitHub Codespaces](https://github.com/features/codespaces)
140
+ 21. Settings for use with [VSCode](https://code.visualstudio.com/)
141
+ 22. Settings and custom instructions for use with [GitHub Copilot](https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot)
142
+
143
+ ### Application Features
144
+
145
+ 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:
146
+
147
+ 1. Service architecture suitable for use as shared library
148
+ 2. Validation with [pydantic](https://docs.pydantic.dev/)
149
+ 3. Command-line interface (CLI) with [Typer](https://typer.tiangolo.com/)
150
+ 4. Versioned Web API with [FastAPI](https://fastapi.tiangolo.com/)
151
+ 5. [Interactive Jupyter notebook](https://jupyter.org/) and [reactive Marimo notebook](https://marimo.io/)
152
+ 6. Simple Web UI with [Streamlit](https://streamlit.io/)
153
+ 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/)
154
+ 8. Documentation including badges, setup instructions, contribution guide and security policy
155
+
156
+ Explore [here](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example) for what's generated out of the box.
157
+
158
+ ## Generate a new project
159
+
160
+ To generate, build and release a fully functioning project in a few minutes, follow these 5 steps:
161
+
162
+ **Step 1**: Execute the following command to install or update tooling.
163
+ ```shell
164
+ # Install Homebrew, uv package manager, copier and further dev tools
165
+ curl -LsSf https://raw.githubusercontent.com/helmut-hoffer-von-ankershoffen/oe-python-template/HEAD/install.sh | sh
166
+ ```
167
+
168
+ **Step 2**: [Create a repository on GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository), clone to your local machine, and change into it's directory.
169
+
170
+ **Step 3**: Execute the following command to generate a new project based on this template.
171
+ ```shell
172
+ # Ensure to stand in your freshly created git repository before executing this command
173
+ copier copy --trust gh:helmut-hoffer-von-ankershoffen/oe-python-template .
174
+ ```
175
+
176
+ **Step 4**: Execute the following commands to push your initial commit to GitHub.
177
+ ```shell
178
+ git add .
179
+ git commit -m "chore: Initial commit"
180
+ git push
181
+ ```
182
+
183
+ Check the [Actions tab](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/actions) of your GitHub repository: The CI/CD workflow of your project is already running!
184
+
185
+ The workflow will fail at the SonarQube step, as this external service is not yet configured for our new repository. We will configure SonarQube and other services in the next step!
186
+
187
+ Notes:
188
+ 1. Check out [this manual](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key) on how to set up signed commits
189
+
190
+ **Step 5**: Follow the [instructions](SERVICE_CONNECTIONS.md) to wire up
191
+ external services such as CloudCov, SonarQube Cloud, Read The Docs, Docker.io, and Streamlit Community Cloud.
192
+
193
+ **Step 6**: Release the first version of your project
194
+ ```shell
195
+ make bump
196
+ ```
197
+ Notes:
198
+ 1. You can remove the above sections - from "Scaffolding" to this notes - post having successfully generated your project.
199
+ 2. The following sections refer to the dummy application and service generated into the `tests` and `src` folder by this template.
200
+ Use the documentation and code as inspiration, adapt to your business logic, or remove and start documenting and coding from scratch.
111
201
 
112
- 1. Dummy CLI application and service demonstrating example usage of the
113
- directory structure and build pipeline generated by oe-python-template
114
202
 
115
203
  ## Overview
116
204
 
117
- Adding OE Python Template Example to your project as a dependency is easy.
205
+ Adding OE Python Template Example to your project as a dependency is easy. See below for usage examples.
118
206
 
119
207
  ```shell
120
208
  uv add oe-python-template-example # add dependency to your project
121
209
  ```
122
210
 
123
- If you don't have uv installed follow
124
- [these instructions](https://docs.astral.sh/uv/getting-started/installation/).
125
- If you still prefer pip over the modern and fast package manager
126
- [uv](https://github.com/astral-sh/uv), you can install the library like this:
211
+ If you don't have uv installed follow [these instructions](https://docs.astral.sh/uv/getting-started/installation/). If you still prefer pip over the modern and fast package manager [uv](https://github.com/astral-sh/uv), you can install the library like this:
212
+
127
213
 
128
214
  ```shell
129
215
  pip install oe-python-template-example # add dependency to your project
130
216
  ```
131
217
 
132
- Executing the command line interface (CLI) in an isolated Python environment is
133
- just as easy:
218
+ Executing the command line interface (CLI) in an isolated Python environment is just as easy:
134
219
 
135
220
  ```shell
136
- uvx oe-python-template-example hello-world # prints "Hello, world! [..]"
137
- uvx oe-python-template-example serve # serves webservice API
138
- uvx oe-python-template-example serve --port=4711 # serves webservice API on port 4711
221
+ uvx oe-python-template-example hello-world # prints "Hello, world! [..]"
222
+ uvx oe-python-template-example serve # serves web API
223
+ uvx oe-python-template-example serve --port=4711 # serves web API on port 4711
139
224
  ```
140
225
 
141
226
  Notes:
227
+ 1. The API is versioned, mounted at `/api/v1` resp. `/api/v2`
228
+ 2. While serving the web 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.
229
+ 3. Interactive documentation is provided at [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
142
230
 
143
- - The API is versioned, mounted at `/api/v1` resp. `/api/v2`
144
- - While serving the webservice API go to
145
- [http://127.0.0.1:8000/api/v1/hello-world](http://127.0.0.1:8000/api/v1/hello-world)
146
- to see the respons of the `hello-world` operation.
147
- - Interactive documentation is provided at
148
- [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
149
231
 
150
232
  The CLI provides extensive help:
151
233
 
@@ -157,48 +239,31 @@ uvx oe-python-template-example openapi --help
157
239
  uvx oe-python-template-example serve --help
158
240
  ```
159
241
 
242
+
160
243
  ## Operational Excellence
161
244
 
162
- This project is designed with operational excellence in mind, using modern
163
- Python tooling and practices. It includes:
164
-
165
- - Various examples demonstrating usage:
166
- - [Simple Python script](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/script.py)
167
- - [Streamlit web application](https://oe-python-template-example.streamlit.app/)
168
- deployed on [Streamlit Community Cloud](https://streamlit.io/cloud)
169
- - [Jupyter](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.ipynb)
170
- and
171
- [Marimo](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.py)
172
- notebook
173
- - [Complete reference documentation](https://oe-python-template-example.readthedocs.io/en/latest/reference.html)
174
- on Read the Docs
175
- - [Transparent test coverage](https://app.codecov.io/gh/helmut-hoffer-von-ankershoffen/oe-python-template-example)
176
- including unit and E2E tests (reported on Codecov)
177
- - Matrix tested with
178
- [multiple python versions](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/noxfile.py)
179
- to ensure compatibility (powered by [Nox](https://nox.thea.codes/en/stable/))
180
- - Compliant with modern linting and formatting standards (powered by
181
- [Ruff](https://github.com/astral-sh/ruff))
182
- - Up-to-date dependencies (monitored by
183
- [Renovate](https://github.com/renovatebot/renovate) and
184
- [GitHub Dependabot](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/dependabot))
185
- - [A-grade code quality](https://sonarcloud.io/summary/new_code?id=helmut-hoffer-von-ankershoffen_oe-python-template-example)
186
- in security, maintainability, and reliability with low technical debt and
187
- codesmell (verified by SonarQube)
188
- - Additional code security checks using
189
- [GitHub CodeQL](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/code-scanning)
190
- - [Security Policy](SECURITY.md)
191
- - [License](LICENSE) compliant with the Open Source Initiative (OSI)
192
- - 1-liner for installation and execution of command line interface (CLI) via
193
- [uv(x)](https://github.com/astral-sh/uv) or
194
- [Docker](https://hub.docker.com/r/helmuthva/oe-python-template-example/tags)
195
- - Setup for developing inside a
196
- [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers)
197
- included (supports VSCode and GitHub Codespaces)
245
+ This project is designed with operational excellence in mind, using modern Python tooling and practices. It includes:
246
+
247
+ 1. Various examples demonstrating usage:
248
+ a. [Simple Python script](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/script.py)
249
+ b. [Streamlit web application](https://oe-python-template-example.streamlit.app/) deployed on [Streamlit Community Cloud](https://streamlit.io/cloud)
250
+ c. [Jupyter](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.ipynb) and [Marimo](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.py) notebook
251
+ 2. [Complete reference documentation](https://oe-python-template-example.readthedocs.io/en/latest/reference.html) on Read the Docs
252
+ 3. [Transparent test coverage](https://app.codecov.io/gh/helmut-hoffer-von-ankershoffen/oe-python-template-example) including unit and E2E tests (reported on Codecov)
253
+ 4. Matrix tested with [multiple python versions](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/noxfile.py) to ensure compatibility (powered by [Nox](https://nox.thea.codes/en/stable/))
254
+ 5. Compliant with modern linting and formatting standards (powered by [Ruff](https://github.com/astral-sh/ruff))
255
+ 6. Up-to-date dependencies (monitored by [Renovate](https://github.com/renovatebot/renovate) and [Dependabot](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/dependabot))
256
+ 7. [A-grade code quality](https://sonarcloud.io/summary/new_code?id=helmut-hoffer-von-ankershoffen_oe-python-template-example) in security, maintainability, and reliability with low technical debt and codesmell (verified by SonarQube)
257
+ 8. Additional code security checks using [CodeQL](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/code-scanning)
258
+ 9. [Security Policy](SECURITY.md)
259
+ 10. [License](LICENSE) compliant with the Open Source Initiative (OSI)
260
+ 11. 1-liner for installation and execution of command line interface (CLI) via [uv(x)](https://github.com/astral-sh/uv) or [Docker](https://hub.docker.com/r/helmuthva/oe-python-template-example/tags)
261
+ 12. Setup for developing inside a [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) included (supports VSCode and GitHub Codespaces)
262
+
198
263
 
199
264
  ## Usage Examples
200
265
 
201
- The following examples run from source. Clone this repository first using
266
+ The following examples run from source - clone this repository using
202
267
  `git clone git@github.com:helmut-hoffer-von-ankershoffen/oe-python-template-example.git`.
203
268
 
204
269
  ### Minimal Python Script:
@@ -346,11 +411,30 @@ docker compose run oe-python-template-example echo "Lorem"
346
411
  docker compose run oe-python-template-example echo "Lorem" --json
347
412
  docker compose run oe-python-template-example openapi
348
413
  docker compose run oe-python-template-example openapi --output-format=json
349
- docker compose up
414
+ echo "Running OE Python Template Example's API container as a daemon ..."
415
+ docker compose up -d
416
+ echo "Waiting for the API server to start ..."
417
+ sleep 5
418
+ echo "Checking health of v1 API ..."
419
+ curl http://127.0.0.1:8000/api/v1/healthz
420
+ echo ""
421
+ echo "Saying hello world with v1 API ..."
350
422
  curl http://127.0.0.1:8000/api/v1/hello-world
423
+ echo ""
424
+ echo "Swagger docs of v1 API ..."
351
425
  curl http://127.0.0.1:8000/api/v1/docs
426
+ echo ""
427
+ echo "Checking health of v2 API ..."
428
+ curl http://127.0.0.1:8000/api/v2/healthz
429
+ echo ""
430
+ echo "Saying hello world with v1 API ..."
352
431
  curl http://127.0.0.1:8000/api/v2/hello-world
432
+ echo ""
433
+ echo "Swagger docs of v2 API ..."
353
434
  curl http://127.0.0.1:8000/api/v2/docs
435
+ echo ""
436
+ echo "Shutting down the API container ..."
437
+ docker compose down
354
438
  ```
355
439
 
356
440
  ## Extra: Lorem Ipsum
@@ -43,48 +43,130 @@
43
43
  ---
44
44
 
45
45
 
46
- Example project scaffolded and kept up to date with OE Python Template
47
- (oe-python-template).
46
+ Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
47
+
48
+ ### Scaffolding
49
+
50
+ This [Copier](https://copier.readthedocs.io/en/stable/) template enables you to quickly generate (scaffold) a Python package with fully functioning build and test automation:
51
+
52
+ 1. Projects generated from this template can be [easily updated](https://copier.readthedocs.io/en/stable/updating/) to benefit from improvements and new features of the template.
53
+ 2. During project generation, you can flexibly configure naming of the Python distribution, import package, main author, GitHub repository, organization, and many other aspects to match your specific requirements (see [copier.yml](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template/blob/main/copier.yml) for all available options).
54
+
55
+ ### Development Infrastructure
56
+
57
+ Projects generated with this template come with a comprehensive development toolchain and quality assurance framework that supports the entire software development lifecycle - from coding and testing to documentation, release management, and compliance auditing. This infrastructure automates routine tasks, enforces code quality standards, and streamlines the path to production:
58
+
59
+ 1. Linting with [Ruff](https://github.com/astral-sh/ruff)
60
+ 2. Static type checking with [mypy](https://mypy.readthedocs.io/en/stable/)
61
+ 3. Complete set of [pre-commit](https://pre-commit.com/) hooks including [detect-secrets](https://github.com/Yelp/detect-secrets) and [pygrep](https://github.com/pre-commit/pygrep-hooks)
62
+ 4. Unit and E2E testing with [pytest](https://docs.pytest.org/en/stable/) including parallel test execution
63
+ 5. Matrix testing in multiple environments with [nox](https://nox.thea.codes/en/stable/)
64
+ 6. Test coverage reported with [Codecov](https://codecov.io/) and published as release artifact
65
+ 7. CI/CD pipeline automated with [GitHub Actions](https://github.com/features/actions)
66
+ 8. CI/CD pipeline can be run locally with [act](https://github.com/nektos/act)
67
+ 9. Code quality and security checks with [SonarQube](https://www.sonarsource.com/products/sonarcloud) and [GitHub CodeQL](https://codeql.github.com/)
68
+ 10. Dependency monitoring with [pip-audit](https://pypi.org/project/pip-audit/), [Renovate](https://github.com/renovatebot/renovate), and [GitHub Dependabot](https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide)
69
+ 11. Licenses of dependencies extracted with [pip-licenses](https://pypi.org/project/pip-licenses/) and published as release artifacts in CSV and JSON format for compliance checks
70
+ 12. Software Bill of Materials (SBOM) generated with [cyclonedx-python](https://github.com/CycloneDX/cyclonedx-python) and published as release artifact
71
+ 13. Version and release management with [bump-my-version](https://callowayproject.github.io/bump-my-version/)
72
+ 14. Changelog and release notes generated with [git-cliff](https://git-cliff.org/)
73
+ 15. Documentation generated with [Sphinx](https://www.sphinx-doc.org/en/master/) including reference documentation and PDF export
74
+ 16. Documentation published to [Read The Docs](https://readthedocs.org/)
75
+ 17. Interactive OpenAPI specification with [Swagger](https://swagger.io/)
76
+ 18. Python package published to [PyPI](https://pypi.org/)
77
+ 19. 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)
78
+ 20. One-click development environments with [Dev Containers](https://code.visualstudio.com/docs/devcontainers/containers) and [GitHub Codespaces](https://github.com/features/codespaces)
79
+ 21. Settings for use with [VSCode](https://code.visualstudio.com/)
80
+ 22. Settings and custom instructions for use with [GitHub Copilot](https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot)
81
+
82
+ ### Application Features
83
+
84
+ 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:
85
+
86
+ 1. Service architecture suitable for use as shared library
87
+ 2. Validation with [pydantic](https://docs.pydantic.dev/)
88
+ 3. Command-line interface (CLI) with [Typer](https://typer.tiangolo.com/)
89
+ 4. Versioned Web API with [FastAPI](https://fastapi.tiangolo.com/)
90
+ 5. [Interactive Jupyter notebook](https://jupyter.org/) and [reactive Marimo notebook](https://marimo.io/)
91
+ 6. Simple Web UI with [Streamlit](https://streamlit.io/)
92
+ 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/)
93
+ 8. Documentation including badges, setup instructions, contribution guide and security policy
94
+
95
+ Explore [here](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example) for what's generated out of the box.
96
+
97
+ ## Generate a new project
98
+
99
+ To generate, build and release a fully functioning project in a few minutes, follow these 5 steps:
100
+
101
+ **Step 1**: Execute the following command to install or update tooling.
102
+ ```shell
103
+ # Install Homebrew, uv package manager, copier and further dev tools
104
+ curl -LsSf https://raw.githubusercontent.com/helmut-hoffer-von-ankershoffen/oe-python-template/HEAD/install.sh | sh
105
+ ```
106
+
107
+ **Step 2**: [Create a repository on GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository), clone to your local machine, and change into it's directory.
108
+
109
+ **Step 3**: Execute the following command to generate a new project based on this template.
110
+ ```shell
111
+ # Ensure to stand in your freshly created git repository before executing this command
112
+ copier copy --trust gh:helmut-hoffer-von-ankershoffen/oe-python-template .
113
+ ```
114
+
115
+ **Step 4**: Execute the following commands to push your initial commit to GitHub.
116
+ ```shell
117
+ git add .
118
+ git commit -m "chore: Initial commit"
119
+ git push
120
+ ```
121
+
122
+ Check the [Actions tab](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/actions) of your GitHub repository: The CI/CD workflow of your project is already running!
48
123
 
49
- Use Cases:
124
+ The workflow will fail at the SonarQube step, as this external service is not yet configured for our new repository. We will configure SonarQube and other services in the next step!
125
+
126
+ Notes:
127
+ 1. Check out [this manual](https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key) on how to set up signed commits
128
+
129
+ **Step 5**: Follow the [instructions](SERVICE_CONNECTIONS.md) to wire up
130
+ external services such as CloudCov, SonarQube Cloud, Read The Docs, Docker.io, and Streamlit Community Cloud.
131
+
132
+ **Step 6**: Release the first version of your project
133
+ ```shell
134
+ make bump
135
+ ```
136
+ Notes:
137
+ 1. You can remove the above sections - from "Scaffolding" to this notes - post having successfully generated your project.
138
+ 2. The following sections refer to the dummy application and service generated into the `tests` and `src` folder by this template.
139
+ Use the documentation and code as inspiration, adapt to your business logic, or remove and start documenting and coding from scratch.
50
140
 
51
- 1. Dummy CLI application and service demonstrating example usage of the
52
- directory structure and build pipeline generated by oe-python-template
53
141
 
54
142
  ## Overview
55
143
 
56
- Adding OE Python Template Example to your project as a dependency is easy.
144
+ Adding OE Python Template Example to your project as a dependency is easy. See below for usage examples.
57
145
 
58
146
  ```shell
59
147
  uv add oe-python-template-example # add dependency to your project
60
148
  ```
61
149
 
62
- If you don't have uv installed follow
63
- [these instructions](https://docs.astral.sh/uv/getting-started/installation/).
64
- If you still prefer pip over the modern and fast package manager
65
- [uv](https://github.com/astral-sh/uv), you can install the library like this:
150
+ If you don't have uv installed follow [these instructions](https://docs.astral.sh/uv/getting-started/installation/). If you still prefer pip over the modern and fast package manager [uv](https://github.com/astral-sh/uv), you can install the library like this:
151
+
66
152
 
67
153
  ```shell
68
154
  pip install oe-python-template-example # add dependency to your project
69
155
  ```
70
156
 
71
- Executing the command line interface (CLI) in an isolated Python environment is
72
- just as easy:
157
+ Executing the command line interface (CLI) in an isolated Python environment is just as easy:
73
158
 
74
159
  ```shell
75
- uvx oe-python-template-example hello-world # prints "Hello, world! [..]"
76
- uvx oe-python-template-example serve # serves webservice API
77
- uvx oe-python-template-example serve --port=4711 # serves webservice API on port 4711
160
+ uvx oe-python-template-example hello-world # prints "Hello, world! [..]"
161
+ uvx oe-python-template-example serve # serves web API
162
+ uvx oe-python-template-example serve --port=4711 # serves web API on port 4711
78
163
  ```
79
164
 
80
165
  Notes:
166
+ 1. The API is versioned, mounted at `/api/v1` resp. `/api/v2`
167
+ 2. While serving the web 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.
168
+ 3. Interactive documentation is provided at [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
81
169
 
82
- - The API is versioned, mounted at `/api/v1` resp. `/api/v2`
83
- - While serving the webservice API go to
84
- [http://127.0.0.1:8000/api/v1/hello-world](http://127.0.0.1:8000/api/v1/hello-world)
85
- to see the respons of the `hello-world` operation.
86
- - Interactive documentation is provided at
87
- [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
88
170
 
89
171
  The CLI provides extensive help:
90
172
 
@@ -96,48 +178,31 @@ uvx oe-python-template-example openapi --help
96
178
  uvx oe-python-template-example serve --help
97
179
  ```
98
180
 
181
+
99
182
  ## Operational Excellence
100
183
 
101
- This project is designed with operational excellence in mind, using modern
102
- Python tooling and practices. It includes:
103
-
104
- - Various examples demonstrating usage:
105
- - [Simple Python script](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/script.py)
106
- - [Streamlit web application](https://oe-python-template-example.streamlit.app/)
107
- deployed on [Streamlit Community Cloud](https://streamlit.io/cloud)
108
- - [Jupyter](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.ipynb)
109
- and
110
- [Marimo](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.py)
111
- notebook
112
- - [Complete reference documentation](https://oe-python-template-example.readthedocs.io/en/latest/reference.html)
113
- on Read the Docs
114
- - [Transparent test coverage](https://app.codecov.io/gh/helmut-hoffer-von-ankershoffen/oe-python-template-example)
115
- including unit and E2E tests (reported on Codecov)
116
- - Matrix tested with
117
- [multiple python versions](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/noxfile.py)
118
- to ensure compatibility (powered by [Nox](https://nox.thea.codes/en/stable/))
119
- - Compliant with modern linting and formatting standards (powered by
120
- [Ruff](https://github.com/astral-sh/ruff))
121
- - Up-to-date dependencies (monitored by
122
- [Renovate](https://github.com/renovatebot/renovate) and
123
- [GitHub Dependabot](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/dependabot))
124
- - [A-grade code quality](https://sonarcloud.io/summary/new_code?id=helmut-hoffer-von-ankershoffen_oe-python-template-example)
125
- in security, maintainability, and reliability with low technical debt and
126
- codesmell (verified by SonarQube)
127
- - Additional code security checks using
128
- [GitHub CodeQL](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/code-scanning)
129
- - [Security Policy](SECURITY.md)
130
- - [License](LICENSE) compliant with the Open Source Initiative (OSI)
131
- - 1-liner for installation and execution of command line interface (CLI) via
132
- [uv(x)](https://github.com/astral-sh/uv) or
133
- [Docker](https://hub.docker.com/r/helmuthva/oe-python-template-example/tags)
134
- - Setup for developing inside a
135
- [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers)
136
- included (supports VSCode and GitHub Codespaces)
184
+ This project is designed with operational excellence in mind, using modern Python tooling and practices. It includes:
185
+
186
+ 1. Various examples demonstrating usage:
187
+ a. [Simple Python script](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/script.py)
188
+ b. [Streamlit web application](https://oe-python-template-example.streamlit.app/) deployed on [Streamlit Community Cloud](https://streamlit.io/cloud)
189
+ c. [Jupyter](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.ipynb) and [Marimo](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/examples/notebook.py) notebook
190
+ 2. [Complete reference documentation](https://oe-python-template-example.readthedocs.io/en/latest/reference.html) on Read the Docs
191
+ 3. [Transparent test coverage](https://app.codecov.io/gh/helmut-hoffer-von-ankershoffen/oe-python-template-example) including unit and E2E tests (reported on Codecov)
192
+ 4. Matrix tested with [multiple python versions](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/blob/main/noxfile.py) to ensure compatibility (powered by [Nox](https://nox.thea.codes/en/stable/))
193
+ 5. Compliant with modern linting and formatting standards (powered by [Ruff](https://github.com/astral-sh/ruff))
194
+ 6. Up-to-date dependencies (monitored by [Renovate](https://github.com/renovatebot/renovate) and [Dependabot](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/dependabot))
195
+ 7. [A-grade code quality](https://sonarcloud.io/summary/new_code?id=helmut-hoffer-von-ankershoffen_oe-python-template-example) in security, maintainability, and reliability with low technical debt and codesmell (verified by SonarQube)
196
+ 8. Additional code security checks using [CodeQL](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/security/code-scanning)
197
+ 9. [Security Policy](SECURITY.md)
198
+ 10. [License](LICENSE) compliant with the Open Source Initiative (OSI)
199
+ 11. 1-liner for installation and execution of command line interface (CLI) via [uv(x)](https://github.com/astral-sh/uv) or [Docker](https://hub.docker.com/r/helmuthva/oe-python-template-example/tags)
200
+ 12. Setup for developing inside a [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) included (supports VSCode and GitHub Codespaces)
201
+
137
202
 
138
203
  ## Usage Examples
139
204
 
140
- The following examples run from source. Clone this repository first using
205
+ The following examples run from source - clone this repository using
141
206
  `git clone git@github.com:helmut-hoffer-von-ankershoffen/oe-python-template-example.git`.
142
207
 
143
208
  ### Minimal Python Script:
@@ -285,11 +350,30 @@ docker compose run oe-python-template-example echo "Lorem"
285
350
  docker compose run oe-python-template-example echo "Lorem" --json
286
351
  docker compose run oe-python-template-example openapi
287
352
  docker compose run oe-python-template-example openapi --output-format=json
288
- docker compose up
353
+ echo "Running OE Python Template Example's API container as a daemon ..."
354
+ docker compose up -d
355
+ echo "Waiting for the API server to start ..."
356
+ sleep 5
357
+ echo "Checking health of v1 API ..."
358
+ curl http://127.0.0.1:8000/api/v1/healthz
359
+ echo ""
360
+ echo "Saying hello world with v1 API ..."
289
361
  curl http://127.0.0.1:8000/api/v1/hello-world
362
+ echo ""
363
+ echo "Swagger docs of v1 API ..."
290
364
  curl http://127.0.0.1:8000/api/v1/docs
365
+ echo ""
366
+ echo "Checking health of v2 API ..."
367
+ curl http://127.0.0.1:8000/api/v2/healthz
368
+ echo ""
369
+ echo "Saying hello world with v1 API ..."
291
370
  curl http://127.0.0.1:8000/api/v2/hello-world
371
+ echo ""
372
+ echo "Swagger docs of v2 API ..."
292
373
  curl http://127.0.0.1:8000/api/v2/docs
374
+ echo ""
375
+ echo "Shutting down the API container ..."
376
+ docker compose down
293
377
  ```
294
378
 
295
379
  ## Extra: Lorem Ipsum
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "oe-python-template-example"
3
- version = "0.2.5"
3
+ version = "0.2.7"
4
4
  description = "🧠 Example project scaffolded and kept up to date with OE Python Template (oe-python-template)."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -79,9 +79,15 @@ Changelog = "https://github.com/helmut-hoffer-von-ankershoffen/oe-python-templat
79
79
  Issues = "https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/issues"
80
80
 
81
81
  [build-system]
82
- requires = ["hatchling"]
82
+ requires = ["hatchling==1.27.0"]
83
83
  build-backend = "hatchling.build"
84
84
 
85
+ [tool.hatch.build]
86
+ include = ["src/*"]
87
+
88
+ [tool.hatch.build.targets.wheel]
89
+ packages = ["src/oe_python_template_example"]
90
+
85
91
  [project.optional-dependencies]
86
92
  examples = [
87
93
  "streamlit>=1.43.2",
@@ -119,7 +125,6 @@ dev = [
119
125
  "sphinx-copybutton>=0.5.2",
120
126
  "sphinx-inline-tabs>=2023.4.21",
121
127
  "sphinx-mdinclude>=0.6.2",
122
- "sphinx-pydantic>=0.1.1",
123
128
  "sphinx-rtd-theme>=3.0.2",
124
129
  "sphinx_selective_exclude>=1.0.3",
125
130
  "sphinx-toolbox>=3.9.0",
@@ -130,6 +135,12 @@ dev = [
130
135
  "watchdog>=6.0.0",
131
136
  ]
132
137
 
138
+ [tool.uv]
139
+ override-dependencies = [ # https://github.com/astral-sh/uv/issues/4422
140
+ "rfc3987; sys_platform == 'never'", # GPLv3
141
+ ]
142
+
143
+
133
144
  [tool.ruff]
134
145
  target-version = "py311"
135
146
  preview = true
@@ -242,7 +253,7 @@ source = ["src/"]
242
253
 
243
254
 
244
255
  [tool.bumpversion]
245
- current_version = "0.2.5"
256
+ current_version = "0.2.7"
246
257
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
247
258
  serialize = ["{major}.{minor}.{patch}"]
248
259
  search = "{current_version}"
@@ -5,10 +5,15 @@ from .constants import (
5
5
  __project_path__,
6
6
  __version__,
7
7
  )
8
+ from .models import Echo, Health, HealthStatus, Utterance
8
9
  from .service import Service
9
10
 
10
11
  __all__ = [
12
+ "Echo",
13
+ "Health",
14
+ "HealthStatus",
11
15
  "Service",
16
+ "Utterance",
12
17
  "__project_name__",
13
18
  "__project_path__",
14
19
  "__version__",