oe-python-template-example 0.1.15__tar.gz → 0.1.17__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.1.15 → oe_python_template_example-0.1.17}/.copier-answers.yml +1 -1
- oe_python_template_example-0.1.17/.github/copilot-instructions.md +5 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.gitignore +1 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.vscode/settings.json +14 -8
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/CHANGELOG.md +1 -1
- oe_python_template_example-0.1.17/CODE-STYLE.md +298 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/CONTRIBUTING.md +2 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/PKG-INFO +10 -4
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/README.md +9 -3
- oe_python_template_example-0.1.17/RELEASE_NOTES.md +1 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/SECURITY.md +8 -0
- oe_python_template_example-0.1.17/VERSION +1 -0
- oe_python_template_example-0.1.15/_readme_main.md → oe_python_template_example-0.1.17/docs/partials/README_main.md +6 -3
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/conf.py +1 -1
- oe_python_template_example-0.1.17/docs/source/main.rst +2 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/noxfile.py +9 -4
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/pyproject.toml +2 -2
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/sonar-project.properties +1 -1
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/uv.lock +1 -1
- oe_python_template_example-0.1.15/RELEASE_NOTES.md +0 -8
- oe_python_template_example-0.1.15/VERSION +0 -1
- oe_python_template_example-0.1.15/docs/source/main.rst +0 -2
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.act-env-public +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.devcontainer/Dockerfile +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.devcontainer/devcontainer.json +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.devcontainer/onCreateCommand +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.devcontainer/postAttachCommand +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.devcontainer/postCreateCommand +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.env.example +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.github/dependabot.yml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.github/workflows/codeql.yml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.github/workflows/docker-image-build-publish.yml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.github/workflows/package-build-publish-release.yml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.github/workflows/test-and-report.yml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.pre-commit-config.yaml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.python-version +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.readthedocs.yml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.secrets.baseline +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.vscode/extensions.json +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/CODEOWNERS +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/Dockerfile +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/LICENSE +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/SERVICE_CONNECTIONS.md +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/bin/git-cliff +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/codecov.yml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/compose.yaml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/Makefile +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/make.bat +0 -0
- oe_python_template_example-0.1.15/_readme_footer.md → oe_python_template_example-0.1.17/docs/partials/README_footer.md +0 -0
- oe_python_template_example-0.1.15/_readme_header.md → oe_python_template_example-0.1.17/docs/partials/README_header.md +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/_static/.keep +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/_static/openapi.json +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/_static/openapi.yaml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/_static/openapi_v1.json +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/_static/openapi_v1.yaml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/_static/openapi_v2.json +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/_static/openapi_v2.yaml +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/api_v1.rst +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/api_v2.rst +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/contributing.rst +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/index.rst +2 -2
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/reference.rst +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/release-notes.rst +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/security.rst +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/examples/__init__.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/examples/notebook.ipynb +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/examples/notebook.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/examples/script.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/examples/streamlit.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/CHANGELOG.md +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/LICENSE-APACHE +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/LICENSE-MIT +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/README.md +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/completions/_git-cliff +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/completions/_git-cliff.ps1 +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/completions/git-cliff.bash +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/completions/git-cliff.elv +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/completions/git-cliff.fish +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/git-cliff-completions +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/git-cliff-mangen +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/man/git-cliff.1 +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0-x86_64-unknown-linux-gnu.tar.gz +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/github-action-run +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/logo.png +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/n +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/renovate.json +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/reports/.keep +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/src/oe_python_template_example/__init__.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/src/oe_python_template_example/api.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/src/oe_python_template_example/cli.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/src/oe_python_template_example/constants.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/src/oe_python_template_example/service.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/tests/__init__.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/tests/api_test.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/tests/cli_test.py +0 -0
- {oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/tests/fixtures/.keep +0 -0
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.vscode/settings.json
RENAMED
@@ -1,4 +1,7 @@
|
|
1
1
|
{
|
2
|
+
"[jsonc]": {
|
3
|
+
"editor.defaultFormatter": "vscode.json-language-features"
|
4
|
+
},
|
2
5
|
"files.exclude": {
|
3
6
|
"**/__pycache__ ": true
|
4
7
|
},
|
@@ -48,20 +51,23 @@
|
|
48
51
|
"markdown": true,
|
49
52
|
"scminput": true
|
50
53
|
},
|
51
|
-
"github.copilot.advanced": {
|
52
|
-
|
53
|
-
},
|
54
|
+
"github.copilot.advanced": {},
|
54
55
|
"github.copilot.chat.editor.temporalContext.enabled": true,
|
55
56
|
"github.copilot.chat.edits.codesearch.enabled": true,
|
56
57
|
"github.copilot.chat.edits.temporalContext.enabled": true,
|
57
|
-
"github.copilot.chat.
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
"github.copilot.chat.codeGeneration.instructions": [
|
59
|
+
{
|
60
|
+
"file": "CODE-STYLE.md"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"file": "CONTRIBUTING.md"
|
64
|
+
}
|
61
65
|
],
|
62
|
-
"github.copilot.chat.scopeSelection": true,
|
63
66
|
"github.copilot.chat.completionContext.typescript.mode": "on",
|
64
67
|
"github.copilot.chat.generateTests.codeLens": true,
|
68
|
+
"github.copilot.chat.languageContext.typescript.enabled": true,
|
69
|
+
"github.copilot.chat.reviewSelection.instructions": [],
|
70
|
+
"github.copilot.chat.scopeSelection": true,
|
65
71
|
"github.copilot.chat.search.semanticTextResults": true,
|
66
72
|
"sonarlint.connectedMode.project": {
|
67
73
|
"connectionId": "helmut-hoffer-von-ankershoffen",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[🧠 OE Python Template Example](https://oe-python-template-example.readthedocs.io/en/latest/)
|
2
2
|
|
3
|
-
## [0.1.15](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/compare/v0.1.14..
|
3
|
+
## [0.1.15](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/compare/v0.1.14..v0.1.15) - 2025-03-15
|
4
4
|
|
5
5
|
### ⚙️ Miscellaneous Tasks
|
6
6
|
|
@@ -0,0 +1,298 @@
|
|
1
|
+
---
|
2
|
+
title: Code Style
|
3
|
+
author: Helmut Hoffer von Ankershoffen (@helmut-hoffer-von-ankershoffen)
|
4
|
+
audience: all
|
5
|
+
status: draft
|
6
|
+
created: 2025-03-16
|
7
|
+
updated: 2025-03-16
|
8
|
+
tags: [style, code, python, typescript]
|
9
|
+
description: |
|
10
|
+
This document describes the code style used in [oe-python-template](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template) and derivatives. It defines
|
11
|
+
strict requirements to be followed by all contributors - humans and agents - to
|
12
|
+
ensure consistency and readability across the codebase.
|
13
|
+
---
|
14
|
+
|
15
|
+
# Code Style
|
16
|
+
|
17
|
+
This document describes the code style used in
|
18
|
+
[oe-python-templat](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template)
|
19
|
+
and derivatives. It defines strict requirements to be followed by all
|
20
|
+
contributors - humans and agents - to ensure consistency and readability across
|
21
|
+
the codebase.
|
22
|
+
|
23
|
+
## Code
|
24
|
+
|
25
|
+
We favor readability and maintainability over cleverness and brevity.
|
26
|
+
|
27
|
+
- We always write code that is easy to read, understand, maintain, test,
|
28
|
+
document, deploy, use, integrate, and extend.
|
29
|
+
- We always write code that is efficient and performant, but only if it does not
|
30
|
+
sacrifice readability, maintainability, and testability.
|
31
|
+
- We always write code that is secure and does not introduce vulnerabilities.
|
32
|
+
- We always write code that is portable and does not introduce platform-specific
|
33
|
+
dependencies.
|
34
|
+
- We always write code that is compatible with the Python version indicated in
|
35
|
+
the .python-version file in the root of this repository.
|
36
|
+
|
37
|
+
# Naming
|
38
|
+
|
39
|
+
We believe that good names are essential for code readability and
|
40
|
+
maintainability. A good name is one that is descriptive, unambiguous, and
|
41
|
+
meaningful. It should convey the purpose and intent of the code it represents.
|
42
|
+
|
43
|
+
- We take extra care to find proper names for all identifiers, including
|
44
|
+
variables, functions, classes, types, tests, modules, and packages. We prefer
|
45
|
+
descriptive names that clearly indicate the purpose and functionality of the
|
46
|
+
code.
|
47
|
+
- We avoid using abbreviations, acronyms, and jargon unless they are widely
|
48
|
+
understood and accepted in the context of the code. We prefer full words and
|
49
|
+
phrases that are easy to understand.
|
50
|
+
- We avoid using single-letter names, except for loop variables and iterators.
|
51
|
+
- We avoid using generic names like `data`, `info`, `temp`, `foo`, `bar`, etc.
|
52
|
+
These names do not convey any meaning and make the code harder to read and
|
53
|
+
understand.
|
54
|
+
- We avoid using names that are too long or too short. A good name should be
|
55
|
+
concise but descriptive. It should be long enough to convey the purpose and
|
56
|
+
intent of the code, but not so long that it becomes cumbersome to read and
|
57
|
+
write.
|
58
|
+
- We avoid using names that are too similar or too different. A good name should
|
59
|
+
be unique and distinct. It should not be confused with other names in the
|
60
|
+
code. It should not be so different that it becomes hard to remember and
|
61
|
+
recognize.
|
62
|
+
|
63
|
+
## Formatting
|
64
|
+
|
65
|
+
We use [ruff](https://github.com/astral-sh/ruff) to format Python code
|
66
|
+
|
67
|
+
- The ruff formatter adheres to the
|
68
|
+
[Black](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html)
|
69
|
+
code style which is [PEP 8](https://www.python.org/dev/peps/pep-0008/)
|
70
|
+
compliant.
|
71
|
+
- The ruff formatter is configured to use a max line length of 120.
|
72
|
+
- The ruff formatter is called by the lint session of nox.
|
73
|
+
|
74
|
+
Beyond PEP 8 we adhere to the following naming conventions: We use the following
|
75
|
+
conventions for Python code:
|
76
|
+
|
77
|
+
- Class names: `PascalCase` - descriptive nouns that clearly indicate purpose.
|
78
|
+
- Function/method names: `snake_case` - verb phrases that describe actions.
|
79
|
+
- Variables/attributes: `snake_case` - descriptive nouns/noun phrases.
|
80
|
+
- Constants: `UPPER_SNAKE_CASE`.
|
81
|
+
- Private members: Prefix with single underscore `_private_attribute`.
|
82
|
+
- "True" private members: Prefix with double underscore `__truly_private`.
|
83
|
+
- Type variables: `CamelCase` with short, descriptive names (e.g., `T`, `KT`,
|
84
|
+
`VT`).
|
85
|
+
- Boolean variables/functions: Prefix with `is_`, `has_`, `should_`, etc.
|
86
|
+
- Interface classes: Suffix with `Interface` or `Protocol`.
|
87
|
+
|
88
|
+
## Linting and type checking
|
89
|
+
|
90
|
+
We use [ruff](https://github.com/astral-sh/ruff) to lint Python code
|
91
|
+
|
92
|
+
- All linting rules are enabled except those explicitly disabled in
|
93
|
+
pyproject.toml
|
94
|
+
- The ruff linter is called by the lint session of nox.
|
95
|
+
|
96
|
+
We use [mypy](https://mypy.readthedocs.io/) for static type checking of Python
|
97
|
+
code.
|
98
|
+
|
99
|
+
- mypy is configured to use the `strict` mode in pyproject.toml
|
100
|
+
- mypy is called by the lint session of nox.
|
101
|
+
|
102
|
+
## Documentation
|
103
|
+
|
104
|
+
We use docstrings to document the purpose of modules, classes, types, functions,
|
105
|
+
its parameters and returns
|
106
|
+
|
107
|
+
- We use Google style docstrings with typed Args and Returns.
|
108
|
+
- We comment complex code and algorithms to explain their purpose and
|
109
|
+
functionality.
|
110
|
+
- We leave references with deep links in code to external documentation,
|
111
|
+
standards, and specifications.
|
112
|
+
|
113
|
+
We provide an auto-generated OpenAPI specification and reference documentation.
|
114
|
+
|
115
|
+
We generate the final documentation using Sphinx and publish it to readthedocs.
|
116
|
+
|
117
|
+
- Generation of documentation is called by the docs session of nox
|
118
|
+
|
119
|
+
## Testing
|
120
|
+
|
121
|
+
We use [pytest](https://docs.pytest.org/en/stable/) for testing Python code.
|
122
|
+
|
123
|
+
- Tests are defined in the `tests/` directory
|
124
|
+
- Tests are named test__.py and classes are named Test_
|
125
|
+
- Test functions are named test_*
|
126
|
+
- We use pytest fixtures to set up test data and state
|
127
|
+
- We leverage several pytest plugins:
|
128
|
+
- `pytest-asyncio` for testing async code
|
129
|
+
- `pytest-cov` for coverage reporting
|
130
|
+
- `pytest-docker` for integration tests with containers
|
131
|
+
- `pytest-env` for environment variable management
|
132
|
+
- `pytest-regressions` for regression testing
|
133
|
+
- `pytest-xdist` for parallel test execution
|
134
|
+
- Test execution is automated through the nox test session which runs across the
|
135
|
+
Python versions indicated in the `pyproject.toml`.
|
136
|
+
|
137
|
+
Our test coverage is measured using `pytest-cov` and reported in the CI
|
138
|
+
pipeline.
|
139
|
+
|
140
|
+
- We aim for 100% unit coverage on all code paths, including error handling and
|
141
|
+
edge cases.
|
142
|
+
- We fail the CI if unit test coverage drops below 85%.
|
143
|
+
|
144
|
+
Apart from unit tests we provide integration tests and end-to-end tests:
|
145
|
+
|
146
|
+
- We smoke test as part of the CI/CD pipeline.
|
147
|
+
- We facilitate exploratory testing to ensure comprehensive coverage.
|
148
|
+
- We use `pytest-docker` for integration tests with containers.
|
149
|
+
|
150
|
+
## Error Handling
|
151
|
+
|
152
|
+
We use structured, explicit error handling that enables effective debugging and
|
153
|
+
monitoring:
|
154
|
+
|
155
|
+
- Use specific exception classes instead of generic ones.
|
156
|
+
- Include contextual information in exception messages.
|
157
|
+
- Log exceptions with appropriate severity levels and context.
|
158
|
+
- Gracefully degrade functionality when possible rather than failing completely.
|
159
|
+
- Use type hints to catch type errors at compile time rather than runtime.
|
160
|
+
- Design errors to be actionable for both users and developers.
|
161
|
+
|
162
|
+
## Logging
|
163
|
+
|
164
|
+
We log information to help with debugging and monitoring:
|
165
|
+
|
166
|
+
- Use structured logging with consistent fields across all log entries.
|
167
|
+
- Include correlation IDs for tracking requests across components.
|
168
|
+
- Log at appropriate levels (DEBUG, INFO, WARNING, ERROR, CRITICAL).
|
169
|
+
- Be mindful of PII and sensitive data in logs, using obfuscation where needed.
|
170
|
+
- Consider log volume and performance impact in production environments.
|
171
|
+
|
172
|
+
## Performance Considerations
|
173
|
+
|
174
|
+
We consider performance from the early design stage, not as an afterthought:
|
175
|
+
|
176
|
+
- Consider algorithmic complexity (Big O notation) for all operations.
|
177
|
+
- Prefer lazy evaluation when dealing with large datasets.
|
178
|
+
- Use appropriate data structures for specific access patterns.
|
179
|
+
- Be mindful of memory usage, especially for long-running processes.
|
180
|
+
- Consider profiling for critical paths and potential bottlenecks.
|
181
|
+
- Document performance characteristics and assumptions.
|
182
|
+
- Write benchmarks for performance-critical code.
|
183
|
+
- Design for horizontal scaling from the beginning.
|
184
|
+
- Use asynchronous operations appropriately for I/O-bound tasks.
|
185
|
+
- Consider caching strategies when appropriate.
|
186
|
+
|
187
|
+
## API Design
|
188
|
+
|
189
|
+
For both internal and external APIs we follow the principle of least surprise.
|
190
|
+
|
191
|
+
- We maintain backward compatibility whenever possible. If not possible we add a
|
192
|
+
new major version of the API.
|
193
|
+
- Implement proper versioning for breaking changes.
|
194
|
+
- Document error conditions, return values, and side effects.
|
195
|
+
- Design for testability and mockability.
|
196
|
+
- Provide sensible defaults while allowing for configuration.
|
197
|
+
- Follow RESTful principles for HTTP APIs.
|
198
|
+
- Use consistent parameter ordering and naming.
|
199
|
+
- Implement proper validation with helpful error messages.
|
200
|
+
- Consider rate limiting and circuit breaking for external services.
|
201
|
+
|
202
|
+
## Security
|
203
|
+
|
204
|
+
We prioritize security at every stage of development to prevent vulnerabilities
|
205
|
+
and protect our users.
|
206
|
+
|
207
|
+
- Follow the principle of least privilege for all operations and access
|
208
|
+
controls.
|
209
|
+
- Never store secrets (API keys, passwords, tokens) in code repositories.
|
210
|
+
- Use environment variables or dedicated secret management services.
|
211
|
+
- Code is checked via `detect-secrets` pre-commit hook to prevent accidental
|
212
|
+
commits of secrets.
|
213
|
+
|
214
|
+
We implement proper input validation and sanitization for all external inputs
|
215
|
+
via [pydantic](https://pydantic-docs.helpmanual.io/):
|
216
|
+
|
217
|
+
- Validate inputs as early as possible in the data flow.
|
218
|
+
|
219
|
+
We handle authentication and authorization correctly:
|
220
|
+
|
221
|
+
- Use industry-standard authentication protocols (OAuth, JWT).
|
222
|
+
- Separate authentication from authorization logic.
|
223
|
+
- Implement proper session management with secure cookies.
|
224
|
+
- Protect against common vulnerabilities:
|
225
|
+
- SQL Injection: Use parameterized queries or ORM frameworks.
|
226
|
+
- XSS: Apply proper output encoding.
|
227
|
+
- CSRF: Implement anti-CSRF tokens for state-changing operations.
|
228
|
+
- SSRF: Validate and restrict URL destinations.
|
229
|
+
- Command Injection: Avoid direct system command execution where possible.
|
230
|
+
- Implement proper error handling that doesn't leak sensitive information.
|
231
|
+
- Use secure defaults and fail closed (secure) rather than open (insecure).
|
232
|
+
|
233
|
+
We apply the principle of defense in depth:
|
234
|
+
|
235
|
+
- Don't rely on a single security control.
|
236
|
+
- Implement multiple layers of protection.
|
237
|
+
- Document security considerations in code and design documents.
|
238
|
+
- Write security-focused tests:
|
239
|
+
- Test for security property violations.
|
240
|
+
- Test error cases and edge conditions.
|
241
|
+
- Test for resource exhaustion scenarios.
|
242
|
+
- Apply proper rate limiting and throttling to prevent abuse.
|
243
|
+
- For cryptographic operations:
|
244
|
+
- Use established libraries, not custom implementations.
|
245
|
+
- Follow current best practices for algorithm selection and key management.
|
246
|
+
- Be aware of the limitations of cryptographic primitives.
|
247
|
+
- Regularly run security-focused static analysis tools as part of CI/CD:
|
248
|
+
- CodeQL analysis (via GitHub Actions)
|
249
|
+
- SonarCloud checks for security vulnerabilities
|
250
|
+
|
251
|
+
Our security posture is defined in [SECURITY.md](SECURITY.md).
|
252
|
+
|
253
|
+
## Dependency Management
|
254
|
+
|
255
|
+
We use modern dependency management practices:
|
256
|
+
|
257
|
+
- [uv](https://github.com/astral-sh/uv) for fast, reliable package installation
|
258
|
+
and environment management
|
259
|
+
- Dependency version locking via uv.lock file
|
260
|
+
- Regular dependency auditing:
|
261
|
+
- Security auditing via `pip-audit`
|
262
|
+
- License compliance checks via `pip-licenses`
|
263
|
+
- SBOM generation via `cyclonedx-py`
|
264
|
+
|
265
|
+
Dependency updates are automated via Dependabot and Renovate to ensure we stay
|
266
|
+
current with security patches.
|
267
|
+
|
268
|
+
## Versioning
|
269
|
+
|
270
|
+
We use [semantic versioning](https://semver.org/) for versioning our releases:
|
271
|
+
|
272
|
+
- MAJOR: Breaking changes
|
273
|
+
- MINOR: New features, non-breaking changes
|
274
|
+
- PATCH: Bug fixes, non-breaking changes
|
275
|
+
|
276
|
+
Our API versioning follows the same principles, with major versions indicated in
|
277
|
+
the URL (e.g., /api/v1/resource) and the full version provided as part of the
|
278
|
+
OpenAPI pecification.
|
279
|
+
|
280
|
+
## Conventional Commits
|
281
|
+
|
282
|
+
Our commit messages follow conventional commits format.
|
283
|
+
|
284
|
+
- We use 'feat','fix','chore','docs','style','refactor','test' prefixes and
|
285
|
+
components in parentheses. E.g.
|
286
|
+
`feat(api): add new endpoint for user registration`.
|
287
|
+
|
288
|
+
## Guidance for AI Pair Programming
|
289
|
+
|
290
|
+
When generating code with AI assistance:
|
291
|
+
|
292
|
+
- AI-generated code must follow all style guidelines in this document.
|
293
|
+
- Always review AI-generated code for correctness, security implications, and
|
294
|
+
adherence to project patterns.
|
295
|
+
- Use AI to generate tests alongside implementation code.
|
296
|
+
- Request explanations for complex algorithms or patterns in the generated code.
|
297
|
+
- Remember that AI should augment, not replace, human judgment about code
|
298
|
+
quality and design decisions.
|
@@ -139,6 +139,8 @@ uv run nox -s update_from_template
|
|
139
139
|
|
140
140
|
## Pull Request Guidelines
|
141
141
|
|
142
|
+
- Before starting to write code read the [CODE-STYlE.md](CODE-STYLE.md) document for mandatory coding style
|
143
|
+
guidelines.
|
142
144
|
- **Pre-Commit Hooks:** We use pre-commit hooks to ensure code quality. Please install the pre-commit hooks by running `uv run pre-commit install`. This ensure all tests, linting etc. pass locally before you can commit.
|
143
145
|
- **Squash Commits:** Before submitting a pull request, please squash your commits into a single commit.
|
144
146
|
- **Branch Naming:** Use descriptive branch names like `feature/your-feature` or `fix/issue-number`.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: oe-python-template-example
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.17
|
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/
|
@@ -59,6 +59,9 @@ Requires-Dist: marimo>=0.11.19; extra == 'examples'
|
|
59
59
|
Requires-Dist: streamlit>=1.43.2; extra == 'examples'
|
60
60
|
Description-Content-Type: text/markdown
|
61
61
|
|
62
|
+
|
63
|
+
[//]: # (README.md generated from docs/partials/README_*.md)
|
64
|
+
|
62
65
|
# 🧠 OE Python Template Example
|
63
66
|
|
64
67
|
[
|
@@ -136,10 +139,13 @@ uvx oe-python-template-example serve --port=4711 # serves webservice API on port
|
|
136
139
|
```
|
137
140
|
|
138
141
|
Notes:
|
139
|
-
* The API is versioned, mounted at `/api/v1` resp. `/api/v2`
|
140
|
-
* While serving the webservice API go to [http://127.0.0.1:8000/api/v1/hello-world](http://127.0.0.1:8000/api/v1/hello-world) to see the respons of the `hello-world` operation.
|
141
|
-
* Interactive documentation is provided at [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
|
142
142
|
|
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)
|
143
149
|
|
144
150
|
The CLI provides extensive help:
|
145
151
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
|
2
|
+
[//]: # (README.md generated from docs/partials/README_*.md)
|
3
|
+
|
1
4
|
# 🧠 OE Python Template Example
|
2
5
|
|
3
6
|
[
|
@@ -75,10 +78,13 @@ uvx oe-python-template-example serve --port=4711 # serves webservice API on port
|
|
75
78
|
```
|
76
79
|
|
77
80
|
Notes:
|
78
|
-
* The API is versioned, mounted at `/api/v1` resp. `/api/v2`
|
79
|
-
* While serving the webservice API go to [http://127.0.0.1:8000/api/v1/hello-world](http://127.0.0.1:8000/api/v1/hello-world) to see the respons of the `hello-world` operation.
|
80
|
-
* Interactive documentation is provided at [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
|
81
81
|
|
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)
|
82
88
|
|
83
89
|
The CLI provides extensive help:
|
84
90
|
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -47,6 +47,14 @@ We follow these security best practices:
|
|
47
47
|
- Automated CI/CD pipelines including security checks
|
48
48
|
- Adherence to Python security best practices
|
49
49
|
|
50
|
+
We promote security awareness among contributors and users
|
51
|
+
|
52
|
+
- We indicate security as a priority in our mandatory
|
53
|
+
[CODE-STYLE.md](CODE-STYLE.md) document, to be followed by human and agentic
|
54
|
+
contributors.
|
55
|
+
- We publish our security posture in SECURITY.md (this document), encouraring
|
56
|
+
users to report vulnerabilities.
|
57
|
+
|
50
58
|
## Security Compliance
|
51
59
|
|
52
60
|
For questions about security compliance or for more details about our security practices, please contact helmuthva@gmail.com.
|
@@ -0,0 +1 @@
|
|
1
|
+
0.1.17
|
@@ -33,10 +33,13 @@ uvx oe-python-template-example serve --port=4711 # serves webservice API on port
|
|
33
33
|
```
|
34
34
|
|
35
35
|
Notes:
|
36
|
-
* The API is versioned, mounted at `/api/v1` resp. `/api/v2`
|
37
|
-
* While serving the webservice API go to [http://127.0.0.1:8000/api/v1/hello-world](http://127.0.0.1:8000/api/v1/hello-world) to see the respons of the `hello-world` operation.
|
38
|
-
* Interactive documentation is provided at [http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
|
39
36
|
|
37
|
+
- The API is versioned, mounted at `/api/v1` resp. `/api/v2`
|
38
|
+
- While serving the webservice API go to
|
39
|
+
[http://127.0.0.1:8000/api/v1/hello-world](http://127.0.0.1:8000/api/v1/hello-world)
|
40
|
+
to see the respons of the `hello-world` operation.
|
41
|
+
- Interactive documentation is provided at
|
42
|
+
[http://127.0.0.1:8000/api/docs](http://127.0.0.1:8000/api/docs)
|
40
43
|
|
41
44
|
The CLI provides extensive help:
|
42
45
|
|
@@ -29,7 +29,7 @@ extensions = [
|
|
29
29
|
project = "oe-python-template-example"
|
30
30
|
author = "Helmut Hoffer von Ankershoffen"
|
31
31
|
copyright = f" (c) 2025-{datetime.now(UTC).year}, {author}" # noqa: A001
|
32
|
-
version = "0.1.
|
32
|
+
version = "0.1.17"
|
33
33
|
release = version
|
34
34
|
github_username = "helmut-hoffer-von-ankershoffen"
|
35
35
|
github_repository = "oe-python-template-example"
|
@@ -56,10 +56,11 @@ def docs(session: nox.Session) -> None:
|
|
56
56
|
"""Build documentation and concatenate README."""
|
57
57
|
_setup_venv(session)
|
58
58
|
# Concatenate README files
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
preamble = "\n[//]: # (README.md generated from docs/partials/README_*.md)\n\n"
|
60
|
+
header = Path("docs/partials/README_header.md").read_text(encoding="utf-8")
|
61
|
+
main = Path("docs/partials/README_main.md").read_text(encoding="utf-8")
|
62
|
+
footer = Path("docs/partials/README_footer.md").read_text(encoding="utf-8")
|
63
|
+
readme_content = f"{preamble}{header}\n\n{main}\n\n{footer}"
|
63
64
|
Path("README.md").write_text(readme_content, encoding="utf-8")
|
64
65
|
# Dump openapi schema to file
|
65
66
|
with Path("docs/source/_static/openapi_v1.yaml").open("w", encoding="utf-8") as f:
|
@@ -157,6 +158,10 @@ def update_from_template(session: nox.Session) -> None:
|
|
157
158
|
# In this case the template has been generated from a template
|
158
159
|
session.run("copier", "update", "--trust", "--skip-answered", "--skip-tasks", external=True)
|
159
160
|
|
161
|
+
# Schedule the lint session to run after this session completes
|
162
|
+
session.notify("docs")
|
163
|
+
session.notify("lint")
|
164
|
+
|
160
165
|
|
161
166
|
@nox.session(default=False)
|
162
167
|
def act(session: nox.Session) -> None:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "oe-python-template-example"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.17"
|
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 = [
|
@@ -242,7 +242,7 @@ source = ["src/"]
|
|
242
242
|
|
243
243
|
|
244
244
|
[tool.bumpversion]
|
245
|
-
current_version = "0.1.
|
245
|
+
current_version = "0.1.17"
|
246
246
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
|
247
247
|
serialize = ["{major}.{minor}.{patch}"]
|
248
248
|
search = "{current_version}"
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/sonar-project.properties
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
sonar.projectKey=helmut-hoffer-von-ankershoffen_oe-python-template-example
|
2
2
|
sonar.organization=helmut-hoffer-von-ankershoffen
|
3
|
-
sonar.projectVersion=0.1.
|
3
|
+
sonar.projectVersion=0.1.17
|
4
4
|
sonar.projectDescription=🧠 Example project scaffolded and kept up to date with OE Python Template (oe-python-template).
|
5
5
|
sonar.links.homepage=https://oe-python-template-example.readthedocs.io/en/latest/
|
6
6
|
sonar.links.scm=https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example
|
@@ -1,8 +0,0 @@
|
|
1
|
-
## [0.1.15](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/compare/v0.1.14..v0.1.15) - 2025-03-15
|
2
|
-
|
3
|
-
### ⚙️ Miscellaneous Tasks
|
4
|
-
|
5
|
-
- .gitignore - ([b1fb3fa](https://github.com/helmut-hoffer-von-ankershoffen/oe-python-template-example/commit/b1fb3fa01b18031cfa12f3241b62e70dc1419640))
|
6
|
-
|
7
|
-
|
8
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
0.1.15
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.devcontainer/Dockerfile
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.github/dependabot.yml
RENAMED
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.github/workflows/codeql.yml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.pre-commit-config.yaml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/.vscode/extensions.json
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/SERVICE_CONNECTIONS.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/_static/.keep
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/api_v1.rst
RENAMED
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/api_v2.rst
RENAMED
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/contributing.rst
RENAMED
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/reference.rst
RENAMED
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/docs/source/security.rst
RENAMED
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/examples/__init__.py
RENAMED
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/examples/notebook.ipynb
RENAMED
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/examples/notebook.py
RENAMED
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/examples/streamlit.py
RENAMED
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/CHANGELOG.md
RENAMED
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/LICENSE-MIT
RENAMED
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/git-cliff-2.7.0/README.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{oe_python_template_example-0.1.15 → oe_python_template_example-0.1.17}/tests/fixtures/.keep
RENAMED
File without changes
|