From 15d560220aaf8928f7c864aba67d24adac8645ac Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 7 Feb 2025 09:44:48 -0800 Subject: [PATCH] infra: cleanup ci step --- .github/workflows/_lint.yml | 38 +---------------------------------- libs/partners/openai/Makefile | 19 ++++++++++++------ 2 files changed, 14 insertions(+), 43 deletions(-) diff --git a/.github/workflows/_lint.yml b/.github/workflows/_lint.yml index 417ca68b6d7..2764f206771 100644 --- a/.github/workflows/_lint.yml +++ b/.github/workflows/_lint.yml @@ -33,44 +33,8 @@ jobs: with: python-version: ${{ inputs.python-version }} - - name: Install dependencies - # Also installs dev/lint/test/typing dependencies, to ensure we have - # type hints for as many of our libraries as possible. - # This helps catch errors that require dependencies to be spotted, for example: - # https://github.com/langchain-ai/langchain/pull/10249/files#diff-935185cd488d015f026dcd9e19616ff62863e8cde8c0bee70318d3ccbca98341 - # - # If you change this configuration, make sure to change the `cache-key` - # in the `poetry_setup` action above to stop using the old cache. - # It doesn't matter how you change it, any change will cause a cache-bust. - working-directory: ${{ inputs.working-directory }} - run: | - uv sync --group lint --group typing - - name: Analysing the code with our lint working-directory: ${{ inputs.working-directory }} run: | - make lint_package + make lint - - name: Install unit test dependencies - # Also installs dev/lint/test/typing dependencies, to ensure we have - # type hints for as many of our libraries as possible. - # This helps catch errors that require dependencies to be spotted, for example: - # https://github.com/langchain-ai/langchain/pull/10249/files#diff-935185cd488d015f026dcd9e19616ff62863e8cde8c0bee70318d3ccbca98341 - # - # If you change this configuration, make sure to change the `cache-key` - # in the `poetry_setup` action above to stop using the old cache. - # It doesn't matter how you change it, any change will cause a cache-bust. - if: ${{ ! startsWith(inputs.working-directory, 'libs/partners/') }} - working-directory: ${{ inputs.working-directory }} - run: | - uv sync --group test - - name: Install unit+integration test dependencies - if: ${{ startsWith(inputs.working-directory, 'libs/partners/') }} - working-directory: ${{ inputs.working-directory }} - run: | - uv sync --group test --group test_integration - - - name: Analysing the code with our lint - working-directory: ${{ inputs.working-directory }} - run: | - make lint_tests diff --git a/libs/partners/openai/Makefile b/libs/partners/openai/Makefile index 7eca148a4a0..c2c7d604d6e 100644 --- a/libs/partners/openai/Makefile +++ b/libs/partners/openai/Makefile @@ -43,14 +43,21 @@ lint_package: PYTHON_FILES=langchain_openai lint_tests: PYTHON_FILES=tests lint_tests: MYPY_CACHE=.mypy_cache_test -lint lint_diff lint_package lint_tests: - [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff check $(PYTHON_FILES) - [ "$(PYTHON_FILES)" = "" ] || uv run --all-groups ruff format $(PYTHON_FILES) --diff - [ "$(PYTHON_FILES)" = "" ] || mkdir -p $(MYPY_CACHE) && uv run --all-groups mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE) +lint_package: + [ "$(PYTHON_FILES)" = "" ] || uv run --group lint ruff check $(PYTHON_FILES) + [ "$(PYTHON_FILES)" = "" ] || uv run --group lint ruff format $(PYTHON_FILES) --diff + [ "$(PYTHON_FILES)" = "" ] || mkdir -p $(MYPY_CACHE) && uv run --group lint --group typing mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE) + +lint_tests: + [ "$(PYTHON_FILES)" = "" ] || uv run --group lint ruff check $(PYTHON_FILES) + [ "$(PYTHON_FILES)" = "" ] || uv run --group lint ruff format $(PYTHON_FILES) --diff + [ "$(PYTHON_FILES)" = "" ] || mkdir -p $(MYPY_CACHE) && uv run --group lint --group typing --group test mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE) + +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 --group lint ruff format $(PYTHON_FILES) + [ "$(PYTHON_FILES)" = "" ] || uv run --group lint ruff check --select I --fix $(PYTHON_FILES) spell_check: uv run --all-groups codespell --toml pyproject.toml