Skip to content

Update ruff to use default ruleset and enable docstring/markdown formatting, also upgrade uv - #356

Merged
lmolkova merged 3 commits into
open-telemetry:mainfrom
DylanRussell:more_ruff_changes
Aug 5, 2026
Merged

Update ruff to use default ruleset and enable docstring/markdown formatting, also upgrade uv#356
lmolkova merged 3 commits into
open-telemetry:mainfrom
DylanRussell:more_ruff_changes

Conversation

@DylanRussell

Copy link
Copy Markdown
Contributor

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 (remove select), remove redundant target-version, add force-exclude = true, enable docstring-code-format = true, and configure the ignore list.
  • .pre-commit-config.yaml: Add ruff-format hook for markdown/towncrier files (--preview), bump ruff to v0.16.1. I also bumped uv to 0.12.1 and regenerated the lock file .
  • Codebase: Apply auto-fixes (ruff check --fix) and reformat docstrings and markdown files (ruff format).

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Unit tests

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 August 4, 2026 19:51
@DylanRussell
DylanRussell requested a review from a team as a code owner August 4, 2026 19:51

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.

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.lock and 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: E402 to 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,
)
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 4, 2026

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-08-05 04:34 UTC

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

@rads-1996 rads-1996 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.

LGTM

@lmolkova lmolkova added the Skip Changelog PR does not require a changelog entry label Aug 5, 2026
@lmolkova
lmolkova added this pull request to the merge queue Aug 5, 2026
Merged via the queue into open-telemetry:main with commit 9d92593 Aug 5, 2026
104 of 105 checks passed
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.

5 participants