SIGN IN SIGN UP

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>
M
Mike Goldsmith committed
c7690ed2eff75c2ae9f36c4cbbc683ba079d34e5
Parent: 4a2ef8c
Committed by GitHub <noreply@github.com> on 7/10/2026, 1:18:53 PM