From cf47abdff5c0eb61567421aaeb36dd2fc82bea1e Mon Sep 17 00:00:00 2001 From: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com> Date: Fri, 15 Dec 2023 16:40:41 +0100 Subject: [PATCH] chore: simplify the management of test dependencies (#6559) * remove audio dep group * extract dependencies * beautify * rm one step --- .github/workflows/e2e.yml | 4 ++-- .github/workflows/linting.yml | 10 ++++++---- .github/workflows/tests.yml | 16 ++++++++-------- pyproject.toml | 4 ---- test/test_requirements.txt | 16 ++++++++++++++++ 5 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 test/test_requirements.txt diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 03146fd3b..694b39e16 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -35,8 +35,8 @@ jobs: sudo apt-get update sudo apt install ffmpeg # for local Whisper tests - - name: Install Haystack - run: pip install .[dev,audio] langdetect transformers[torch,sentencepiece]==4.35.2 'sentence-transformers>=2.2.0' pypdf tika 'azure-ai-formrecognizer>=3.2.0b2' + - name: Install Haystack and the dependencies needed for tests + run: pip install -r test/test_requirements.txt - name: Run tests run: pytest e2e diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index b88a23954..ada7c8fa5 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -38,7 +38,10 @@ jobs: python-version: ${{ env.PYTHON_VERSION }} - name: Install Haystack - run: pip install .[dev,audio] langdetect transformers[torch,sentencepiece]==4.35.2 'sentence-transformers>=2.2.0' pypdf tika 'azure-ai-formrecognizer>=3.2.0b2' + run: pip install .[dev] + + - name: Install the dependencies needed for tests + run: pip install -r test/test_requirements.txt - name: Mypy if: steps.files.outputs.any_changed == 'true' @@ -67,9 +70,8 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - - name: Install Haystack - run: | - pip install .[dev,audio] langdetect transformers[torch,sentencepiece]==4.35.2 'sentence-transformers>=2.2.0' pypdf markdown-it-py mdit_plain tika 'azure-ai-formrecognizer>=3.2.0b2' + - name: Install Haystack and the dependencies needed for tests + run: pip install -r test/test_requirements.txt - name: Pylint if: steps.files.outputs.any_changed == 'true' diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 165f3bb20..b1b7f4e76 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -97,8 +97,8 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - - name: Install Haystack - run: pip install .[dev,audio] langdetect transformers[torch,sentencepiece]==4.35.2 'sentence-transformers>=2.2.0' pypdf markdown-it-py mdit_plain tika 'azure-ai-formrecognizer>=3.2.0b2' + - name: Install Haystack and the dependencies needed for tests + run: pip install -r test/test_requirements.txt - name: Run run: pytest -m "not integration" test @@ -155,8 +155,8 @@ jobs: sudo apt update sudo apt install ffmpeg # for local Whisper tests - - name: Install Haystack - run: pip install .[dev,audio] langdetect transformers[torch,sentencepiece]==4.35.2 'sentence-transformers>=2.2.0' pypdf markdown-it-py mdit_plain tika 'azure-ai-formrecognizer>=3.2.0b2' + - name: Install Haystack and the dependencies needed for tests + run: pip install -r test/test_requirements.txt - name: Run run: pytest --maxfail=5 -m "integration" test @@ -211,8 +211,8 @@ jobs: brew install docker colima start - - name: Install Haystack - run: pip install .[dev,audio] langdetect transformers[torch,sentencepiece]==4.35.2 'sentence-transformers>=2.2.0' pypdf markdown-it-py mdit_plain tika 'azure-ai-formrecognizer>=3.2.0b2' + - name: Install Haystack and the dependencies needed for tests + run: pip install -r test/test_requirements.txt - name: Run Tika run: docker run -d -p 9998:9998 apache/tika:2.9.0.0 @@ -262,8 +262,8 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} - - name: Install Haystack - run: pip install .[dev,audio] langdetect transformers[torch,sentencepiece]==4.35.2 'sentence-transformers>=2.2.0' pypdf markdown-it-py mdit_plain tika 'azure-ai-formrecognizer>=3.2.0b2' + - name: Install Haystack and the dependencies needed for tests + run: pip install -r test/test_requirements.txt - name: Run run: pytest --maxfail=5 -m "integration" test -k 'not tika' diff --git a/pyproject.toml b/pyproject.toml index b33455163..abf25961d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,10 +90,6 @@ dev = [ "black[jupyter]~=23.0", ] -audio = [ - "openai-whisper>=20231106" -] - [project.urls] "CI: GitHub" = "https://github.com/deepset-ai/haystack/actions" "Docs: RTD" = "https://haystack.deepset.ai/overview/intro" diff --git a/test/test_requirements.txt b/test/test_requirements.txt new file mode 100644 index 000000000..6ba925805 --- /dev/null +++ b/test/test_requirements.txt @@ -0,0 +1,16 @@ +.[dev] + +# Package Components + +transformers[torch,sentencepiece]==4.35.2 # ExtractiveReader, TransformersSimilarityRanker, LocalWhisperTranscriber, HFGenerators... + +# Converters +pypdf # PyPDFConverter +markdown-it-py # MarkdownToDocument +mdit_plain # MarkdownToDocument +tika # TikaDocumentConverter +azure-ai-formrecognizer>=3.2.0b2 # AzureOCRDocumentConverter + +langdetect # TextLanguageRouter and DocumentLanguageClassifier +sentence-transformers>=2.2.0 # SentenceTransformersTextEmbedder and SentenceTransformersDocumentEmbedder +openai-whisper>=20231106 # LocalWhisperTranscriber