Skip to content

Fix docs build - #795

Closed
DylanRussell wants to merge 1 commit into
mainfrom
fix-docs-anyvalue
Closed

DylanRussell wants to merge 1 commit into
mainfrom
fix-docs-anyvalue

Conversation

@DylanRussell

Copy link
Copy Markdown
Contributor

Description

In opentelemetry-api >= 1.45, AttributeValue is defined with recursive forward references to "AnyValue" (Sequence["AnyValue"] | Mapping[str, "AnyValue"]). When sphinx-autodoc-typehints evaluates type annotations in modules that import AttributeValue without AnyValue, it fails to resolve "AnyValue" in the module namespace, raising a NameError and failing docs builds.
This defines AnyValue in builtins during doc generation within docs/conf.py, allowing forward references to resolve across all documented modules without modifying library code.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

docs build passes

Checklist

  • Followed the style guidelines of this project
  • Changelog updated if the change requires an entry
  • Unit tests added
  • Documentation updated

Copilot AI lite review requested due to automatic review settings September 25, 2026 15:01
@DylanRussell
DylanRussell requested a review from a team as a code owner September 25, 2026 15:01
@DylanRussell DylanRussell added the Skip Changelog PR does not require a changelog entry label Sep 25, 2026
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Closed · refreshed 2026-09-25 15:13 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

DylanRussell added a commit to DylanRussell/opentelemetry-python-genai that referenced this pull request Sep 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review issues remain, and documentation builds pass.

Review effort: Lite
Findings: None

What changed in this PR

Fixes Sphinx documentation builds by resolving recursive AnyValue annotations during type-hint evaluation.

Changes:

  • Exposes AnyValue through builtins during documentation generation.
  • Adds the workaround in docs/conf.py.
File Description
docs/​conf.py Adds the documentation-time AnyValue forward-reference workaround.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Skip Changelog PR does not require a changelog entry

Development

Successfully merging this pull request may close these issues.

2 participants