-
Notifications
You must be signed in to change notification settings - Fork 19.9k
chore(langchain): cleanup ruff config #32810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
d14e4fa to
59398e8
Compare
CodSpeed WallTime Performance ReportMerging #32810 will not alter performanceComparing
|
CodSpeed Instrumentation Performance ReportMerging #32810 will not alter performanceComparing Summary
|
59398e8 to
d64fe41
Compare
0982a5d to
2e4faa7
Compare
langchain_v1 ruff config
94b4082 to
72ec713
Compare
libs/langchain_v1/langchain/agents/middleware/prompt_caching.py
Outdated
Show resolved
Hide resolved
libs/langchain_v1/langchain/agents/middleware/prompt_caching.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
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 cleans up the ruff configuration for langchain_v1 by removing outdated per-file ignores and applying various linting fixes across the codebase. The changes include updating ruff version constraints, consolidating linting rules, and implementing hundreds of code quality improvements.
Key Changes:
- Simplified ruff configuration by removing complex per-file ignore patterns
- Updated code to comply with modern Python linting standards including proper import ordering, exception handling, and naming conventions
- Removed unused test utilities and improved type annotations throughout
Reviewed Changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| libs/langchain_v1/pyproject.toml | Updated ruff configuration with simplified rules and version constraints |
| libs/langchain_v1/tests/unit_tests/stubs.py | Removed entire file containing unused test stub utilities |
| libs/langchain_v1/tests/unit_tests/embeddings/test_caching.py | Added @OverRide decorators to MockEmbeddings methods |
| libs/langchain_v1/tests/unit_tests/embeddings/test_base.py | Fixed regex pattern in pytest.raises assertion |
| libs/langchain_v1/tests/unit_tests/chat_models/test_chat_models.py | Fixed regex pattern in pytest.raises assertion |
| libs/langchain_v1/tests/unit_tests/agents/test_tool_node.py | Added periods to docstrings and improved exception handling |
| libs/langchain_v1/tests/unit_tests/agents/test_return_direct_spec.py | Added keyword-only parameter to _make_tool function |
| libs/langchain_v1/tests/unit_tests/agents/test_responses_spec.py | Renamed variable from InputModel to input_model for naming consistency |
| libs/langchain_v1/tests/unit_tests/agents/test_responses.py | Replaced string equality checks with truthiness checks |
| libs/langchain_v1/tests/unit_tests/agents/test_response_format.py | Improved import ordering and docstring formatting |
| libs/langchain_v1/tests/unit_tests/agents/test_react_agent.py | Multiple improvements including variable naming, exception handling, and docstring formatting |
| libs/langchain_v1/tests/unit_tests/agents/test_middleware_agent.py | Improved import ordering and exception handling patterns |
| libs/langchain_v1/tests/unit_tests/agents/model.py | Added period to docstring |
| libs/langchain_v1/tests/unit_tests/agents/messages.py | Added noqa comments for function naming conventions |
| libs/langchain_v1/tests/unit_tests/agents/conftest.py | Changed tuple to set for membership testing |
| libs/langchain_v1/tests/unit_tests/agents/any_str.py | Added slots definition to AnyStr class |
| libs/langchain_v1/tests/integration_tests/chat_models/test_base.py | Renamed class from multiply to Multiply for proper naming |
| libs/langchain_v1/tests/integration_tests/cache/fake_embeddings.py | Added @OverRide decorators to embedding methods |
| libs/langchain_v1/scripts/check_imports.py | Improved docstring formatting |
| libs/langchain_v1/langchain/chat_models/base.py | Added @OverRide decorators and improved string splitting logic |
| libs/langchain_v1/langchain/agents/tool_node.py | Renamed parameter from input to input_ and improved exception handling |
| libs/langchain_v1/langchain/agents/structured_output.py | Changed tuple to set for membership testing |
| libs/langchain_v1/langchain/agents/react_agent.py | Improved variable naming and exception handling |
| libs/langchain_v1/langchain/agents/middleware_agent.py | Improved exception chaining |
| libs/langchain_v1/langchain/agents/middleware/summarization.py | Improved exception handling patterns |
| libs/langchain_v1/langchain/agents/middleware/prompt_caching.py | Renamed parameter from type to cache_type and improved exception handling |
| libs/langchain_v1/langchain/agents/interrupt.py | Reordered Union type arguments |
| libs/langchain_v1/langchain/_internal/_prompts.py | Reordered Union type arguments |
| libs/langchain_v1/langchain/init.py | Removed noqa comment for ANN401 rule |
libs/langchain_v1/langchain/agents/middleware/prompt_caching.py
Outdated
Show resolved
Hide resolved
|
hmm |
66cb167 to
e131f7a
Compare
|
@cbornet happy to try to help move this forward now that we're settled on v1 :) |
75f99ee to
fff52f9
Compare
|
@sydney-runkle thanks! I rebased to fix the latest conflicts. |
mdrxy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good with me other than the comment
| def __init__( | ||
| self, | ||
| pii_type: Literal["email", "credit_card", "ip", "mac_address", "url"] | str, # noqa: PYI051 | ||
| pii_type: str, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, however, the Literal definitions allow for IDE auto-completion/to display a list of valid options. I think this is better DevX even if it isn't the most efficient.
|
off to @sydney-runkle for approval |
8d31981 to
87f2a8b
Compare
8f9c1fe to
241dd37
Compare
|
Hi @sydney-runkle , can you review this PR ? It applies reordering of the imports so it has a great tendency of conflicting. |
241dd37 to
5a2b067
Compare
5a2b067 to
47e8382
Compare
47e8382 to
6109991
Compare
No description provided.