forked from deepset-ai/haystack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'deepset-ai:main' into ci-deepset-ai#5931-isort
- Loading branch information
Showing
130 changed files
with
3,887 additions
and
648 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# If you change this name also do it in linting-skipper.yml and ci_metrics.yml | ||
name: Linting (Preview) | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "haystack/preview/**/*.py" | ||
- "test/preview/**/*.py" | ||
- "e2e/preview/**/*.py" | ||
- "**/pyproject.toml" | ||
|
||
env: | ||
PYTHON_VERSION: "3.8" | ||
|
||
jobs: | ||
mypy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
# With the default value of 1, there are corner cases where tj-actions/changed-files | ||
# fails with a `no merge base` error | ||
fetch-depth: 0 | ||
|
||
- name: Get changed files | ||
id: files | ||
uses: tj-actions/changed-files@v39 | ||
with: | ||
files: | | ||
**/*.py | ||
files_ignore: | | ||
test/** | ||
rest_api/test/** | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Install Haystack | ||
run: pip install .[dev,preview] langdetect transformers[torch,sentencepiece]==4.32.1 'sentence-transformers>=2.2.0' pypdf openai-whisper tika 'azure-ai-formrecognizer>=3.2.0b2' | ||
|
||
- name: Mypy | ||
if: steps.files.outputs.any_changed == 'true' | ||
run: | | ||
mkdir .mypy_cache/ | ||
mypy --install-types --non-interactive ${{ steps.files.outputs.all_changed_files }} --exclude=rest_api/build/ --exclude=rest_api/test/ | ||
pylint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
# With the default value of 1, there are corner cases where tj-actions/changed-files | ||
# fails with a `no merge base` error | ||
fetch-depth: 0 | ||
|
||
- name: Get changed files | ||
id: files | ||
uses: tj-actions/changed-files@v39 | ||
with: | ||
files: | | ||
**/*.py | ||
files_ignore: | | ||
test/** | ||
rest_api/test/** | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Install Haystack | ||
run: | | ||
pip install .[dev,preview] langdetect transformers[torch,sentencepiece]==4.32.1 'sentence-transformers>=2.2.0' pypdf openai-whisper tika 'azure-ai-formrecognizer>=3.2.0b2' | ||
pip install ./haystack-linter | ||
- name: Pylint | ||
if: steps.files.outputs.any_changed == 'true' | ||
run: | | ||
pylint -ry -j 0 ${{ steps.files.outputs.all_changed_files }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Verify preview imports only preview | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
paths: | ||
- "haystack/preview/**.py" | ||
|
||
jobs: | ||
verify-imports: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
# With the default value of 1, there are corner cases where tj-actions/changed-files | ||
# fails with a `no merge base` error | ||
fetch-depth: 0 | ||
|
||
- name: Get changed files | ||
id: files | ||
uses: tj-actions/changed-files@v39 | ||
with: | ||
files: | | ||
haystack/preview/**.py | ||
- name: Check imports | ||
shell: python | ||
run: | | ||
import re | ||
regex = r"^(from haystack|import haystack)(?!\.preview| import preview)(.*)" | ||
changed_files = "${{ steps.files.outputs.all_changed_files }}".split() | ||
matches = {} | ||
for path in changed_files: | ||
with open(path, "r") as f: | ||
file_matches = [] | ||
for line in f.readlines(): | ||
file_matches.extend(re.finditer(regex, line.strip())) | ||
if file_matches: | ||
matches[path] = file_matches | ||
for path, match in matches.items(): | ||
print(f"Bad imports in file '{path}'") | ||
for m in match: | ||
print(m.group()) | ||
print() | ||
if matches: | ||
print("::error:: Imports in haystack.preview can only import from haystack.preview") | ||
import sys; sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.