oe-python-template-example 0.2.6__tar.gz → 0.2.8__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.
- {oe_python_template_example-0.2.6 → oe_python_template_example-0.2.8}/PKG-INFO +83 -60
- {oe_python_template_example-0.2.6 → oe_python_template_example-0.2.8}/README.md +79 -56
- {oe_python_template_example-0.2.6 → oe_python_template_example-0.2.8}/pyproject.toml +22 -10
- {oe_python_template_example-0.2.6 → oe_python_template_example-0.2.8}/src/oe_python_template_example/__init__.py +5 -0
- {oe_python_template_example-0.2.6 → oe_python_template_example-0.2.8}/src/oe_python_template_example/api.py +17 -75
- {oe_python_template_example-0.2.6 → oe_python_template_example-0.2.8}/src/oe_python_template_example/cli.py +23 -10
- oe_python_template_example-0.2.8/src/oe_python_template_example/models.py +44 -0
- oe_python_template_example-0.2.8/src/oe_python_template_example/service.py +69 -0
- oe_python_template_example-0.2.8/src/oe_python_template_example/settings.py +35 -0
- oe_python_template_example-0.2.6/.act-env-public +0 -1
- oe_python_template_example-0.2.6/.copier-answers.yml +0 -23
- oe_python_template_example-0.2.6/.devcontainer/Dockerfile +0 -7
- oe_python_template_example-0.2.6/.devcontainer/devcontainer.json +0 -51
- oe_python_template_example-0.2.6/.devcontainer/onCreateCommand +0 -9
- oe_python_template_example-0.2.6/.devcontainer/postAttachCommand +0 -4
- oe_python_template_example-0.2.6/.devcontainer/postCreateCommand +0 -4
- oe_python_template_example-0.2.6/.env.example +0 -1
- oe_python_template_example-0.2.6/.github/copilot-instructions.md +0 -5
- oe_python_template_example-0.2.6/.github/dependabot.yml +0 -13
- oe_python_template_example-0.2.6/.github/workflows/codeql.yml +0 -100
- oe_python_template_example-0.2.6/.github/workflows/docker-image-build-publish.yml +0 -93
- oe_python_template_example-0.2.6/.github/workflows/package-build-publish-release.yml +0 -63
- oe_python_template_example-0.2.6/.github/workflows/test-and-report.yml +0 -113
- oe_python_template_example-0.2.6/.pre-commit-config.yaml +0 -76
- oe_python_template_example-0.2.6/.python-version +0 -1
- oe_python_template_example-0.2.6/.readthedocs.yml +0 -36
- oe_python_template_example-0.2.6/.secrets.baseline +0 -127
- oe_python_template_example-0.2.6/.vscode/extensions.json +0 -27
- oe_python_template_example-0.2.6/.vscode/settings.json +0 -76
- oe_python_template_example-0.2.6/CHANGELOG.md +0 -67
- oe_python_template_example-0.2.6/CODEOWNERS +0 -3
- oe_python_template_example-0.2.6/CODE_STYLE.md +0 -284
- oe_python_template_example-0.2.6/CONTRIBUTING.md +0 -155
- oe_python_template_example-0.2.6/Dockerfile +0 -42
- oe_python_template_example-0.2.6/RELEASE_NOTES.md +0 -1
- oe_python_template_example-0.2.6/SECURITY.md +0 -59
- oe_python_template_example-0.2.6/SERVICE_CONNECTIONS.md +0 -85
- oe_python_template_example-0.2.6/VERSION +0 -1
- oe_python_template_example-0.2.6/bin/git-cliff +0 -0
- oe_python_template_example-0.2.6/codecov.yml +0 -11
- oe_python_template_example-0.2.6/compose.yaml +0 -35
- oe_python_template_example-0.2.6/docs/Makefile +0 -20
- oe_python_template_example-0.2.6/docs/make.bat +0 -35
- oe_python_template_example-0.2.6/docs/partials/README_footer.md +0 -15
- oe_python_template_example-0.2.6/docs/partials/README_header.md +0 -40
- oe_python_template_example-0.2.6/docs/partials/README_main.md +0 -313
- oe_python_template_example-0.2.6/docs/source/_static/.keep +0 -0
- oe_python_template_example-0.2.6/docs/source/_static/openapi.json +0 -262
- oe_python_template_example-0.2.6/docs/source/_static/openapi.yaml +0 -210
- oe_python_template_example-0.2.6/docs/source/_static/openapi_v1.json +0 -262
- oe_python_template_example-0.2.6/docs/source/_static/openapi_v1.yaml +0 -204
- oe_python_template_example-0.2.6/docs/source/_static/openapi_v2.json +0 -262
- oe_python_template_example-0.2.6/docs/source/_static/openapi_v2.yaml +0 -204
- oe_python_template_example-0.2.6/docs/source/api_v1.rst +0 -9
- oe_python_template_example-0.2.6/docs/source/api_v2.rst +0 -9
- oe_python_template_example-0.2.6/docs/source/code-style.rst +0 -1
- oe_python_template_example-0.2.6/docs/source/conf.py +0 -128
- oe_python_template_example-0.2.6/docs/source/contributing.rst +0 -1
- oe_python_template_example-0.2.6/docs/source/index.rst +0 -40
- oe_python_template_example-0.2.6/docs/source/main.rst +0 -1
- oe_python_template_example-0.2.6/docs/source/reference.rst +0 -5
- oe_python_template_example-0.2.6/docs/source/release-notes.rst +0 -4
- oe_python_template_example-0.2.6/docs/source/security.rst +0 -1
- oe_python_template_example-0.2.6/examples/__init__.py +0 -1
- oe_python_template_example-0.2.6/examples/notebook.ipynb +0 -46
- oe_python_template_example-0.2.6/examples/notebook.py +0 -18
- oe_python_template_example-0.2.6/examples/script.py +0 -13
- oe_python_template_example-0.2.6/examples/streamlit.py +0 -30
- oe_python_template_example-0.2.6/git-cliff-2.7.0/CHANGELOG.md +0 -1513
- oe_python_template_example-0.2.6/git-cliff-2.7.0/LICENSE-APACHE +0 -176
- oe_python_template_example-0.2.6/git-cliff-2.7.0/LICENSE-MIT +0 -22
- oe_python_template_example-0.2.6/git-cliff-2.7.0/README.md +0 -95
- oe_python_template_example-0.2.6/git-cliff-2.7.0/completions/_git-cliff +0 -86
- oe_python_template_example-0.2.6/git-cliff-2.7.0/completions/_git-cliff.ps1 +0 -84
- oe_python_template_example-0.2.6/git-cliff-2.7.0/completions/git-cliff.bash +0 -190
- oe_python_template_example-0.2.6/git-cliff-2.7.0/completions/git-cliff.elv +0 -78
- oe_python_template_example-0.2.6/git-cliff-2.7.0/completions/git-cliff.fish +0 -39
- oe_python_template_example-0.2.6/git-cliff-2.7.0/git-cliff-completions +0 -0
- oe_python_template_example-0.2.6/git-cliff-2.7.0/git-cliff-mangen +0 -0
- oe_python_template_example-0.2.6/git-cliff-2.7.0/man/git-cliff.1 +0 -214
- oe_python_template_example-0.2.6/git-cliff-2.7.0-x86_64-unknown-linux-gnu.tar.gz +0 -0
- oe_python_template_example-0.2.6/github-action-run +0 -5
- oe_python_template_example-0.2.6/logo.png +0 -0
- oe_python_template_example-0.2.6/n +0 -28
- oe_python_template_example-0.2.6/noxfile.py +0 -235
- oe_python_template_example-0.2.6/renovate.json +0 -9
- oe_python_template_example-0.2.6/reports/.keep +0 -0
- oe_python_template_example-0.2.6/sonar-project.properties +0 -12
- oe_python_template_example-0.2.6/src/oe_python_template_example/service.py +0 -35
- oe_python_template_example-0.2.6/tests/__init__.py +0 -1
- oe_python_template_example-0.2.6/tests/api_test.py +0 -132
- oe_python_template_example-0.2.6/tests/cli_test.py +0 -86
- oe_python_template_example-0.2.6/tests/fixtures/.keep +0 -0
- oe_python_template_example-0.2.6/uv.lock +0 -4296
- {oe_python_template_example-0.2.6 → oe_python_template_example-0.2.8}/.gitignore +0 -0
- {oe_python_template_example-0.2.6 → oe_python_template_example-0.2.8}/LICENSE +0 -0
- {oe_python_template_example-0.2.6 → oe_python_template_example-0.2.8}/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.
|
3
|
+
Version: 0.2.8
|
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/
|
@@ -48,14 +48,14 @@ Classifier: Programming Language :: Python :: 3.12
|
|
48
48
|
Classifier: Programming Language :: Python :: 3.13
|
49
49
|
Classifier: Typing :: Typed
|
50
50
|
Requires-Python: <4.0,>=3.11
|
51
|
-
Requires-Dist: fastapi[all,standard]>=0.115.
|
51
|
+
Requires-Dist: fastapi[all,standard]>=0.115.12
|
52
|
+
Requires-Dist: pydantic-settings>=2.8.1
|
52
53
|
Requires-Dist: pydantic>=2.10.6
|
53
|
-
Requires-Dist: python-dotenv>=1.0.1
|
54
54
|
Requires-Dist: typer>=0.15.1
|
55
55
|
Provides-Extra: examples
|
56
56
|
Requires-Dist: jinja2>=3.1.6; extra == 'examples'
|
57
57
|
Requires-Dist: jupyter>=1.1.1; extra == 'examples'
|
58
|
-
Requires-Dist: marimo>=0.11.
|
58
|
+
Requires-Dist: marimo>=0.11.26; extra == 'examples'
|
59
59
|
Requires-Dist: streamlit>=1.43.2; extra == 'examples'
|
60
60
|
Description-Content-Type: text/markdown
|
61
61
|
|
@@ -106,36 +106,44 @@ Description-Content-Type: text/markdown
|
|
106
106
|
|
107
107
|
Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
1.
|
114
|
-
2.
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
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
|
+
|
139
147
|
1. Service architecture suitable for use as shared library
|
140
148
|
2. Validation with [pydantic](https://docs.pydantic.dev/)
|
141
149
|
3. Command-line interface (CLI) with [Typer](https://typer.tiangolo.com/)
|
@@ -149,52 +157,48 @@ Explore [here](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-templ
|
|
149
157
|
|
150
158
|
## Generate a new project
|
151
159
|
|
152
|
-
|
153
|
-
To generate a new project, follow these steps:
|
160
|
+
To generate, build and release a fully functioning project in a few minutes, follow these 5 steps:
|
154
161
|
|
155
|
-
**Step 1**:
|
162
|
+
**Step 1**: Execute the following command to install or update tooling.
|
156
163
|
```shell
|
157
|
-
|
158
|
-
|
159
|
-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
160
|
-
fi
|
161
|
-
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then # Install dependencies for Linux
|
162
|
-
sudo apt-get update -y && sudo apt-get install curl -y # Install curl
|
163
|
-
fi
|
164
|
-
if ! command -v uvx &> /dev/null; then # Install uv package manager if not present
|
165
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
166
|
-
source $HOME/.local/bin/env
|
167
|
-
fi
|
168
|
-
uv tool install copier # Install copier as global tool
|
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
|
169
166
|
```
|
170
167
|
|
171
|
-
**Step 2**: [Create
|
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.
|
172
169
|
|
173
|
-
**Step 3**:
|
170
|
+
**Step 3**: Execute the following command to generate a new project based on this template.
|
174
171
|
```shell
|
172
|
+
# Ensure to stand in your freshly created git repository before executing this command
|
175
173
|
copier copy --trust gh:helmut-hoffer-von-ankershoffen/oe-python-template .
|
176
174
|
```
|
177
175
|
|
178
|
-
**Step 4**:
|
176
|
+
**Step 4**: Execute the following commands to push your initial commit to GitHub.
|
179
177
|
```shell
|
180
178
|
git add .
|
181
|
-
git commit -m "
|
179
|
+
git commit -m "chore: Initial commit"
|
182
180
|
git push
|
183
181
|
```
|
184
182
|
|
185
|
-
|
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
|
186
189
|
|
187
190
|
**Step 5**: Follow the [instructions](SERVICE_CONNECTIONS.md) to wire up
|
188
191
|
external services such as CloudCov, SonarQube Cloud, Read The Docs, Docker.io, and Streamlit Community Cloud.
|
189
192
|
|
190
|
-
**Step 6**: Release the first
|
193
|
+
**Step 6**: Release the first version of your project
|
191
194
|
```shell
|
192
|
-
|
195
|
+
make bump
|
193
196
|
```
|
194
197
|
Notes:
|
195
|
-
1. You can remove this
|
196
|
-
2. The following sections refer to the dummy application and service
|
197
|
-
Use
|
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.
|
201
|
+
|
198
202
|
|
199
203
|
## Overview
|
200
204
|
|
@@ -407,11 +411,30 @@ docker compose run oe-python-template-example echo "Lorem"
|
|
407
411
|
docker compose run oe-python-template-example echo "Lorem" --json
|
408
412
|
docker compose run oe-python-template-example openapi
|
409
413
|
docker compose run oe-python-template-example openapi --output-format=json
|
410
|
-
|
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 ..."
|
411
422
|
curl http://127.0.0.1:8000/api/v1/hello-world
|
423
|
+
echo ""
|
424
|
+
echo "Swagger docs of v1 API ..."
|
412
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 ..."
|
413
431
|
curl http://127.0.0.1:8000/api/v2/hello-world
|
432
|
+
echo ""
|
433
|
+
echo "Swagger docs of v2 API ..."
|
414
434
|
curl http://127.0.0.1:8000/api/v2/docs
|
435
|
+
echo ""
|
436
|
+
echo "Shutting down the API container ..."
|
437
|
+
docker compose down
|
415
438
|
```
|
416
439
|
|
417
440
|
## Extra: Lorem Ipsum
|
@@ -45,36 +45,44 @@
|
|
45
45
|
|
46
46
|
Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
1.
|
53
|
-
2.
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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
|
+
|
78
86
|
1. Service architecture suitable for use as shared library
|
79
87
|
2. Validation with [pydantic](https://docs.pydantic.dev/)
|
80
88
|
3. Command-line interface (CLI) with [Typer](https://typer.tiangolo.com/)
|
@@ -88,52 +96,48 @@ Explore [here](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-templ
|
|
88
96
|
|
89
97
|
## Generate a new project
|
90
98
|
|
91
|
-
|
92
|
-
To generate a new project, follow these steps:
|
99
|
+
To generate, build and release a fully functioning project in a few minutes, follow these 5 steps:
|
93
100
|
|
94
|
-
**Step 1**:
|
101
|
+
**Step 1**: Execute the following command to install or update tooling.
|
95
102
|
```shell
|
96
|
-
|
97
|
-
|
98
|
-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
99
|
-
fi
|
100
|
-
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then # Install dependencies for Linux
|
101
|
-
sudo apt-get update -y && sudo apt-get install curl -y # Install curl
|
102
|
-
fi
|
103
|
-
if ! command -v uvx &> /dev/null; then # Install uv package manager if not present
|
104
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
105
|
-
source $HOME/.local/bin/env
|
106
|
-
fi
|
107
|
-
uv tool install copier # Install copier as global tool
|
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
|
108
105
|
```
|
109
106
|
|
110
|
-
**Step 2**: [Create
|
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.
|
111
108
|
|
112
|
-
**Step 3**:
|
109
|
+
**Step 3**: Execute the following command to generate a new project based on this template.
|
113
110
|
```shell
|
111
|
+
# Ensure to stand in your freshly created git repository before executing this command
|
114
112
|
copier copy --trust gh:helmut-hoffer-von-ankershoffen/oe-python-template .
|
115
113
|
```
|
116
114
|
|
117
|
-
**Step 4**:
|
115
|
+
**Step 4**: Execute the following commands to push your initial commit to GitHub.
|
118
116
|
```shell
|
119
117
|
git add .
|
120
|
-
git commit -m "
|
118
|
+
git commit -m "chore: Initial commit"
|
121
119
|
git push
|
122
120
|
```
|
123
121
|
|
124
|
-
|
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!
|
123
|
+
|
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
|
125
128
|
|
126
129
|
**Step 5**: Follow the [instructions](SERVICE_CONNECTIONS.md) to wire up
|
127
130
|
external services such as CloudCov, SonarQube Cloud, Read The Docs, Docker.io, and Streamlit Community Cloud.
|
128
131
|
|
129
|
-
**Step 6**: Release the first
|
132
|
+
**Step 6**: Release the first version of your project
|
130
133
|
```shell
|
131
|
-
|
134
|
+
make bump
|
132
135
|
```
|
133
136
|
Notes:
|
134
|
-
1. You can remove this
|
135
|
-
2. The following sections refer to the dummy application and service
|
136
|
-
Use
|
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.
|
140
|
+
|
137
141
|
|
138
142
|
## Overview
|
139
143
|
|
@@ -346,11 +350,30 @@ docker compose run oe-python-template-example echo "Lorem"
|
|
346
350
|
docker compose run oe-python-template-example echo "Lorem" --json
|
347
351
|
docker compose run oe-python-template-example openapi
|
348
352
|
docker compose run oe-python-template-example openapi --output-format=json
|
349
|
-
|
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 ..."
|
350
361
|
curl http://127.0.0.1:8000/api/v1/hello-world
|
362
|
+
echo ""
|
363
|
+
echo "Swagger docs of v1 API ..."
|
351
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 ..."
|
352
370
|
curl http://127.0.0.1:8000/api/v2/hello-world
|
371
|
+
echo ""
|
372
|
+
echo "Swagger docs of v2 API ..."
|
353
373
|
curl http://127.0.0.1:8000/api/v2/docs
|
374
|
+
echo ""
|
375
|
+
echo "Shutting down the API container ..."
|
376
|
+
docker compose down
|
354
377
|
```
|
355
378
|
|
356
379
|
## Extra: Lorem Ipsum
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "oe-python-template-example"
|
3
|
-
version = "0.2.
|
3
|
+
version = "0.2.8"
|
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 = [
|
@@ -62,9 +62,9 @@ classifiers = [
|
|
62
62
|
requires-python = ">=3.11, <4.0"
|
63
63
|
|
64
64
|
dependencies = [
|
65
|
-
"fastapi[standard,all]>=0.115.
|
65
|
+
"fastapi[standard,all]>=0.115.12",
|
66
66
|
"pydantic>=2.10.6",
|
67
|
-
"
|
67
|
+
"pydantic-settings>=2.8.1",
|
68
68
|
"typer>=0.15.1",
|
69
69
|
]
|
70
70
|
|
@@ -79,13 +79,19 @@ 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",
|
88
|
-
"marimo>=0.11.
|
94
|
+
"marimo>=0.11.26",
|
89
95
|
"jupyter>=1.1.1",
|
90
96
|
"jinja2>=3.1.6",
|
91
97
|
]
|
@@ -93,7 +99,7 @@ examples = [
|
|
93
99
|
[dependency-groups]
|
94
100
|
dev = [
|
95
101
|
"autodoc-pydantic>=2.2.0",
|
96
|
-
"bump-my-version>=1.
|
102
|
+
"bump-my-version>=1.1.1",
|
97
103
|
"cyclonedx-py>=1.0.1",
|
98
104
|
"detect-secrets>=1.5.0",
|
99
105
|
"enum-tools>=0.12.0",
|
@@ -107,11 +113,12 @@ dev = [
|
|
107
113
|
"pre-commit>=4.1.0",
|
108
114
|
"pyright>=1.1.396",
|
109
115
|
"pytest>=8.3.5",
|
110
|
-
"pytest-asyncio>=0.
|
116
|
+
"pytest-asyncio>=0.26.0",
|
111
117
|
"pytest-cov>=6.0.0",
|
112
118
|
"pytest-docker>=3.2.0",
|
113
119
|
"pytest-env>=1.1.5",
|
114
120
|
"pytest-regressions>=2.7.0",
|
121
|
+
"pytest-subprocess>=1.5.3",
|
115
122
|
"pytest-xdist[psutil]>=3.6.1",
|
116
123
|
"ruff>=0.10.0",
|
117
124
|
"sphinx>=8.2.3",
|
@@ -119,7 +126,6 @@ dev = [
|
|
119
126
|
"sphinx-copybutton>=0.5.2",
|
120
127
|
"sphinx-inline-tabs>=2023.4.21",
|
121
128
|
"sphinx-mdinclude>=0.6.2",
|
122
|
-
"sphinx-pydantic>=0.1.1",
|
123
129
|
"sphinx-rtd-theme>=3.0.2",
|
124
130
|
"sphinx_selective_exclude>=1.0.3",
|
125
131
|
"sphinx-toolbox>=3.9.0",
|
@@ -130,6 +136,12 @@ dev = [
|
|
130
136
|
"watchdog>=6.0.0",
|
131
137
|
]
|
132
138
|
|
139
|
+
[tool.uv]
|
140
|
+
override-dependencies = [ # https://github.com/astral-sh/uv/issues/4422
|
141
|
+
"rfc3987; sys_platform == 'never'", # GPLv3
|
142
|
+
]
|
143
|
+
|
144
|
+
|
133
145
|
[tool.ruff]
|
134
146
|
target-version = "py311"
|
135
147
|
preview = true
|
@@ -197,7 +209,7 @@ docstring-code-format = true
|
|
197
209
|
[tool.ruff.lint.pydocstyle]
|
198
210
|
convention = "google"
|
199
211
|
|
200
|
-
[tool.mypy]
|
212
|
+
[tool.mypy] # https://mypy.readthedocs.io/en/latest/config_file.html
|
201
213
|
junit_xml = "reports/mypy_junit.xml"
|
202
214
|
plugins = "pydantic.mypy"
|
203
215
|
strict = true
|
@@ -242,7 +254,7 @@ source = ["src/"]
|
|
242
254
|
|
243
255
|
|
244
256
|
[tool.bumpversion]
|
245
|
-
current_version = "0.2.
|
257
|
+
current_version = "0.2.8"
|
246
258
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
247
259
|
serialize = ["{major}.{minor}.{patch}"]
|
248
260
|
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__",
|