-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dependency testing, support python3.8, downgrade urllib3 (#263)
## Problem Some goals: - Verify our code works with the claimed dependency ranges - Bring back python 3.8 support for LlamaIndex compatibility - Add flexibility to urllib3 dependency version by extending the version range back to 1.26.x. ## Solution - Remove more unused dependencies - `requests` (not sure when this was added; doesn't seem like it's been used for a while) - `python-dateutil` (no longer needed now that we've removed some date parsing default behavior in the generated client code) - Specify python-version specific dependency configuration for some dev dependencies (numpy, pandas-stubs) that were pushing us toward dropping py3.8 support - Added new reusable workflow action, `.github/actions/create-index/`, to create an index that will be used for subsequent testing. - Add new test workflow jobs, `dependency-matrix-rest` and `dependency-matrix-grpc`, with minimal integration test to verify the package works with different combinations of installed python dependencies. - New tests stored under `tests/dependency` - Integration test exercises control plane (list indexes, describe an index ) and data plane (upsert and query). It does not create a new index for each test as this is time-consuming, the test matrix is large, and index creation is extensively tested elsewhere. - Test configuration was getting unwieldy, so I split `testing.yaml` into `testing-rest.yaml` and `testing-grpc.yaml` - Data freshness isn't a huge issue for these tests, since the index is reused for upsert/query across different configurations. It's sufficient for these minimal tests to issue network calls and get responses without throwing exceptions to verify the dependencies are working. ## Type of Change Is "being able to install" a feature? - [x] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) ## Test Plan Add new test matrix to verify some dependencies work across the claimed range.
- Loading branch information
Showing
16 changed files
with
654 additions
and
182 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: 'Create Index' | ||
description: 'Creates an index to be used in other tests' | ||
|
||
inputs: | ||
region: | ||
description: 'The region of the index' | ||
required: false | ||
default: 'us-west-2' | ||
cloud: | ||
description: 'The cloud of the index' | ||
required: false | ||
default: 'aws' | ||
name_prefix: | ||
description: 'The prefix of the index name' | ||
required: false | ||
default: 'index-name' | ||
dimension: | ||
description: 'The dimension of the index' | ||
required: false | ||
default: '3' | ||
metric: | ||
description: 'The metric of the index' | ||
required: false | ||
default: 'cosine' | ||
PINECONE_API_KEY: | ||
description: 'The Pinecone API key' | ||
required: true | ||
|
||
outputs: | ||
index_name: | ||
description: 'The name of the index, including randomized suffix' | ||
value: ${{ steps.create-index.outputs.index_name }} | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Setup Poetry | ||
uses: ./.github/actions/setup-poetry | ||
|
||
- name: Create index | ||
id: create-index | ||
shell: bash | ||
run: poetry run python3 scripts/create.py | ||
env: | ||
PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} | ||
NAME_PREFIX: ${{ inputs.name_prefix }} | ||
REGION: ${{ inputs.region }} | ||
CLOUD: ${{ inputs.cloud }} | ||
DIMENSION: ${{ inputs.dimension }} | ||
METRIC: ${{ inputs.metric }} |
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,29 @@ | ||
name: 'Delete Index' | ||
description: 'Deletes an index to be used in other tests' | ||
|
||
inputs: | ||
index_name: | ||
description: 'The name of the index to delete' | ||
required: true | ||
PINECONE_API_KEY: | ||
description: 'The Pinecone API key' | ||
required: true | ||
|
||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Setup Poetry | ||
uses: ./.github/actions/setup-poetry | ||
|
||
- name: Delete index | ||
shell: bash | ||
run: poetry run python3 scripts/delete.py | ||
env: | ||
PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }} | ||
INDEX_NAME: ${{ inputs.index_name }} |
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,128 @@ | ||
name: Testing GRPC | ||
|
||
on: | ||
workflow_call: {} | ||
|
||
jobs: | ||
units-grpc: | ||
name: Unit tests (GRPC) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.8, 3.9, '3.10', 3.11] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Setup Poetry | ||
uses: ./.github/actions/setup-poetry | ||
with: | ||
include_grpc: true | ||
|
||
- name: Run unit tests (GRPC) | ||
run: poetry run pytest --cov=pinecone --timeout=120 tests/unit_grpc | ||
|
||
- name: mypy check | ||
run: | | ||
# Still lots of errors when running on the whole package (especially | ||
# in the generated core module), but we can check these subpackages | ||
# so we don't add new regressions. | ||
poetry run mypy pinecone --exclude pinecone/core | ||
dependency-matrix-grpc-setup: | ||
name: Deps setup (GRPC) | ||
runs-on: ubuntu-latest | ||
outputs: | ||
index_name: ${{ steps.setup-index.outputs.index_name }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Create index | ||
id: setup-index | ||
uses: ./.github/actions/create-index | ||
timeout-minutes: 5 | ||
with: | ||
name_prefix: depstest-grpc-${{ github.run_number }} | ||
dimension: 2 | ||
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} | ||
|
||
dependency-matrix-grpc: | ||
name: Deps (GRPC) | ||
needs: dependency-matrix-grpc-setup | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 5 | ||
fail-fast: false | ||
matrix: | ||
python-version: | ||
- 3.8 | ||
# - 3.9 | ||
# - "3.10" | ||
# - 3.11 | ||
grpcio-version: | ||
- 1.44.0 | ||
# - 1.46.5 | ||
# - 1.47.5 | ||
# - 1.48.2 | ||
# - 1.49.1 | ||
- 1.50.0 | ||
# - 1.51.3 | ||
# - 1.53.2 | ||
# - 1.54.3 | ||
# - 1.55.3 | ||
- 1.56.2 | ||
# - 1.57.0 | ||
# - 1.58.0 | ||
# - 1.59.3 | ||
- 1.60.0 | ||
lz4-version: | ||
- 3.1.3 | ||
# - 3.1.10 | ||
- 4.0.0 | ||
# - 4.0.1 | ||
# - 4.1.0 | ||
- 4.3.3 | ||
protobuf-version: | ||
- 3.20.3 | ||
googleapis-common-protos-version: | ||
- 1.53.0 | ||
- 1.62.0 | ||
grpc-gateway-protoc-gen-openapiv2-version: | ||
- 0.1.0 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Setup Poetry | ||
uses: ./.github/actions/setup-poetry | ||
with: | ||
include_grpc: true | ||
include_types: false | ||
- name: Install grpcio ${{ matrix.grpcio-version }} | ||
run: poetry add grpcio==${{ matrix.grpcio-version }} | ||
- name: Install lz4 ${{ matrix.lz4-version }} | ||
run: poetry add lz4==${{ matrix.lz4-version }} | ||
- name: Install protobuf ${{ matrix.protobuf-version }} | ||
run: poetry add protobuf==${{ matrix.protobuf-version }} | ||
- name: Install googleapis-common-protos ${{ matrix.googleapis-common-protos-version }} | ||
run: poetry add googleapis-common-protos==${{ matrix.googleapis-common-protos-version }} | ||
|
||
- uses: nick-fields/retry@v2 | ||
with: | ||
timeout_minutes: 5 | ||
max_attempts: 3 | ||
retry_on: error | ||
command: poetry run pytest tests/dependency/grpc -s -v | ||
env: | ||
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} | ||
INDEX_NAME: ${{ needs.dependency-matrix-grpc-setup.outputs.index_name }} | ||
|
Oops, something went wrong.