From 24a0b7fbfeebc4b3d7cef3560bc23a74796c708f Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Wed, 22 May 2024 08:37:46 +0200 Subject: [PATCH] fix --- .github/actionlint.yml | 3 - .github/workflows/docstrings_linting.yml | 20 -- .github/workflows/licensing.yml | 18 + .github/workflows/linting.yml | 84 ----- .github/workflows/linting_skipper.yml | 29 -- .github/workflows/pypi_release.yml | 4 +- .github/workflows/stale.yml | 15 - .github/workflows/tests.yml | 329 ++----------------- .github/workflows/tests_skipper_trigger.yml | 46 --- .github/workflows/tests_skipper_workflow.yml | 24 -- haystack_experimental/__init__.py | 3 + haystack_experimental/version.py | 7 +- pyproject.toml | 171 ++-------- releasenotes/config.yaml | 47 --- test/test_experimental.py | 2 + 15 files changed, 79 insertions(+), 723 deletions(-) delete mode 100644 .github/actionlint.yml delete mode 100644 .github/workflows/docstrings_linting.yml create mode 100644 .github/workflows/licensing.yml delete mode 100644 .github/workflows/linting.yml delete mode 100644 .github/workflows/linting_skipper.yml delete mode 100644 .github/workflows/stale.yml delete mode 100644 .github/workflows/tests_skipper_trigger.yml delete mode 100644 .github/workflows/tests_skipper_workflow.yml create mode 100644 haystack_experimental/__init__.py delete mode 100644 releasenotes/config.yaml create mode 100644 test/test_experimental.py diff --git a/.github/actionlint.yml b/.github/actionlint.yml deleted file mode 100644 index 60646952..00000000 --- a/.github/actionlint.yml +++ /dev/null @@ -1,3 +0,0 @@ -self-hosted-runner: - # Labels of self-hosted runner in array of string - labels: ["cml", "ubuntu-latest-4-cores"] diff --git a/.github/workflows/docstrings_linting.yml b/.github/workflows/docstrings_linting.yml deleted file mode 100644 index ba530e53..00000000 --- a/.github/workflows/docstrings_linting.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: run docstrings linting - -on: - push: - branches: - - docstrings-linting - -jobs: - docstrings-linting: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Hatch - run: pip install hatch=="1.9.3" - - - name: ruff docstrings linting - run: hatch run ruff check haystack-experimental diff --git a/.github/workflows/licensing.yml b/.github/workflows/licensing.yml new file mode 100644 index 00000000..ebaf4556 --- /dev/null +++ b/.github/workflows/licensing.yml @@ -0,0 +1,18 @@ +name: Licensing + +on: + pull_request: + paths: + - "haystack_experimental/**/*.py" + - "test/**/*.py" + - "pyproject.toml" + +jobs: + license-header: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check License Header + run: docker run --rm -v "$(pwd):/github/workspace" ghcr.io/korandoru/hawkeye check diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml deleted file mode 100644 index 75b76f61..00000000 --- a/.github/workflows/linting.yml +++ /dev/null @@ -1,84 +0,0 @@ -# If you change this name also do it in linting-skipper.yml and ci_metrics.yml -name: Linting - -on: - pull_request: - paths: - - "haystack-experimental/**/*.py" - - "test/**/*.py" - - "pyproject.toml" - -env: - PYTHON_VERSION: "3.8" - HATCH_VERSION: "1.9.3" - -jobs: - license-header: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Check License Header - run: docker run --rm -v "$(pwd):/github/workspace" ghcr.io/korandoru/hawkeye check - - 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@v44 - with: - files: | - **/*.py - files_ignore: | - test/** - - - uses: actions/setup-python@v5 - with: - python-version: "${{ env.PYTHON_VERSION }}" - - - name: Install Hatch - run: pip install hatch==${{ env.HATCH_VERSION }} - - - name: Mypy - if: steps.files.outputs.any_changed == 'true' - run: | - mkdir .mypy_cache - hatch run test:types ${{ steps.files.outputs.all_changed_files }} - - 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@v44 - with: - files: | - haystack-experimental/**/*.py - - - uses: actions/setup-python@v5 - with: - python-version: "${{ env.PYTHON_VERSION }}" - - - name: Install Hatch - run: pip install hatch==${{ env.HATCH_VERSION }} - - - name: Pylint - if: steps.files.outputs.any_changed == 'true' - run: | - hatch run test:lint ${{ steps.files.outputs.all_changed_files }} diff --git a/.github/workflows/linting_skipper.yml b/.github/workflows/linting_skipper.yml deleted file mode 100644 index a48767b8..00000000 --- a/.github/workflows/linting_skipper.yml +++ /dev/null @@ -1,29 +0,0 @@ -# If you change this name also do it in linting.yml and ci_metrics.yml -name: Linting - -on: - pull_request: - paths-ignore: - - "haystack/preview/**/*.py" - - "test/preview/**/*.py" - - "e2e/preview/**/*.py" - - "**/pyproject.toml" - -jobs: - license-header: - runs-on: ubuntu-latest - steps: - - name: Skip mypy - run: echo "Skipped mypy" - - mypy: - runs-on: ubuntu-latest - steps: - - name: Skip mypy - run: echo "Skipped mypy" - - pylint: - runs-on: ubuntu-latest - steps: - - name: Skip pylint - run: echo "Skipped pylint" diff --git a/.github/workflows/pypi_release.yml b/.github/workflows/pypi_release.yml index a0ffefd1..3c5a3447 100644 --- a/.github/workflows/pypi_release.yml +++ b/.github/workflows/pypi_release.yml @@ -4,11 +4,9 @@ on: push: tags: - "v[0-9]+.[0-9]+.[0-9]+*" - # We must not release versions tagged with -rc0 suffix - - "!v[0-9]+.[0-9]+.[0-9]-rc0" env: - HATCH_VERSION: "1.9.3" + HATCH_VERSION: "1.9.4" jobs: release-on-pypi: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 4ac6c92f..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: 'Stalebot' -on: - schedule: - - cron: '30 1 * * *' - -jobs: - makestale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v9 - with: - any-of-labels: 'proposal,community-triage' - stale-pr-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.' - days-before-stale: 30 - days-before-close: 10 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b4f4ab12..35bced01 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,14 +2,17 @@ name: Tests on: + # Activate this workflow manually + workflow_dispatch: + + # Run tests nightly against Haystack's main branch schedule: - cron: "0 0 * * *" - workflow_dispatch: # Activate this workflow manually + push: branches: - main - # release branches have the form v1.9.x - - "v[0-9].*[0-9].x" + pull_request: types: - opened @@ -18,105 +21,39 @@ on: - ready_for_review paths: # Keep the list in sync with the paths defined in the `tests_skipper.yml` workflow - - "haystack-experimental/**/*.py" + - "haystack_experimental/**/*.py" - "test/**/*.py" - "pyproject.toml" env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - CORE_AZURE_CS_ENDPOINT: ${{ secrets.CORE_AZURE_CS_ENDPOINT }} - CORE_AZURE_CS_API_KEY: ${{ secrets.CORE_AZURE_CS_API_KEY }} - AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} - AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - HF_API_TOKEN: ${{ secrets.HUGGINGFACE_API_KEY }} PYTHON_VERSION: "3.8" - HATCH_VERSION: "1.9.3" + HATCH_VERSION: "1.9.4" jobs: - black: + linting: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: "${{ env.PYTHON_VERSION }}" - - name: Install Hatch run: pip install hatch==${{ env.HATCH_VERSION }} - - name: Check status - run: hatch run default:format-check + - name: Check code format + run: hatch fmt - - name: Calculate alert data - id: calculator - shell: bash - if: (success() || failure()) && github.ref_name == 'main' - run: | - if [ "${{ job.status }}" = "success" ]; then - echo "alert_type=success" >> "$GITHUB_OUTPUT"; - else - echo "alert_type=error" >> "$GITHUB_OUTPUT"; - fi + - name: Linting + run: hatch run test:lint - - name: Send event to Datadog - if: (success() || failure()) && github.ref_name == 'main' - uses: masci/datadog@v1 - with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} - api-url: https://api.datadoghq.eu - events: | - - title: "${{ github.workflow }} workflow" - text: "Job ${{ github.job }} in branch ${{ github.ref_name }}" - alert_type: "${{ steps.calculator.outputs.alert_type }}" - source_type_name: "Github" - host: ${{ github.repository_owner }} - tags: - - "project:${{ github.repository }}" - - "job:${{ github.job }}" - - "run_id:${{ github.run_id }}" - - "workflow:${{ github.workflow }}" - - "branch:${{ github.ref_name }}" - - "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - - install-dependencies: - name: Install and cache ${{ matrix.os }} dependencies - needs: black - strategy: - matrix: - os: [ubuntu-latest, macos-12, windows-latest] - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: "${{ env.PYTHON_VERSION }}" - - - 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: - path: ${{ env.pythonLocation }} - key: pip-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('pyproject.toml') }} + - name: Typing + run: hatch run test:typing unit-tests: name: Unit / ${{ matrix.os }} - needs: install-dependencies strategy: fail-fast: false matrix: os: - ubuntu-latest - windows-latest - - macos-12 + - macos-latest runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -125,14 +62,11 @@ jobs: with: python-version: "${{ env.PYTHON_VERSION }}" - - name: Restore Python dependencies - uses: actions/cache/restore@v4 - with: - path: ${{ env.pythonLocation }} - key: pip-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('pyproject.toml') }} + - name: Install Hatch + run: pip install hatch==${{ env.HATCH_VERSION }} - name: Run - run: hatch run test:unit + run: hatch run test:cov - name: Coveralls # We upload only coverage for ubuntu as handling both os @@ -142,234 +76,9 @@ jobs: with: path-to-lcov: coverage.xml - - name: Calculate alert data - id: calculator - shell: bash - if: (success() || failure()) && github.ref_name == 'main' - run: | - if [ "${{ job.status }}" = "success" ]; then - echo "alert_type=success" >> "$GITHUB_OUTPUT"; - else - echo "alert_type=error" >> "$GITHUB_OUTPUT"; - fi - - - name: Send event to Datadog - if: (success() || failure()) && github.ref_name == 'main' - uses: masci/datadog@v1 - with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} - api-url: https://api.datadoghq.eu - events: | - - title: "${{ github.workflow }} workflow" - text: "Job ${{ github.job }} in branch ${{ github.ref_name }}" - alert_type: "${{ steps.calculator.outputs.alert_type }}" - source_type_name: "Github" - host: ${{ github.repository_owner }} - tags: - - "project:${{ github.repository }}" - - "job:${{ github.job }}" - - "run_id:${{ github.run_id }}" - - "workflow:${{ github.workflow }}" - - "branch:${{ github.ref_name }}" - - "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - - name: Nightly - run unit tests with Haystack main branch if: github.event_name == 'schedule' id: nightly-haystack-main run: | hatch run pip install git+https://github.com/deepset-ai/haystack.git hatch run test:unit - - - name: Send event to Datadog for nightly failures - if: failure() && github.event_name == 'schedule' - uses: ./.github/actions/send_failure - with: - title: | - core-integrations failure: - ${{ (steps.tests.conclusion == 'nightly-haystack-main') && 'nightly-haystack-main' || 'tests' }} - - ${{ github.workflow }} - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} - - integration-tests-linux: - name: Integration / ubuntu-latest - needs: unit-tests - runs-on: ubuntu-latest - services: - tika: - image: apache/tika:2.9.0.0 - ports: - - 9998:9998 - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: "${{ env.PYTHON_VERSION }}" - - - name: Install dependencies - run: | - sudo apt update - sudo apt install ffmpeg # for local Whisper tests - - - name: Restore Python dependencies - uses: actions/cache/restore@v4 - with: - path: ${{ env.pythonLocation }} - key: pip-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('pyproject.toml') }} - - - name: Run - run: hatch run test:integration - - - name: Calculate alert data - id: calculator - shell: bash - if: (success() || failure()) && github.ref_name == 'main' - run: | - if [ "${{ job.status }}" = "success" ]; then - echo "alert_type=success" >> "$GITHUB_OUTPUT"; - else - echo "alert_type=error" >> "$GITHUB_OUTPUT"; - fi - - - name: Send event to Datadog - if: (success() || failure()) && github.ref_name == 'main' - uses: masci/datadog@v1 - with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} - api-url: https://api.datadoghq.eu - events: | - - title: "${{ github.workflow }} workflow" - text: "Job ${{ github.job }} in branch ${{ github.ref_name }}" - alert_type: "${{ steps.calculator.outputs.alert_type }}" - source_type_name: "Github" - host: ${{ github.repository_owner }} - tags: - - "project:${{ github.repository }}" - - "job:${{ github.job }}" - - "run_id:${{ github.run_id }}" - - "workflow:${{ github.workflow }}" - - "branch:${{ github.ref_name }}" - - "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - - integration-tests-macos: - name: Integration / macos-12 - needs: unit-tests - runs-on: macos-12 - env: - HAYSTACK_MPS_ENABLED: false - - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: "${{ env.PYTHON_VERSION }}" - - - name: Install dependencies - run: | - brew install ffmpeg # for local Whisper tests - - - name: Restore Python dependencies - uses: actions/cache/restore@v4 - with: - path: ${{ env.pythonLocation }} - key: pip-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('pyproject.toml') }} - - - name: Run - run: hatch run test:integration-mac - - - name: Calculate alert data - id: calculator - shell: bash - if: (success() || failure()) && github.ref_name == 'main' - run: | - if [ "${{ job.status }}" = "success" ]; then - echo "alert_type=success" >> "$GITHUB_OUTPUT"; - else - echo "alert_type=error" >> "$GITHUB_OUTPUT"; - fi - - - name: Send event to Datadog - if: (success() || failure()) && github.ref_name == 'main' - uses: masci/datadog@v1 - with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} - api-url: https://api.datadoghq.eu - events: | - - title: "${{ github.workflow }} workflow" - text: "Job ${{ github.job }} in branch ${{ github.ref_name }}" - alert_type: "${{ steps.calculator.outputs.alert_type }}" - source_type_name: "Github" - host: ${{ github.repository_owner }} - tags: - - "project:${{ github.repository }}" - - "job:${{ github.job }}" - - "run_id:${{ github.run_id }}" - - "workflow:${{ github.workflow }}" - - "branch:${{ github.ref_name }}" - - "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - - integration-tests-windows: - name: Integration / windows-latest - needs: unit-tests - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v5 - with: - python-version: "${{ env.PYTHON_VERSION }}" - - - name: Restore Python dependencies - uses: actions/cache/restore@v4 - with: - path: ${{ env.pythonLocation }} - key: pip-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('pyproject.toml') }} - - - name: Run - run: hatch run test:integration-windows - - - name: Calculate alert data - id: calculator - shell: bash - if: (success() || failure()) && github.ref_name == 'main' - run: | - if [ "${{ job.status }}" = "success" ]; then - echo "alert_type=success" >> "$GITHUB_OUTPUT"; - else - echo "alert_type=error" >> "$GITHUB_OUTPUT"; - fi - - - name: Send event to Datadog - if: (success() || failure()) && github.ref_name == 'main' - uses: masci/datadog@v1 - with: - api-key: ${{ secrets.CORE_DATADOG_API_KEY }} - api-url: https://api.datadoghq.eu - events: | - - title: "${{ github.workflow }} workflow" - text: "Job ${{ github.job }} in branch ${{ github.ref_name }}" - alert_type: "${{ steps.calculator.outputs.alert_type }}" - source_type_name: "Github" - host: ${{ github.repository_owner }} - tags: - - "project:${{ github.repository }}" - - "job:${{ github.job }}" - - "run_id:${{ github.run_id }}" - - "workflow:${{ github.workflow }}" - - "branch:${{ github.ref_name }}" - - "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - - trigger-catch-all: - name: Tests completed - # This job will be executed only after all the other tests - # are successful. - # This way we'll be able to mark only this test as required - # and skip it accordingly. - needs: - - integration-tests-linux - - integration-tests-macos - - integration-tests-windows - uses: ./.github/workflows/tests_skipper_workflow.yml - with: - tests_were_skipped: false diff --git a/.github/workflows/tests_skipper_trigger.yml b/.github/workflows/tests_skipper_trigger.yml deleted file mode 100644 index f492d9e9..00000000 --- a/.github/workflows/tests_skipper_trigger.yml +++ /dev/null @@ -1,46 +0,0 @@ -# If you change this name also do it in tests.yml and ci_metrics.yml -name: Tests - -on: - pull_request: - types: - - opened - - reopened - - synchronize - - ready_for_review - paths-ignore: - # we skip the tests unless the code changes. The problem is that GitHub will run the check anyway if any other - # file outside the code changed (e.g. the release notes). Hence, we need a second filter down below. - # keep the list in sync with the paths defined in the `tests.yml` workflow - - "haystack-experimental/**/*.py" - - "test/**/*.py" - -jobs: - check_if_changed: - name: Check if changed - runs-on: ubuntu-latest - permissions: - pull-requests: read - outputs: - code_changes: ${{ steps.changes.outputs.code_changes }} - steps: - - uses: actions/checkout@v4 - - name: Check for changed code - id: changes - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 - with: - # keep the list in sync with the paths defined in the `tests.yml` workflow - filters: | - code_changes: - - haystack-experimental/**/*.py - - test/**/*.py - - "pyproject.toml" - - trigger-catch-all: - name: Tests completed - # Don't run this check if the PR contains both code and non-code changes (e.g. release notes) - needs: check_if_changed - if: needs.check_if_changed.outputs.code_changes == 'false' - uses: ./.github/workflows/tests_skipper_workflow.yml - with: - tests_were_skipped: true diff --git a/.github/workflows/tests_skipper_workflow.yml b/.github/workflows/tests_skipper_workflow.yml deleted file mode 100644 index 4554c827..00000000 --- a/.github/workflows/tests_skipper_workflow.yml +++ /dev/null @@ -1,24 +0,0 @@ -# If you change this name also do it in tests.yml and ci_metrics.yml -# We use a separate workflow to skip the tests if the PR contains both code and non-code changes (e.g. release notes). -# Skipping the job unfortunately doesn't work because GitHub will treat these jobs as successful even if they are -# skipped. Hence, we need to revert to a separate workflow. -name: Tests -on: - workflow_call: - inputs: - tests_were_skipped: - type: boolean - required: true - -jobs: - catch-all: - # Don't run this check if the PR contains both code and non-code changes (e.g. release notes) - name: Mark tests as completed - runs-on: ubuntu-latest - steps: - - name: Skip tests - if: ${{ github.event.inputs.tests_were_skipped }} - run: echo "Skipped!" - - name: Tests completed successfully - if: ${{ !github.event.inputs.tests_were_skipped }} - run: echo "Tests completed!" diff --git a/haystack_experimental/__init__.py b/haystack_experimental/__init__.py new file mode 100644 index 00000000..c1764a6e --- /dev/null +++ b/haystack_experimental/__init__.py @@ -0,0 +1,3 @@ +# SPDX-FileCopyrightText: 2022-present deepset GmbH +# +# SPDX-License-Identifier: Apache-2.0 diff --git a/haystack_experimental/version.py b/haystack_experimental/version.py index 8b18fc69..a4a8d183 100644 --- a/haystack_experimental/version.py +++ b/haystack_experimental/version.py @@ -2,9 +2,4 @@ # # SPDX-License-Identifier: Apache-2.0 -from importlib import metadata - -try: - __version__ = str(metadata.version("haystack-experimental")) -except metadata.PackageNotFoundError: - __version__ = "main" +__version__ = "0.0.0" diff --git a/pyproject.toml b/pyproject.toml index 47bdb0ae..be67eed0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,9 +7,9 @@ name = "haystack-experimental" dynamic = ["version"] description = "Experimental components and features for the Haystack LLM framework." readme = "README.md" -license = "Apache-2.0" +license = {text = "Apache-2.0"} requires-python = ">=3.8" -authors = [{ name = "deepset.ai", email = "malte.pietsch@deepset.ai" }] +authors = [{ name = "deepset.ai", email = "info@deepset.ai" }] classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Science/Research", @@ -21,81 +21,64 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering :: Artificial Intelligence", ] -dependencies = ["haystack-ai"] +dependencies = [ + "haystack-ai", +] +[project.urls] +"CI: GitHub" = "https://github.com/deepset-ai/haystack-experimental/actions" +"GitHub: issues" = "https://github.com/deepset-ai/haystack-experimental/issues" +"GitHub: repo" = "https://github.com/deepset-ai/haystack-experimental" +Homepage = "https://github.com/deepset-ai/haystack-experimental" [tool.hatch.envs.default] dependencies = [ - "pre-commit", # Type check "mypy", # Test "pytest", "pytest-cov", - "pytest-custom_exit_code", # used in the CI - "pytest-asyncio", - "pytest-rerunfailures", - "responses", - "tox", - "coverage", - "python-multipart", - "psutil", # Linting "pylint", "ruff", - # Documentation - "toml", - "reno", - # dulwich is a reno dependency, they pin it at >=0.15.0 so pip takes ton of time to resolve the dependency tree. - # We pin it here to avoid taking too much time. - # https://opendev.org/openstack/reno/src/branch/master/requirements.txt#L7 - "dulwich>=0.21.0,<1.0.0", - # Version specified following Black stability policy: - # https://black.readthedocs.io/en/stable/the_black_code_style/index.html#stability-policy - "black[jupyter]~=23.0", ] -[tool.hatch.envs.default.scripts] -format = "black ." -format-check = "black --check ." - [tool.hatch.envs.test] -extra-dependencies = [] +extra-dependencies = [ + # List here dependencies behind lazy-import +] [tool.hatch.envs.test.scripts] -e2e = "pytest e2e" unit = 'pytest --cov-report xml:coverage.xml --cov="haystack-experimental" -m "not integration" {args:test}' integration = 'pytest --maxfail=5 -m "integration" {args:test}' -integration-mac = 'pytest --maxfail=5 -m "integration" -k "not tika" {args:test}' -integration-windows = 'pytest --maxfail=5 -m "integration" -k "not tika" {args:test}' -types = "mypy --install-types --non-interactive --cache-dir=.mypy_cache/ {args:haystack-experimental}" +typing = "mypy --install-types --non-interactive {args:haystack_experimental}" lint = [ - "ruff check {args:haystack-experimental}", - "pylint -ry -j 0 {args:haystack-experimental}", + "ruff check {args:haystack_experimental}", + "pylint -ry -j 0 {args:haystack_experimental}", +] +test-cov = "coverage run -m pytest {args:test}" +cov-report = [ + "- coverage combine", + "coverage report", +] +cov = [ + "test-cov", + "cov-report", ] -lint-fix = ["black .", "ruff check {args:haystack-experimental} --fix"] [tool.hatch.envs.readme] -detached = true # To avoid installing the dependencies from the default environment +detached = true # To avoid installing the dependencies from the default environment dependencies = ["haystack-pydoc-tools"] [tool.hatch.envs.readme.scripts] sync = "./.github/utils/pydoc-markdown.sh" delete-outdated = "python ./.github/utils/delete_outdated_docs.py {args}" -[tool.hatch.envs.snippets] -extra-dependencies = ["torch", "pydantic"] - -[project.urls] -"CI: GitHub" = "https://github.com/deepset-ai/haystack-experimental/actions" -"GitHub: issues" = "https://github.com/deepset-ai/haystack-experimental/issues" -"GitHub: repo" = "https://github.com/deepset-ai/haystack-experimental" -Homepage = "https://github.com/deepset-ai/haystack-experimental" - [tool.hatch.version] -path = "VERSION.txt" -pattern = "(?P.+)" +path = "haystack_experimental/version.py" [tool.hatch.metadata] allow-direct-references = true @@ -106,97 +89,24 @@ include = ["/haystack-experimental", "/VERSION.txt"] [tool.hatch.build.targets.wheel] packages = ["haystack-experimental"] -[tool.black] -line-length = 120 -skip_magic_trailing_comma = true # For compatibility with pydoc>=4.6, check if still needed. - [tool.codespell] ignore-words-list = "ans,astroid,nd,ned,nin,ue,rouge,ist" quiet-level = 3 skip = "test/nodes/*,test/others/*,test/samples/*,e2e/*" +[tool.pylint] +ignore-paths = [ + "haystack_experimental/__init__.py", + "haystack_experimental/version.py", +] [tool.pylint.'MESSAGES CONTROL'] max-line-length = 120 -disable = [ - - # To keep - "fixme", - "c-extension-no-member", - - # To review: - "missing-docstring", - "unused-argument", - "no-member", - "line-too-long", - "protected-access", - "too-few-public-methods", - "raise-missing-from", - "invalid-name", - "duplicate-code", - "arguments-differ", - "consider-using-f-string", - "no-else-return", - "attribute-defined-outside-init", - "super-with-arguments", - "redefined-builtin", - "abstract-method", - "unspecified-encoding", - "unidiomatic-typecheck", - "no-name-in-module", - "consider-using-with", - "redefined-outer-name", - "arguments-renamed", - "unnecessary-pass", - "broad-except", - "unnecessary-comprehension", - "subprocess-run-check", - "singleton-comparison", - "consider-iterating-dictionary", - "undefined-loop-variable", - "consider-using-in", - "bare-except", - "unexpected-keyword-arg", - "simplifiable-if-expression", - "use-list-literal", - "broad-exception-raised", - - # To review later - "cyclic-import", - "import-outside-toplevel", - "deprecated-method", -] -[tool.pylint.'DESIGN'] -max-args = 38 # Default is 5 -max-attributes = 28 # Default is 7 -max-branches = 34 # Default is 12 -max-locals = 45 # Default is 15 -max-module-lines = 2468 # Default is 1000 -max-nested-blocks = 9 # Default is 5 -max-statements = 206 # Default is 50 -[tool.pylint.'SIMILARITIES'] -min-similarity-lines = 6 [tool.pytest.ini_options] minversion = "6.0" addopts = "--strict-markers" markers = [ - "unit: unit tests", "integration: integration tests", - - "generator: generator tests", - "summarizer: summarizer tests", - "embedding_dim: uses a document store with non-default embedding dimension (e.g @pytest.mark.embedding_dim(128))", - - "tika: requires Tika container", - "parsr: requires Parsr container", - "ocr: requires Tesseract", - - "elasticsearch: requires Elasticsearch container", - "weaviate: requires Weaviate container", - "pinecone: requires Pinecone credentials", - "faiss: uses FAISS", - "opensearch", - "document_store", ] log_cli = true @@ -206,11 +116,10 @@ warn_unused_configs = true ignore_missing_imports = true [tool.ruff] -line-length = 301 +line-length = 120 target-version = "py38" exclude = ["test"] - [tool.ruff.lint] select = [ "ASYNC", # flake8-async @@ -259,13 +168,3 @@ ignore = [ [tool.ruff.lint.mccabe] max-complexity = 28 - -[tool.ruff.lint.per-file-ignores] - -[tool.ruff.lint.pylint] -allow-magic-value-types = ["float", "int", "str"] -max-args = 14 # Default is 5 -max-branches = 21 # Default is 12 -max-public-methods = 20 # Default is 20 -max-returns = 7 # Default is 6 -max-statements = 60 # Default is 50 diff --git a/releasenotes/config.yaml b/releasenotes/config.yaml deleted file mode 100644 index 1becbe28..00000000 --- a/releasenotes/config.yaml +++ /dev/null @@ -1,47 +0,0 @@ -default_branch: main -collapse_pre_releases: true -pre_release_tag_re: (?P-(?:[ab]|rc)+\d*)$ -prelude_section_name: highlights -template: | - --- - highlights: > - Replace this text with content to appear at the top of the section for this - release. The highlights might repeat some details that are also present in other notes - from the same release, that's ok. Not every release note requires highlights, - use this section only to describe major features or notable changes. - upgrade: - - | - List upgrade notes here, or remove this section. - Upgrade notes should be rare: only list known/potential breaking changes, - or major changes that require user action before the upgrade. - Notes here must include steps that users can follow to 1. know if they're - affected and 2. handle the change gracefully on their end. - features: - - | - List new features here, or remove this section. - enhancements: - - | - List new behavior that is too small to be - considered a new feature, or remove this section. - issues: - - | - List known issues here, or remove this section. For example, if some change is experimental or known to not work in some cases, it should be mentioned here. - deprecations: - - | - List deprecations notes here, or remove this section. Deprecations should not be used for something that is removed in the release, use upgrade section instead. Deprecation should allow time for users to make necessary changes for the removal to happen in a future release. - security: - - | - Add security notes here, or remove this section. - fixes: - - | - Add normal bug fixes here, or remove this section. - -sections: - # The prelude section is implicitly included. - - [upgrade, ⬆️ Upgrade Notes] - - [features, 🚀 New Features] - - [enhancements, ⚡️ Enhancement Notes] - - [issues, Known Issues] - - [deprecations, ⚠️ Deprecation Notes] - - [security, Security Notes] - - [fixes, 🐛 Bug Fixes] diff --git a/test/test_experimental.py b/test/test_experimental.py new file mode 100644 index 00000000..f1748238 --- /dev/null +++ b/test/test_experimental.py @@ -0,0 +1,2 @@ +def test(): + pass