Skip to content

Commit

Permalink
Merge branch 'main' into add_default_adapter_filters
Browse files Browse the repository at this point in the history
  • Loading branch information
vblagoje committed Feb 27, 2024
2 parents d3854e3 + 2a59128 commit 58ae2f5
Show file tree
Hide file tree
Showing 35 changed files with 500 additions and 1,005 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/docstring_labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
paths:
- "haystack/**/*.py"

env:
PYTHON_VERSION: "3.11"

jobs:
label:
runs-on: ubuntu-latest
Expand All @@ -24,7 +27,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "${{ env.PYTHON_VERSION }}"

- name: Get docstrings
id: base-docstrings
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
env:
PYTHON_VERSION: "3.8"
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
HATCH_VERSION: "1.9.3"

jobs:
run:
Expand All @@ -28,15 +29,10 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install dependencies
run: |
sudo apt-get update
sudo apt install ffmpeg # for local Whisper tests
- name: Install Haystack and the dependencies needed for tests
run: pip install -r test/test_requirements.txt
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Run tests
run: pytest e2e
run: hatch run test:e2e
3 changes: 2 additions & 1 deletion .github/workflows/license_compliance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

env:
CORE_DATADOG_API_KEY: ${{ secrets.CORE_DATADOG_API_KEY }}
PYTHON_VERSION: "3.10"

jobs:
license_check_direct:
Expand All @@ -25,7 +26,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "${{ env.PYTHON_VERSION }}"

- name: Get direct dependencies
run: |
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:

env:
PYTHON_VERSION: "3.8"
HATCH_VERSION: "1.9.3"

jobs:
mypy:
Expand All @@ -35,19 +36,16 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install Haystack
run: pip install .[dev]

- name: Install the dependencies needed for tests
run: pip install -r test/test_requirements.txt
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Mypy
if: steps.files.outputs.any_changed == 'true'
run: |
mkdir .mypy_cache
mypy --install-types --non-interactive --cache-dir=.mypy_cache/ ${{ steps.files.outputs.all_changed_files }}
hatch run test:types ${{ steps.files.outputs.all_changed_files }}
pylint:
runs-on: ubuntu-latest
Expand All @@ -68,12 +66,12 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install Haystack and the dependencies needed for tests
run: pip install -r test/test_requirements.txt
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Pylint
if: steps.files.outputs.any_changed == 'true'
run: |
pylint -ry -j 0 ${{ steps.files.outputs.all_changed_files }}
hatch run test:lint ${{ steps.files.outputs.all_changed_files }}
2 changes: 1 addition & 1 deletion .github/workflows/minor_version_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install release_docs.py dependencies
run: pip install requests
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- "v[0-9].[0-9]+.[0-9]+*"

env:
HATCH_VERSION: "1.9.3"

jobs:
release-on-pypi:
runs-on: ubuntu-latest
Expand All @@ -14,7 +17,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Hatch
run: pip install hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Build Haystack
run: hatch build
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/readme_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches:
- main

env:
HATCH_VERSION: "1.9.3"
PYTHON_VERSION: "3.10"

jobs:
sync:
runs-on: ubuntu-latest
Expand All @@ -18,20 +22,18 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U haystack-pydoc-tools
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Generate API docs
env:
# This is necessary to fetch the documentation categories
# from Readme.io as we need them to associate the slug
# in config files with their id.
README_API_KEY: ${{ secrets.README_API_KEY }}
run: ./.github/utils/pydoc-markdown.sh
run: hatch run readme:sync

- name: Sync docs with 2.0
# Sync the docs to the `2.0` version on Readme
Expand Down
45 changes: 9 additions & 36 deletions .github/workflows/snippets_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
PYTHON_VERSION: "3.8"
HATCH_VERSION: "1.9.3"

jobs:
black:
Expand All @@ -26,38 +27,13 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install Black
run: |
pip install --upgrade pip
pip install .[dev]
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Check status
run: |
if ! black . --check; then
git status
echo "###################################################################################################"
echo "# "
echo "# CHECK FAILED! Black found issues with your code formatting."
echo "# "
echo "# Either:"
echo "# 1. Run Black locally before committing:"
echo "# "
echo "# pip install .[formatting]"
echo "# black ."
echo "# "
echo "# 2. Install the pre-commit hook:"
echo "# "
echo "# pre-commit install"
echo "# "
echo "# 3. See https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md for help."
echo "# "
echo "# If you have further problems, please open an issue: https://github.com/deepset-ai/haystack/issues"
echo "# "
echo "##################################################################################################"
exit 1
fi
run: hatch run default:format-check

- name: Calculate alert data
id: calculator
Expand Down Expand Up @@ -100,13 +76,10 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install snippets dependencies
run: |
pip install --upgrade pip
pip install "." torch
pip install pydantic
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Get changed files
id: files
Expand All @@ -119,7 +92,7 @@ jobs:
run: |
CHANGED_FILES=${{ steps.files.outputs.all_changed_files }}
for file in $CHANGED_FILES; do
python "$file"
hatch run snippets:python "$file"
done
- name: Calculate alert data
Expand Down
41 changes: 20 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYTHON_VERSION: "3.8"
HATCH_VERSION: "1.9.3"

jobs:
black:
Expand All @@ -38,19 +39,13 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install Black
run: |
pip install --upgrade pip
pip install .[dev]
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Check status
run: |
if ! black . --check; then
git status
exit 1
fi
run: hatch run default:format-check

- name: Calculate alert data
id: calculator
Expand Down Expand Up @@ -96,10 +91,14 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install Haystack and the dependencies needed for tests
run: pip install -r test/test_requirements.txt
- name: Install Hatch
run: pip install hatch==${{ env.HATCH_VERSION }}

- name: Install dependencies
# To actually install and sync the dependencies
run: hatch run test:pip list

- uses: actions/cache@v4
with:
Expand All @@ -122,7 +121,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Restore Python dependencies
uses: actions/cache/restore@v4
Expand All @@ -131,7 +130,7 @@ jobs:
key: pip-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('pyproject.toml', 'test/test_requirements.txt') }}

- name: Run
run: pytest --cov-report xml:coverage.xml --cov="haystack" -m "not integration" test
run: hatch run test:unit

- name: Coveralls
# We upload only coverage for ubuntu as handling both os
Expand Down Expand Up @@ -186,7 +185,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install dependencies
run: |
Expand All @@ -200,7 +199,7 @@ jobs:
key: pip-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('pyproject.toml', 'test/test_requirements.txt') }}

- name: Run
run: pytest --maxfail=5 -m "integration" test
run: hatch run test:integration

- name: Calculate alert data
id: calculator
Expand Down Expand Up @@ -245,7 +244,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install dependencies
run: |
Expand All @@ -258,7 +257,7 @@ jobs:
key: pip-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('pyproject.toml', 'test/test_requirements.txt') }}

- name: Run
run: pytest --maxfail=5 -m "integration" test -k 'not tika'
run: hatch run test:integration-mac

- name: Calculate alert data
id: calculator
Expand Down Expand Up @@ -300,7 +299,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: "${{ env.PYTHON_VERSION }}"

- name: Restore Python dependencies
uses: actions/cache/restore@v4
Expand All @@ -309,7 +308,7 @@ jobs:
key: pip-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('pyproject.toml', 'test/test_requirements.txt') }}

- name: Run
run: pytest --maxfail=5 -m "integration" test -k 'not tika'
run: hatch run test:integration-windows

- name: Calculate alert data
id: calculator
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ WORKDIR /opt/haystack
RUN python3 -m venv --system-site-packages /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

# Upgrade setuptools due to https://nvd.nist.gov/vuln/detail/CVE-2022-40897
RUN pip install --upgrade pip && \
pip install --no-cache-dir -U setuptools && \
pip install --no-cache-dir .

FROM $base_image AS final
Expand Down

0 comments on commit 58ae2f5

Please sign in to comment.