Skip to content

Commit

Permalink
Migrate deps management from Pip to Poetry
Browse files Browse the repository at this point in the history
Pip doesn't do a good job of separating the direct and transitive
dependancies of a Python application - there is just a single
'requirements.txt' which lists both.

Given other Pinecone libraries (pinecone-python-client) have migrated
to Poetry, do the same here for improved dependancy management and
consistency of tooling.
  • Loading branch information
daverigby committed Feb 28, 2024
1 parent 7a78045 commit 622f6a8
Show file tree
Hide file tree
Showing 6 changed files with 2,073 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/actions/create-index/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ runs:
- name: Create index
id: create-index
shell: bash
run: python3 tests/scripts/create_index.py
run: poetry run python3 tests/scripts/create_index.py
env:
PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }}
NAME_PREFIX: ${{ inputs.name_prefix }}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/delete-index/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
steps:
- name: Delete index
shell: bash
run: python3 tests/scripts/delete_index.py
run: poetry run python3 tests/scripts/delete_index.py
env:
PINECONE_API_KEY: ${{ inputs.PINECONE_API_KEY }}
INDEX_NAME: ${{ inputs.index_name }}
17 changes: 11 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,22 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
poetry install --no-interaction --no-root
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
poetry run flake8 . --extend-exclude .venv --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
poetry run flake8 . --extend-exclude .venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Create test index
id: create-index
uses: ./.github/actions/create-index
Expand All @@ -52,7 +57,7 @@ jobs:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
- name: Test with pytest
run: |
pytest
poetry run pytest
env:
PINECONE_API_KEY: '${{ secrets.PINECONE_API_KEY }}'
INDEX_HOST: ${{ steps.create-index.outputs.index_host }}
Expand Down
21 changes: 0 additions & 21 deletions load_dataset.py

This file was deleted.

Loading

0 comments on commit 622f6a8

Please sign in to comment.