Skip to content

Commit c7690ed

Browse files
feat(config): extract declarative configuration into opentelemetry-configuration package (#5356)
* extract declarative configuration into opentelemetry-sdk-configuration package Per the Python SIG on 2026-06-25 (tracked in #5355), declarative configuration moves out of opentelemetry-sdk into a new standalone package. The SDK stays slim and stable; declarative-config-specific code lives in opentelemetry-sdk-configuration which can iterate and version independently with an experimental marker. Layout: opentelemetry-sdk-configuration/ pyproject.toml new package manifest README.rst experimental marker, install hint src/opentelemetry/sdk/configuration/ the public namespace __init__.py public API: configure_sdk, load_config_file, OpenTelemetryConfiguration, ConfigurationError _exceptions.py, _common.py, _conversion.py, _sdk.py, _resource.py, _propagator.py, _tracer_provider.py, _meter_provider.py, _logger_provider.py, models.py, schema.json file/__init__.py, file/_loader.py, file/_env_substitution.py version/__init__.py 0.1.0.dev codegen/dataclass.jinja2 moved from opentelemetry-sdk/codegen tests/ all moved from opentelemetry-sdk/tests/_configuration test-requirements.txt opentelemetry-sdk keeps only what activates the declarative path: - OTEL_CONFIG_FILE env var constant in opentelemetry.sdk.environment_variables - _OTelSDKConfigurator._configure detects the env var and lazy-imports opentelemetry.sdk.configuration. The SDK has no runtime dep on the new package; lambda / no-config users pay zero import cost. - When OTEL_CONFIG_FILE is set but the new package isn't installed, raise a clear RuntimeError with a pip-install hint instead of a bare ImportError. Top-level updates: - pyproject.toml: codegen input/output paths and additional-imports point at the new package. ruff per-file-ignore for test_models.py updated. file-configuration extras moved off opentelemetry-sdk. - tox.ini: adds test-/lint- envs for opentelemetry-sdk-configuration; coverage env switches from opentelemetry-sdk[file-configuration] to the standalone configuration package. Tests: - 309 tests in opentelemetry-sdk-configuration/tests pass. - 789 tests in opentelemetry-sdk/tests pass (incl. rewritten test_configurator_file_routing.py which now patches the new module paths and covers the missing-package RuntimeError). Closes #5355 * rename changelog fragment to PR #5356 * register opentelemetry-sdk-configuration in uv workspace * fix CI: regenerate workflows, mock new pkg in routing tests, silence lint/typecheck on lazy import, fix link-check placeholder * fix CI: per-package pylintrc for sdk-configuration, drop bad link from schema README * drop file-configuration extras: pyyaml and jsonschema are now required deps * tighten 5356 changelog entry * drop opentelemetry/sdk/__init__.pyi to make opentelemetry.sdk a proper namespace package; revert lint/typecheck workarounds * rename opentelemetry-sdk-configuration → opentelemetry-configuration (module path opentelemetry.configuration); restore sdk __init__.pyi * post-rename CI fixes: ruff import sort + disable no-member on dynamic fake module * use class-based fake module in routing tests to drop the no-member pylint disable * silence pylint no-name-in-module on conditional opentelemetry.configuration import (not installed in sdk lint env) * add opentelemetry-configuration to pyright include/exclude, drop unused typing-extensions dep * loosen pyyaml floor to >= 5.4 (matches our actual API surface) * address xrmx review: pin to 0.65b0.dev via prerelease block, keep file-configuration extras as alias --------- Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
1 parent 4a2ef8c commit c7690ed

57 files changed

Lines changed: 1856 additions & 1321 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changelog/5356.changed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`opentelemetry-configuration`: declarative configuration moves from `opentelemetry.sdk._configuration` into the new public `opentelemetry-configuration` package (`opentelemetry.configuration` namespace), published experimentally. `opentelemetry-sdk[file-configuration]` continues to work as an alias that installs `opentelemetry-configuration` alongside the SDK.

.github/workflows/lint.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,25 @@ jobs:
119119
- name: Run tests
120120
run: tox -e lint-opentelemetry-sdk
121121

122+
lint-opentelemetry-configuration:
123+
name: opentelemetry-configuration
124+
runs-on: ubuntu-latest
125+
timeout-minutes: 30
126+
steps:
127+
- name: Checkout repo @ SHA - ${{ github.sha }}
128+
uses: actions/checkout@v4
129+
130+
- name: Set up Python 3.14
131+
uses: actions/setup-python@v5
132+
with:
133+
python-version: "3.14"
134+
135+
- name: Install tox
136+
run: pip install tox-uv
137+
138+
- name: Run tests
139+
run: tox -e lint-opentelemetry-configuration
140+
122141
lint-opentelemetry-semantic-conventions:
123142
name: opentelemetry-semantic-conventions
124143
runs-on: ubuntu-latest

.github/workflows/test.yml

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,139 @@ jobs:
923923
- name: Run tests
924924
run: tox -e pypy3-test-opentelemetry-sdk -- -ra
925925

926+
py310-test-opentelemetry-configuration_ubuntu-latest:
927+
name: opentelemetry-configuration 3.10 Ubuntu
928+
runs-on: ubuntu-latest
929+
timeout-minutes: 30
930+
steps:
931+
- name: Checkout repo @ SHA - ${{ github.sha }}
932+
uses: actions/checkout@v4
933+
934+
- name: Set up Python 3.10
935+
uses: actions/setup-python@v5
936+
with:
937+
python-version: "3.10"
938+
939+
- name: Install tox
940+
run: pip install tox-uv
941+
942+
- name: Run tests
943+
run: tox -e py310-test-opentelemetry-configuration -- -ra
944+
945+
py311-test-opentelemetry-configuration_ubuntu-latest:
946+
name: opentelemetry-configuration 3.11 Ubuntu
947+
runs-on: ubuntu-latest
948+
timeout-minutes: 30
949+
steps:
950+
- name: Checkout repo @ SHA - ${{ github.sha }}
951+
uses: actions/checkout@v4
952+
953+
- name: Set up Python 3.11
954+
uses: actions/setup-python@v5
955+
with:
956+
python-version: "3.11"
957+
958+
- name: Install tox
959+
run: pip install tox-uv
960+
961+
- name: Run tests
962+
run: tox -e py311-test-opentelemetry-configuration -- -ra
963+
964+
py312-test-opentelemetry-configuration_ubuntu-latest:
965+
name: opentelemetry-configuration 3.12 Ubuntu
966+
runs-on: ubuntu-latest
967+
timeout-minutes: 30
968+
steps:
969+
- name: Checkout repo @ SHA - ${{ github.sha }}
970+
uses: actions/checkout@v4
971+
972+
- name: Set up Python 3.12
973+
uses: actions/setup-python@v5
974+
with:
975+
python-version: "3.12"
976+
977+
- name: Install tox
978+
run: pip install tox-uv
979+
980+
- name: Run tests
981+
run: tox -e py312-test-opentelemetry-configuration -- -ra
982+
983+
py313-test-opentelemetry-configuration_ubuntu-latest:
984+
name: opentelemetry-configuration 3.13 Ubuntu
985+
runs-on: ubuntu-latest
986+
timeout-minutes: 30
987+
steps:
988+
- name: Checkout repo @ SHA - ${{ github.sha }}
989+
uses: actions/checkout@v4
990+
991+
- name: Set up Python 3.13
992+
uses: actions/setup-python@v5
993+
with:
994+
python-version: "3.13"
995+
996+
- name: Install tox
997+
run: pip install tox-uv
998+
999+
- name: Run tests
1000+
run: tox -e py313-test-opentelemetry-configuration -- -ra
1001+
1002+
py314-test-opentelemetry-configuration_ubuntu-latest:
1003+
name: opentelemetry-configuration 3.14 Ubuntu
1004+
runs-on: ubuntu-latest
1005+
timeout-minutes: 30
1006+
steps:
1007+
- name: Checkout repo @ SHA - ${{ github.sha }}
1008+
uses: actions/checkout@v4
1009+
1010+
- name: Set up Python 3.14
1011+
uses: actions/setup-python@v5
1012+
with:
1013+
python-version: "3.14"
1014+
1015+
- name: Install tox
1016+
run: pip install tox-uv
1017+
1018+
- name: Run tests
1019+
run: tox -e py314-test-opentelemetry-configuration -- -ra
1020+
1021+
py314t-test-opentelemetry-configuration_ubuntu-latest:
1022+
name: opentelemetry-configuration 3.14t Ubuntu
1023+
runs-on: ubuntu-latest
1024+
timeout-minutes: 30
1025+
steps:
1026+
- name: Checkout repo @ SHA - ${{ github.sha }}
1027+
uses: actions/checkout@v4
1028+
1029+
- name: Set up Python 3.14t
1030+
uses: actions/setup-python@v5
1031+
with:
1032+
python-version: "3.14t"
1033+
1034+
- name: Install tox
1035+
run: pip install tox-uv
1036+
1037+
- name: Run tests
1038+
run: tox -e py314t-test-opentelemetry-configuration -- -ra
1039+
1040+
pypy3-test-opentelemetry-configuration_ubuntu-latest:
1041+
name: opentelemetry-configuration pypy-3.10 Ubuntu
1042+
runs-on: ubuntu-latest
1043+
timeout-minutes: 30
1044+
steps:
1045+
- name: Checkout repo @ SHA - ${{ github.sha }}
1046+
uses: actions/checkout@v4
1047+
1048+
- name: Set up Python pypy-3.10
1049+
uses: actions/setup-python@v5
1050+
with:
1051+
python-version: "pypy-3.10"
1052+
1053+
- name: Install tox
1054+
run: pip install tox-uv
1055+
1056+
- name: Run tests
1057+
run: tox -e pypy3-test-opentelemetry-configuration -- -ra
1058+
9261059
py310-test-opentelemetry-semantic-conventions_ubuntu-latest:
9271060
name: opentelemetry-semantic-conventions 3.10 Ubuntu
9281061
runs-on: ubuntu-latest
@@ -4717,6 +4850,153 @@ jobs:
47174850
- name: Run tests
47184851
run: tox -e pypy3-test-opentelemetry-sdk -- -ra
47194852

4853+
py310-test-opentelemetry-configuration_windows-latest:
4854+
name: opentelemetry-configuration 3.10 Windows
4855+
runs-on: windows-latest
4856+
timeout-minutes: 30
4857+
steps:
4858+
- name: Configure git to support long filenames
4859+
run: git config --system core.longpaths true
4860+
- name: Checkout repo @ SHA - ${{ github.sha }}
4861+
uses: actions/checkout@v4
4862+
4863+
- name: Set up Python 3.10
4864+
uses: actions/setup-python@v5
4865+
with:
4866+
python-version: "3.10"
4867+
4868+
- name: Install tox
4869+
run: pip install tox-uv
4870+
4871+
- name: Run tests
4872+
run: tox -e py310-test-opentelemetry-configuration -- -ra
4873+
4874+
py311-test-opentelemetry-configuration_windows-latest:
4875+
name: opentelemetry-configuration 3.11 Windows
4876+
runs-on: windows-latest
4877+
timeout-minutes: 30
4878+
steps:
4879+
- name: Configure git to support long filenames
4880+
run: git config --system core.longpaths true
4881+
- name: Checkout repo @ SHA - ${{ github.sha }}
4882+
uses: actions/checkout@v4
4883+
4884+
- name: Set up Python 3.11
4885+
uses: actions/setup-python@v5
4886+
with:
4887+
python-version: "3.11"
4888+
4889+
- name: Install tox
4890+
run: pip install tox-uv
4891+
4892+
- name: Run tests
4893+
run: tox -e py311-test-opentelemetry-configuration -- -ra
4894+
4895+
py312-test-opentelemetry-configuration_windows-latest:
4896+
name: opentelemetry-configuration 3.12 Windows
4897+
runs-on: windows-latest
4898+
timeout-minutes: 30
4899+
steps:
4900+
- name: Configure git to support long filenames
4901+
run: git config --system core.longpaths true
4902+
- name: Checkout repo @ SHA - ${{ github.sha }}
4903+
uses: actions/checkout@v4
4904+
4905+
- name: Set up Python 3.12
4906+
uses: actions/setup-python@v5
4907+
with:
4908+
python-version: "3.12"
4909+
4910+
- name: Install tox
4911+
run: pip install tox-uv
4912+
4913+
- name: Run tests
4914+
run: tox -e py312-test-opentelemetry-configuration -- -ra
4915+
4916+
py313-test-opentelemetry-configuration_windows-latest:
4917+
name: opentelemetry-configuration 3.13 Windows
4918+
runs-on: windows-latest
4919+
timeout-minutes: 30
4920+
steps:
4921+
- name: Configure git to support long filenames
4922+
run: git config --system core.longpaths true
4923+
- name: Checkout repo @ SHA - ${{ github.sha }}
4924+
uses: actions/checkout@v4
4925+
4926+
- name: Set up Python 3.13
4927+
uses: actions/setup-python@v5
4928+
with:
4929+
python-version: "3.13"
4930+
4931+
- name: Install tox
4932+
run: pip install tox-uv
4933+
4934+
- name: Run tests
4935+
run: tox -e py313-test-opentelemetry-configuration -- -ra
4936+
4937+
py314-test-opentelemetry-configuration_windows-latest:
4938+
name: opentelemetry-configuration 3.14 Windows
4939+
runs-on: windows-latest
4940+
timeout-minutes: 30
4941+
steps:
4942+
- name: Configure git to support long filenames
4943+
run: git config --system core.longpaths true
4944+
- name: Checkout repo @ SHA - ${{ github.sha }}
4945+
uses: actions/checkout@v4
4946+
4947+
- name: Set up Python 3.14
4948+
uses: actions/setup-python@v5
4949+
with:
4950+
python-version: "3.14"
4951+
4952+
- name: Install tox
4953+
run: pip install tox-uv
4954+
4955+
- name: Run tests
4956+
run: tox -e py314-test-opentelemetry-configuration -- -ra
4957+
4958+
py314t-test-opentelemetry-configuration_windows-latest:
4959+
name: opentelemetry-configuration 3.14t Windows
4960+
runs-on: windows-latest
4961+
timeout-minutes: 30
4962+
steps:
4963+
- name: Configure git to support long filenames
4964+
run: git config --system core.longpaths true
4965+
- name: Checkout repo @ SHA - ${{ github.sha }}
4966+
uses: actions/checkout@v4
4967+
4968+
- name: Set up Python 3.14t
4969+
uses: actions/setup-python@v5
4970+
with:
4971+
python-version: "3.14t"
4972+
4973+
- name: Install tox
4974+
run: pip install tox-uv
4975+
4976+
- name: Run tests
4977+
run: tox -e py314t-test-opentelemetry-configuration -- -ra
4978+
4979+
pypy3-test-opentelemetry-configuration_windows-latest:
4980+
name: opentelemetry-configuration pypy-3.10 Windows
4981+
runs-on: windows-latest
4982+
timeout-minutes: 30
4983+
steps:
4984+
- name: Configure git to support long filenames
4985+
run: git config --system core.longpaths true
4986+
- name: Checkout repo @ SHA - ${{ github.sha }}
4987+
uses: actions/checkout@v4
4988+
4989+
- name: Set up Python pypy-3.10
4990+
uses: actions/setup-python@v5
4991+
with:
4992+
python-version: "pypy-3.10"
4993+
4994+
- name: Install tox
4995+
run: pip install tox-uv
4996+
4997+
- name: Run tests
4998+
run: tox -e pypy3-test-opentelemetry-configuration -- -ra
4999+
47205000
py310-test-opentelemetry-semantic-conventions_windows-latest:
47215001
name: opentelemetry-semantic-conventions 3.10 Windows
47225002
runs-on: windows-latest

docs/examples/declarative-config/README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ variables or hand-written provider setup.
1515
The source files of this example are available :scm_web:`here
1616
<docs/examples/declarative-config/>`.
1717

18-
Install the SDK with the ``file-configuration`` extra (it pulls in ``pyyaml``
19-
and ``jsonschema``), the auto-instrumentation entry point, the OTLP/HTTP
20-
exporter, and the ``requests`` instrumentation used by this example:
18+
Install the declarative-config package, the auto-instrumentation entry point,
19+
the OTLP/HTTP exporter, and the ``requests`` instrumentation used by this
20+
example:
2121

2222
.. code-block:: sh
2323
24-
pip install "opentelemetry-sdk[file-configuration]" \
24+
pip install opentelemetry-configuration \
2525
opentelemetry-distro \
2626
opentelemetry-exporter-otlp-proto-http \
2727
opentelemetry-instrumentation-requests

docs/sdk/configuration.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ configuration schema, and applies it globally.
2121
Installing
2222
----------
2323

24-
File configuration relies on optional dependencies (``pyyaml`` and
25-
``jsonschema``). Install them with the ``file-configuration`` extra:
24+
Declarative configuration lives in a separate, experimental package:
2625

2726
.. code-block:: sh
2827
29-
pip install "opentelemetry-sdk[file-configuration]"
28+
pip install opentelemetry-configuration
3029
3130
Enabling with an environment variable
3231
-------------------------------------

eachdist.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ packages=
3838
opentelemetry-exporter-otlp-json-common
3939
opentelemetry-exporter-otlp-json-file
4040
opentelemetry-exporter-otlp-common
41+
opentelemetry-configuration
4142
opentelemetry-distro
4243
opentelemetry-proto-json
4344
opentelemetry-semantic-conventions

0 commit comments

Comments
 (0)