From 93260a9922ec76aa4a2977774e8ef44ab281ddd7 Mon Sep 17 00:00:00 2001 From: Martin Krasser Date: Thu, 27 Jul 2023 10:56:55 +0200 Subject: [PATCH] Fix broken `make` targets `format_diff` and `lint_diff` (#8344) Since the refactoring into sub-projects `libs/langchain` and `libs/experimental`, the `make` targets `format_diff` and `lint_diff` do not work anymore when running `make` from these subdirectories. Reason is that ``` PYTHON_FILES=$(shell git diff --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$') ``` generates paths from the project's root directory instead of the corresponding subdirectories. This PR fixes this by adding a `--relative` command line option. - Tag maintainer: @baskaryan --- libs/experimental/Makefile | 2 +- libs/langchain/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/experimental/Makefile b/libs/experimental/Makefile index 1f025fc2cde..ede2c85b47f 100644 --- a/libs/experimental/Makefile +++ b/libs/experimental/Makefile @@ -23,7 +23,7 @@ test_watch: # Define a variable for Python and notebook files. PYTHON_FILES=. lint format: PYTHON_FILES=. -lint_diff format_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$') +lint_diff format_diff: PYTHON_FILES=$(shell git diff --relative=libs/experimental --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$') lint lint_diff: poetry run mypy $(PYTHON_FILES) diff --git a/libs/langchain/Makefile b/libs/langchain/Makefile index e81add90a86..ba27b07f376 100644 --- a/libs/langchain/Makefile +++ b/libs/langchain/Makefile @@ -70,7 +70,7 @@ docker_tests: # Define a variable for Python and notebook files. PYTHON_FILES=. lint format: PYTHON_FILES=. -lint_diff format_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$') +lint_diff format_diff: PYTHON_FILES=$(shell git diff --relative=libs/langchain --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$') lint lint_diff: poetry run mypy $(PYTHON_FILES)