The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
fix: automatically fix issues with ruff (#31897)
Mason Daugherty706a66eccd9f
diff --git a/Makefile b/Makefileindex e295c066dd..f5e750c637 100644--- a/Makefile+++ b/Makefile@@ -71,7 +71,7 @@ spell_fix:lint lint_package lint_tests:uv run --group lint ruff check docs cookbookuv run --group lint ruff format docs cookbook cookbook --diff- uv run --group lint ruff check --select I docs cookbook+ uv run --group lint ruff check docs cookbookgit --no-pager grep 'from langchain import' docs cookbook | grep -vE 'from langchain import (hub)' && echo "Error: no importing langchain from root in docs, except for hub" && exit 1 || exit 0git --no-pager grep 'api.python.langchain.com' -- docs/docs ':!docs/docs/additional_resources/arxiv_references.mdx' ':!docs/docs/integrations/document_loaders/sitemap.ipynb' || exit 0 && \@@ -81,7 +81,7 @@ lint lint_package lint_tests:## format: Format the project files.format format_diff:uv run --group lint ruff format docs cookbook- uv run --group lint ruff check --select I --fix docs cookbook+ uv run --group lint ruff check --fix docs cookbookupdate-package-downloads:uv run python docs/scripts/packages_yml_get_downloads.pydiff --git a/libs/cli/Makefile b/libs/cli/Makefileindex b62dc1ab70..1dbec29a61 100644--- a/libs/cli/Makefile+++ b/libs/cli/Makefile@@ -22,7 +22,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --group typing --group lint ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --group typing --group lint ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --group typing --group lint ruff check --fix $(PYTHON_FILES)test tests: _test _e2e_testdiff --git a/libs/langchain/Makefile b/libs/langchain/Makefileindex c5705e34ff..f08261b350 100644--- a/libs/langchain/Makefile+++ b/libs/langchain/Makefile@@ -64,7 +64,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/anthropic/Makefile b/libs/partners/anthropic/Makefileindex 917ad66dde..494352a0ed 100644--- a/libs/partners/anthropic/Makefile+++ b/libs/partners/anthropic/Makefile@@ -43,7 +43,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/chroma/Makefile b/libs/partners/chroma/Makefileindex acd70b4a22..ea9fe087c3 100644--- a/libs/partners/chroma/Makefile+++ b/libs/partners/chroma/Makefile@@ -41,7 +41,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/deepseek/Makefile b/libs/partners/deepseek/Makefileindex c32b67ebad..08cefe3a33 100644--- a/libs/partners/deepseek/Makefile+++ b/libs/partners/deepseek/Makefile@@ -42,7 +42,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/exa/Makefile b/libs/partners/exa/Makefileindex c467487d30..ce85556f3f 100644--- a/libs/partners/exa/Makefile+++ b/libs/partners/exa/Makefile@@ -41,7 +41,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/fireworks/Makefile b/libs/partners/fireworks/Makefileindex cc8d95e4c5..7cb001a6fe 100644--- a/libs/partners/fireworks/Makefile+++ b/libs/partners/fireworks/Makefile@@ -40,7 +40,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/groq/Makefile b/libs/partners/groq/Makefileindex b6d880613b..e0981cec45 100644--- a/libs/partners/groq/Makefile+++ b/libs/partners/groq/Makefile@@ -41,7 +41,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/huggingface/Makefile b/libs/partners/huggingface/Makefileindex d69d408c86..a6564f43df 100644--- a/libs/partners/huggingface/Makefile+++ b/libs/partners/huggingface/Makefile@@ -41,7 +41,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/mistralai/Makefile b/libs/partners/mistralai/Makefileindex 9b84121b82..ede572f9e4 100644--- a/libs/partners/mistralai/Makefile+++ b/libs/partners/mistralai/Makefile@@ -43,7 +43,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/nomic/Makefile b/libs/partners/nomic/Makefileindex d10dda0879..0b6e5c3bab 100644--- a/libs/partners/nomic/Makefile+++ b/libs/partners/nomic/Makefile@@ -41,7 +41,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/ollama/Makefile b/libs/partners/ollama/Makefileindex 5c3c15e5c2..97b63798e9 100644--- a/libs/partners/ollama/Makefile+++ b/libs/partners/ollama/Makefile@@ -47,7 +47,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/openai/Makefile b/libs/partners/openai/Makefileindex b77a173137..512cff409e 100644--- a/libs/partners/openai/Makefile+++ b/libs/partners/openai/Makefile@@ -54,7 +54,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/perplexity/Makefile b/libs/partners/perplexity/Makefileindex 12b9e8b730..9bff295322 100644--- a/libs/partners/perplexity/Makefile+++ b/libs/partners/perplexity/Makefile@@ -40,7 +40,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/prompty/Makefile b/libs/partners/prompty/Makefileindex 9f9e6f5d7a..3df127b25e 100644--- a/libs/partners/prompty/Makefile+++ b/libs/partners/prompty/Makefile@@ -39,7 +39,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/qdrant/Makefile b/libs/partners/qdrant/Makefileindex cd53df9d78..1c78ffd21e 100644--- a/libs/partners/qdrant/Makefile+++ b/libs/partners/qdrant/Makefile@@ -42,7 +42,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/partners/xai/Makefile b/libs/partners/xai/Makefileindex 2d3eafc0ae..92198d1a52 100644--- a/libs/partners/xai/Makefile+++ b/libs/partners/xai/Makefile@@ -40,7 +40,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/standard-tests/Makefile b/libs/standard-tests/Makefileindex 8fa7c0bbaa..afa0913448 100644--- a/libs/standard-tests/Makefile+++ b/libs/standard-tests/Makefile@@ -39,7 +39,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/libs/text-splitters/Makefile b/libs/text-splitters/Makefileindex e76de79860..7ee6d99a5c 100644--- a/libs/text-splitters/Makefile+++ b/libs/text-splitters/Makefile@@ -49,7 +49,7 @@ lint lint_diff lint_package lint_tests:format format_diff:[ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES)- [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --select I --fix $(PYTHON_FILES)+ [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check --fix $(PYTHON_FILES)spell_check:uv run --all-groups codespell --toml pyproject.tomldiff --git a/scripts/update_mypy_ruff.py b/scripts/update_mypy_ruff.pyindex fb085da5bf..3bfd143969 100644--- a/scripts/update_mypy_ruff.py+++ b/scripts/update_mypy_ruff.py@@ -32,7 +32,7 @@ def main():cwd = "/".join(path.split("/")[:-1])subprocess.run(- "poetry lock --no-update; poetry install --with lint; poetry run ruff format .; poetry run ruff --select I --fix .",+ "poetry lock --no-update; poetry install --with lint; poetry run ruff format .; poetry run ruff --fix .",cwd=cwd,shell=True,capture_output=True,@@ -74,12 +74,13 @@ def main():f.write("".join(file_lines))subprocess.run(- "poetry lock --no-update; poetry install --with lint; poetry run ruff format .; poetry run ruff --select I --fix .",+ "poetry lock --no-update; poetry install --with lint; poetry run ruff format .; poetry run ruff --fix .",cwd=cwd,shell=True,capture_output=True,text=True,)+if __name__ == "__main__":main()