Commit 99b47df
config: generate model code from json schema (#4879)
* config: generate model code from json schema
Proposing that the first step towards implementing OpenTelemetry Configuration is to
produce the model code from the json schema. I did a quick search for tools available
to do this and came across datamodel-codegen which seems to do what i expected.
Will open following pull requests (in draft) to use this model code, i just want
to keep these as clearly separated as possible to make reviewing them easier.
Signed-off-by: alex boten <223565+codeboten@users.noreply.github.com>
* update tox command’s deps and allowlist
* add use-union-operator to datamodel-codegen and regenerate models file
* add changelog
* disable union-operator and set target python to 3.10
* ignore generated file for linting
* fix TypeAlias import for python 3.9 in generated models file
* update uv.lock with new dev dependencies
* run precommit
Signed-off-by: alex boten <223565+codeboten@users.noreply.github.com>
* Fix pyright config structure in pyproject.toml
datamodel-codegen section was inserted between [tool.pyright] and its
include/exclude config, causing pyright to check entire repo (599 files)
instead of just included paths. Moved datamodel-codegen section after
pyright config.
* set use-union-operator to true
* Exclude generated models.py from pyright checks
Pyright doesn't recognize that pipe operators are valid with
from __future__ import annotations on Python 3.9.
* Revert uv.lock to test contrib failures
Testing if dev dependency updates in uv.lock are causing
contrib test failures.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Update uv.lock for datamodel-code-generator dependencies
* add test to verify can import models across python versions
* add ruff ignore for models file and inline imports
* add pylint excludes to test
* set use-union-operator to false & regenerate models
---------
Signed-off-by: alex boten <223565+codeboten@users.noreply.github.com>
Co-authored-by: Mike Goldsmith <goldsmith.mike@gmail.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>1 parent 9a658ac commit 99b47df
File tree
9 files changed
+1589
-1
lines changed- opentelemetry-sdk
- src/opentelemetry/sdk/_configuration
- tests/_configuration
- scripts
9 files changed
+1589
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| |||
0 commit comments