Update ruff to use default ruleset and enable docstring/markdown formatting, also upgrade uv - #356
Merged
Conversation
eternalcuriouslearner
approved these changes
Aug 4, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the repo’s lint/format toolchain to align with recent opentelemetry-python changes: switching Ruff config to the default ruleset, enabling docstring/Markdown formatting, and upgrading uv (with a regenerated uv.lock). It also applies the resulting auto-fixes and formatting across util, test-util, and multiple instrumentation packages.
Changes:
- Update Ruff configuration (default ruleset,
force-exclude, towncrier fragment extension mapping, docstring code formatting) and pre-commit hooks (Ruff v0.16.1, add Markdown/towncrier formatting hook, upgrade uv to 0.12.1). - Regenerate
uv.lockand reformat code/docstrings/Markdown; modernize typing imports and annotations across packages. - Adjust tests and helper code to match new formatting/lint output.
Reviewed changes
Copilot reviewed 70 out of 72 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Regenerated lockfile after upgrading uv / resolving dependencies. |
| pyproject.toml | Ruff config updated (default ruleset + docstring/Markdown formatting settings). |
| .pre-commit-config.yaml | Bump Ruff hook rev, add Markdown/towncrier ruff-format --preview, bump uv hook. |
| scripts/eachdist.py | Minor string construction change (formatting-compatible). |
| AGENTS.md | Reformat code examples to match new formatter behavior. |
| util/opentelemetry-util-genai/AGENTS.md | Reformat code examples to match new formatter behavior. |
| util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py | Typing import modernization + small annotation simplifications. |
| util/opentelemetry-util-genai/src/opentelemetry/util/genai/stream.py | Move AsyncIterable/Iterable imports to collections.abc. |
| util/opentelemetry-util-genai/src/opentelemetry/util/genai/invocation.py | Reorder __all__ entry (formatting). |
| util/opentelemetry-util-genai/src/opentelemetry/util/genai/_invocation.py | Move Sequence to collections.abc import. |
| util/opentelemetry-util-genai/src/opentelemetry/util/genai/_upload/init.py | Remove no-longer-needed per-line lint suppression (formatting cleanup). |
| util/opentelemetry-util-genai/src/opentelemetry/util/genai/_upload/completion_hook.py | Typing import modernization (Callable from collections.abc). |
| util/opentelemetry-util-genai/tests/test_utils.py | Typing import/annotation modernization in tests. |
| util/opentelemetry-util-genai/tests/test_upload_entrypoint.py | Remove unused per-line lint suppression (formatting cleanup). |
| util/opentelemetry-util-genai/tests/test_stream.py | Simplify __wrapped__ assertions after formatting. |
| util/opentelemetry-util-genai/tests/test_handler_metrics.py | Modernize Dict/List annotations to built-in generics. |
| util/opentelemetry-util-genai/tests/test_completion_hook.py | Typing import modernization (Callable from collections.abc). |
| util/opentelemetry-test-util-genai/src/opentelemetry/test_util_genai/vcr.py | Formatting-only whitespace change. |
| util/opentelemetry-test-util-genai/src/opentelemetry/test_util_genai/fixtures.py | Remove no-longer-needed per-line lint suppression (formatting cleanup). |
| util/opentelemetry-test-util-genai/src/opentelemetry/test_util_genai/conformance.py | Remove no-longer-needed per-line lint suppression (formatting cleanup). |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/test_conformance.py | Import formatting updates (but now hits Ruff E402 without ignores). |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/conftest.py | Remove no-longer-needed per-line lint suppression (formatting cleanup). |
| instrumentation/opentelemetry-instrumentation-google-genai/tests/generate_content/util.py | Modernize typing annotations in test utilities. |
| instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/init.py | Reorder exports (formatting). |
| instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/allowlist_util.py | Typing annotation modernization. |
| instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/dict_util.py | Switch to built-in generics (dict/set) in types. |
| instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/generate_content.py | Typing cleanup + simplify attribute access (getattr → direct after hasattr). |
| instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/instrumentor.py | Typing cleanup (Optional → ` |
| instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/interactions.py | Remove no-longer-needed per-line lint suppression (formatting cleanup). |
| instrumentation/opentelemetry-instrumentation-google-genai/src/opentelemetry/instrumentation/google_genai/tool_call_wrapper.py | Typing cleanup / modernize unions. |
| instrumentation/opentelemetry-instrumentation-genai-smolagents/tests/test_instrumentor.py | Remove no-longer-needed per-line lint suppression (formatting cleanup). |
| instrumentation/opentelemetry-instrumentation-genai-smolagents/src/opentelemetry/instrumentation/genai/smolagents/init.py | Typing import modernization (Collection from collections.abc). |
| instrumentation/opentelemetry-instrumentation-genai-qwen-agent/tests/test_conformance.py | Import formatting updates (but now hits Ruff E402 without ignores). |
| instrumentation/opentelemetry-instrumentation-genai-qwen-agent/tests/conftest.py | Import formatting updates (but now hits Ruff E402 without ignores). |
| instrumentation/opentelemetry-instrumentation-genai-qwen-agent/src/opentelemetry/instrumentation/genai/qwen_agent/init.py | Typing import modernization; remove per-line lint suppression. |
| instrumentation/opentelemetry-instrumentation-genai-qwen-agent/src/opentelemetry/instrumentation/genai/qwen_agent/patch.py | Typing import modernization (Callable from collections.abc). |
| instrumentation/opentelemetry-instrumentation-genai-openai/tests/test_utils.py | Modernize optional typing annotations in tests. |
| instrumentation/opentelemetry-instrumentation-genai-openai/tests/test_response_extractors.py | Simplify attribute access assertions (getattr → direct). |
| instrumentation/opentelemetry-instrumentation-genai-openai/tests/test_embedding_invocation_unit.py | Remove per-line docstring lint ignore (formatting cleanup). |
| instrumentation/opentelemetry-instrumentation-genai-openai/tests/test_conformance.py | Import formatting updates (but now hits Ruff E402 without ignores). |
| instrumentation/opentelemetry-instrumentation-genai-openai/tests/conftest.py | Remove no-longer-needed per-line lint suppression (formatting cleanup). |
| instrumentation/opentelemetry-instrumentation-genai-openai/src/opentelemetry/instrumentation/genai/openai/init.py | Typing import modernization; remove per-line lint suppression. |
| instrumentation/opentelemetry-instrumentation-genai-openai/src/opentelemetry/instrumentation/genai/openai/_raw_response.py | Typing import modernization and union simplification. |
| instrumentation/opentelemetry-instrumentation-genai-openai/src/opentelemetry/instrumentation/genai/openai/chat_wrappers.py | Optional typing modernization. |
| instrumentation/opentelemetry-instrumentation-genai-openai/src/opentelemetry/instrumentation/genai/openai/patch_responses.py | Typing cleanup (PEP604 unions; Callable/Awaitable from collections.abc). |
| instrumentation/opentelemetry-instrumentation-genai-openai/src/opentelemetry/instrumentation/genai/openai/response_extractors.py | Type annotation cleanup (remove quoted forward refs where unnecessary). |
| instrumentation/opentelemetry-instrumentation-genai-openai/src/opentelemetry/instrumentation/genai/openai/response_wrappers.py | Type annotation cleanup (remove quoted forward refs where unnecessary). |
| instrumentation/opentelemetry-instrumentation-genai-openai/src/opentelemetry/instrumentation/genai/openai/utils.py | Typing import modernization; built-in generics. |
| instrumentation/opentelemetry-instrumentation-genai-openai-agents/tests/test_conformance.py | Import formatting updates (but now hits Ruff E402 without ignores). |
| instrumentation/opentelemetry-instrumentation-genai-openai-agents/tests/conftest.py | Import formatting updates (but now hits Ruff E402 without ignores). |
| instrumentation/opentelemetry-instrumentation-genai-openai-agents/src/opentelemetry/instrumentation/genai/openai_agents/init.py | Typing import modernization. |
| instrumentation/opentelemetry-instrumentation-genai-llama-index/src/opentelemetry/instrumentation/genai/llama_index/init.py | Typing import modernization. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/tests/test_conformance.py | Import formatting updates (but now hits Ruff E402 without ignores). |
| instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/init.py | Typing import modernization (Callable/Collection from collections.abc). |
| instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/callback_handler.py | Optional typing modernization + small string handling simplification. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/invocation_manager.py | Optional typing modernization + built-in generics. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/operation_mapping.py | Optional typing modernization throughout. |
| instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/utils.py | Optional typing modernization in helpers. |
| instrumentation/opentelemetry-instrumentation-genai-crewai/src/opentelemetry/instrumentation/genai/crewai/init.py | Typing import modernization. |
| instrumentation/opentelemetry-instrumentation-genai-claude-agent-sdk/tests/conftest.py | Remove no-longer-needed per-line lint suppression (formatting cleanup). |
| instrumentation/opentelemetry-instrumentation-genai-claude-agent-sdk/src/opentelemetry/instrumentation/genai/claude_agent_sdk/init.py | Reformat docs example + typing import modernization. |
| instrumentation/opentelemetry-instrumentation-genai-anthropic/tests/test_conformance.py | Import formatting updates (but now hits Ruff E402 without ignores). |
| instrumentation/opentelemetry-instrumentation-genai-anthropic/src/opentelemetry/instrumentation/genai/anthropic/init.py | Reformat docs example + typing import modernization; remove per-line lint suppression. |
| instrumentation/opentelemetry-instrumentation-genai-anthropic/src/opentelemetry/instrumentation/genai/anthropic/messages_extractors.py | Typing import modernization (Sequence from collections.abc). |
| instrumentation/opentelemetry-instrumentation-genai-anthropic/src/opentelemetry/instrumentation/genai/anthropic/patch.py | Typing import modernization + PEP604 union cleanup. |
| instrumentation/opentelemetry-instrumentation-genai-anthropic/src/opentelemetry/instrumentation/genai/anthropic/wrappers.py | Typing import modernization (Callable from collections.abc). |
| instrumentation/opentelemetry-instrumentation-genai-agno/tests/test_conformance.py | Import formatting updates (but now hits Ruff E402 without ignores). |
| instrumentation/opentelemetry-instrumentation-genai-agno/src/opentelemetry/instrumentation/genai/agno/init.py | Typing import modernization. |
| instrumentation/opentelemetry-instrumentation-genai-agno/src/opentelemetry/instrumentation/genai/agno/patch.py | Typing import modernization; remove per-line lint suppression. |
| instrumentation/opentelemetry-instrumentation-genai-agno/src/opentelemetry/instrumentation/genai/agno/utils.py | Typing import modernization; remove per-line lint suppression. |
| .github/skills/write-conformance-tests/SKILL.md | Format skill documentation examples to match formatter output. |
| .github/skills/migrate-from-openinference/SKILL.md | Format skill documentation examples to match formatter output. |
Suppressed comments (1)
instrumentation/opentelemetry-instrumentation-genai-qwen-agent/tests/conftest.py:23
- These imports come after executable code (setting env vars / patching
VCRHTTPResponse), which triggers Ruff E402 (imports not at top of file). Add# noqa: E402to each import statement (or refactor) to avoid lint failures.
Comment on lines
+20
to
24
| from opentelemetry.test.weaver_live_check import WeaverLiveCheck | ||
| from opentelemetry.test_util_genai.conformance import ( | ||
| Scenario, | ||
| run_conformance, | ||
| ) |
Comment on lines
+20
to
24
| from opentelemetry.test.weaver_live_check import WeaverLiveCheck | ||
| from opentelemetry.test_util_genai.conformance import ( | ||
| Scenario, | ||
| run_conformance, | ||
| ) |
Comment on lines
+15
to
19
| from opentelemetry.test.weaver_live_check import WeaverLiveCheck | ||
| from opentelemetry.test_util_genai.conformance import ( | ||
| Scenario, | ||
| run_conformance, | ||
| ) |
Comment on lines
+17
to
21
| from opentelemetry.test.weaver_live_check import WeaverLiveCheck | ||
| from opentelemetry.test_util_genai.conformance import ( | ||
| Scenario, | ||
| run_conformance, | ||
| ) |
Comment on lines
+17
to
21
| from opentelemetry.test.weaver_live_check import WeaverLiveCheck | ||
| from opentelemetry.test_util_genai.conformance import ( | ||
| Scenario, | ||
| run_conformance, | ||
| ) |
Comment on lines
+15
to
19
| from opentelemetry.test.weaver_live_check import WeaverLiveCheck | ||
| from opentelemetry.test_util_genai.conformance import ( | ||
| Scenario, | ||
| run_conformance, | ||
| ) |
Comment on lines
+17
to
21
| from opentelemetry.test.weaver_live_check import WeaverLiveCheck | ||
| from opentelemetry.test_util_genai.conformance import ( | ||
| Scenario, | ||
| run_conformance, | ||
| ) |
Comment on lines
+10
to
12
| from opentelemetry.test_util_genai.vcr import ( | ||
| scrub_response_headers_overwrite, | ||
| ) |
Comment on lines
+17
to
19
| from opentelemetry.instrumentation.genai.qwen_agent import ( | ||
| QwenAgentInstrumentor, | ||
| ) |
Pull request dashboard statusMerged · refreshed 2026-08-05 04:34 UTC Status above doesn't look right?
|
lmolkova
approved these changes
Aug 5, 2026
Merged
via the queue into
open-telemetry:main
with commit Aug 5, 2026
9d92593
104 of 105 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Update Ruff configuration to use the default ruleset and enable docstring and markdown formatting, matching the changes I just made in
opentelemetry-python(#5491 and #5471).pyproject.toml: Enable Ruff's default ruleset (removeselect), remove redundanttarget-version, addforce-exclude = true, enabledocstring-code-format = true, and configure theignorelist..pre-commit-config.yaml: Addruff-formathook for markdown/towncrier files (--preview), bump ruff tov0.16.1. I also bumpeduvto0.12.1and regenerated the lock file .ruff check --fix) and reformat docstrings and markdown files (ruff format).Type of change
Please delete options that are not relevant.
How has this been tested?
Unit tests
Checklist