Skip to content

Conversation

@cbornet
Copy link
Collaborator

@cbornet cbornet commented Oct 28, 2025

No description provided.

@cbornet cbornet requested a review from eyurtsev as a code owner October 28, 2025 18:23
@github-actions github-actions bot added core Related to the package `langchain-core` dependencies Pull requests that update a dependency file infra Chores, devops, repo meta changes labels Oct 28, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 28, 2025

CodSpeed Performance Report

Merging #33706 will not alter performance

Comparing cbornet:core-plr2004 (dfb5904) with master (d1e2099)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 13 untouched
⏩ 21 skipped1

Footnotes

  1. 21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@mdrxy mdrxy changed the title chore(core): add ruff rule PLR2004 chore(core): add ruff rule PLR2004 Oct 28, 2025
@github-actions github-actions bot added infra Chores, devops, repo meta changes and removed infra Chores, devops, repo meta changes labels Oct 28, 2025
@mdrxy mdrxy requested a review from Copilot November 4, 2025 18:22
Copy link
Contributor

Copilot AI left a 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 removes the ruff linting rule PLR2004 (comparison to magic numbers) from the global ignore list and replaces hardcoded numeric literals throughout the codebase with named constants to improve code readability and maintainability.

  • Extracted magic numbers into descriptive named constants across multiple files
  • Improved error handling for tuple unpacking operations with better exception chaining
  • Hardcoded Pydantic version flags to v2 only
  • Fixed minor issues in error message formatting and conditional logic

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
libs/core/pyproject.toml Enabled PLR2004 rule globally, kept disabled for tests
libs/core/langchain_core/utils/pydantic.py Hardcoded Pydantic version flags to v2 values
libs/core/langchain_core/utils/function_calling.py Replaced magic number 2 with named constant _MIN_DOCSTRING_BLOCKS
libs/core/langchain_core/tools/base.py Improved tuple unpacking error handling and updated error message
libs/core/langchain_core/runnables/graph_mermaid.py Replaced magic number 500 with requests.codes.internal_server_error
libs/core/langchain_core/runnables/branch.py Replaced magic number 2 with named constant _MIN_BRANCHES
libs/core/langchain_core/runnables/base.py Replaced multiple magic numbers with named constants
libs/core/langchain_core/prompts/chat.py Improved tuple unpacking validation with better error handling
libs/core/langchain_core/messages/utils.py Improved tuple unpacking with try-except pattern
libs/core/langchain_core/language_models/chat_models.py Replaced magic number 100 with named constant _MAX_CLEANUP_DEPTH

@mdrxy mdrxy merged commit 915c446 into langchain-ai:master Nov 4, 2025
89 checks passed
@cbornet cbornet deleted the core-plr2004 branch November 4, 2025 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Related to the package `langchain-core` dependencies Pull requests that update a dependency file infra Chores, devops, repo meta changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants