Add ruff formatter and linter#183
Open
rads-1996 wants to merge 15 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR switches the repo’s formatting/lint workflow from Black to Ruff, adds Ruff configuration to pyproject.toml, and applies formatting/type-hint modernization across the codebase (built-in generics, collections.abc imports, and minor style cleanups).
Changes:
- Replace the
blacktox environment with arufftox environment and add Ruff to dev dependencies. - Add
[tool.ruff]configuration (lint + formatter settings) inpyproject.toml. - Apply repo-wide formatting and typing updates (e.g.,
Dict→dict,List→list,typing.Sequence→collections.abc.Sequence), plus minor test/sample formatting.
Reviewed changes
Copilot reviewed 48 out of 50 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Replaces Black env with Ruff env for lint/format checks. |
| pyproject.toml | Drops Black config; adds Ruff config and dev dependency. |
| dev_requirements.txt | Swaps Black for Ruff in dev requirements. |
| tests/test_sdkstats.py | Formatting-only tuple spacing changes. |
| tests/test_openai_agents_integration.py | Reformats nested with patch(...) into parenthesized context manager form. |
| tests/test_langchain_integration.py | Removes unused import line (format/lint cleanup). |
| tests/test_distro.py | Reformats nested with patch(...) into parenthesized context manager form. |
| tests/openai_agents/test_trace_instrumentor.py | Reformats nested with patch(...) into parenthesized context manager form. |
| tests/langchain/test_utils.py | Minor style cleanup (kwargs.get(..., None) → kwargs.get(...)) and whitespace. |
| tests/langchain/test_tracer.py | Minor style cleanup and list/dict literal formatting. |
| tests/langchain/test_main_agent_propagation.py | Minor style cleanup (kwargs.get(..., None) → kwargs.get(...)). |
| tests/azure_monitor/diagnostics/test_status_logger.py | Simplifies open() calls (drops redundant "r"). |
| tests/azure_monitor/diagnostics/test_diagnostic_logging.py | Simplifies open() calls (drops redundant "r"). |
| tests/azure_monitor/browserSdkLoader/test_django_middleware.py | Removes blank lines for formatter compliance. |
| tests/a365/test_exporter.py | Reflows long assertion dict literal for formatter compliance. |
| tests/a365/runtime/test_utility.py | Collapses nested context managers and reindents blocks. |
| tests/a365/runtime/test_export_config_consistency.py | Fixes f-string concatenation formatting. |
| tests/a365/integration/openai/test_openai_trace_processor.py | Reflows long calls/comprehensions and simplifies condition formatting. |
| tests/a365/integration/openai/test_message_format.py | Reflows list/dict building and assertion formatting. |
| tests/a365/integration/langchain/test_observability_pipeline.py | Reflows assertions/comprehensions for formatter compliance. |
| tests/a365/integration/langchain/test_message_format.py | Reflows assertions/comprehensions for formatter compliance. |
| tests/a365/integration/agentframework/test_observability_pipeline.py | Reflows assertions for formatter compliance. |
| tests/a365/integration/agentframework/test_message_format.py | Reflows async test signatures and assertions for formatter compliance. |
| tests/a365/integration/agentframework/test_agentframework_trace_processor.py | Reflows function signature and conditions for formatter compliance. |
| src/microsoft/opentelemetry/a365/runtime/operation_result.py | Updates typing to built-in generics (list[...]) and trims unused typing imports. |
| src/microsoft/opentelemetry/a365/core/message_utils.py | Reflows list comprehension formatting. |
| src/microsoft/opentelemetry/a365/core/inference_scope.py | Updates List[str] → list[str] typing. |
| src/microsoft/opentelemetry/a365/core/exporters/utils.py | Updates List[...] → list[...] typing and trims unused typing imports. |
| src/microsoft/opentelemetry/a365/core/exporters/span_processor.py | Simplifies invoke-agent detection condition formatting. |
| src/microsoft/opentelemetry/a365/core/exporters/enriched_span.py | Updates Set[str] → set[str] typing and trims unused typing imports. |
| src/microsoft/opentelemetry/_utils.py | Updates Dict[...] → dict[...] typing and trims unused typing imports. |
| src/microsoft/opentelemetry/_types.py | Uses collections.abc.Sequence instead of typing.Sequence. |
| src/microsoft/opentelemetry/_sdkstats/_utils.py | Updates Dict/Tuple typing to built-in generics and trims unused typing imports. |
| src/microsoft/opentelemetry/_sdkstats/_metrics.py | Uses collections.abc.Iterable and built-in generics typing. |
| src/microsoft/opentelemetry/_sdkstats/_constants.py | Removes stray blank line. |
| src/microsoft/opentelemetry/_instrumentation.py | Uses collections.abc.Collection instead of typing.Collection. |
| src/microsoft/opentelemetry/_genai/_openai_agents/_message_mapper.py | Simplifies conditional branches for message mapping. |
| src/microsoft/opentelemetry/_genai/_langchain/_utils.py | Removes stray blank line. |
| src/microsoft/opentelemetry/_distro.py | Updates multiple Dict/List annotations to built-in generics and trims unused typing imports. |
| src/microsoft/opentelemetry/_azure_monitor/_utils/instrumentation.py | Uses collections.abc.Collection instead of typing.Collection. |
| src/microsoft/opentelemetry/_azure_monitor/_utils/configurations.py | Updates Dict[...] to dict[...] and adjusts cast usage accordingly. |
| src/microsoft/opentelemetry/_azure_monitor/_types.py | Uses collections.abc.Sequence instead of typing.Sequence. |
| src/microsoft/opentelemetry/_azure_monitor/_diagnostics/diagnostic_logging.py | Simplifies super().__new__ call in singleton __new__. |
| src/microsoft/opentelemetry/_azure_monitor/_configure.py | Updates Dict/List typing to built-in generics and related casts. |
| src/microsoft/opentelemetry/_azure_monitor/_browser_sdk_loader/snippet_injector.py | Updates typing (Tuple → tuple, Dict → dict) and trims unused imports. |
| src/microsoft/opentelemetry/_azure_monitor/_browser_sdk_loader/django_middleware.py | Uses collections.abc.Callable instead of typing.Callable. |
| src/microsoft/opentelemetry/_azure_monitor/_browser_sdk_loader/_config.py | Updates Dict[...] to dict[...] typing. |
| samples/microsoft_agent_framework/sample_maf_agent.py | Fixes indentation for formatter compliance. |
| samples/langchain/validate_traces.py | Reflows f-strings and list comprehensions for formatter compliance. |
| samples/a365/manual_telemetry.py | Removes stray blank lines for formatter compliance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
Will keep on hold before merging. Need to get everyone's opinion of this tool vs black and pylint |
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.
No description provided.