Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
name: 'Build client documentation'
description: 'Generates client documentation using pdoc'
inputs:
python-version:
description: 'Python version to use'
required: true
default: '3.x'
runs:
using: 'composite'
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
python-version: ${{ inputs.python-version }}

- name: Setup Poetry
uses: ./.github/actions/setup-poetry
with:
include_grpc: 'true'

- name: Build html documentation
shell: bash
Expand Down
7 changes: 7 additions & 0 deletions .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: 'Setup Poetry'
description: 'Installs Poetry and dependencies'
inputs:
include_grpc:
description: 'Install gRPC dependencies'
required: true
default: 'false'
runs:
using: 'composite'
steps:
- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
if: ${{ inputs.include_grpc == 'false' }}
shell: bash
run: |
poetry install
Expand All @@ -16,6 +22,7 @@ runs:
# The dependencies that are specific to gRPC are defined in pyproject.toml
# under tool.poetry.extras
- name: Install gRPC dependencies
if: ${{ inputs.include_grpc == 'true' }}
shell: bash
run: |
poetry install --extras "grpc"
2 changes: 2 additions & 0 deletions .github/workflows/merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:

- name: Generate pdoc documentation
uses: ./.github/actions/build-docs
with:
python-version: 3.11

- name: Deploy documentation to gh-pages
uses: s0/git-publish-subdir-action@develop
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ jobs:
uses: actions/checkout@v3
- name: Build docs with pdoc
uses: './.github/actions/build-docs'
with:
python-version: 3.11
63 changes: 55 additions & 8 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
workflow_call: {}

jobs:
run-tests:
name: Run tests
units-no-grpc:
name: Run tests (REST)
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -22,11 +22,58 @@ jobs:
- name: Setup Poetry
uses: ./.github/actions/setup-poetry

- name: Run tests
run: make tests
- name: Run unit tests
run: poetry run pytest --cov=pinecone --timeout=120 tests/unit

- 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/config
poetry run mypy pinecone/control
poetry run mypy pinecone/utils

- name: Build Python client
run: make package
units-grpc:
name: Run tests (GRPC)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11]

steps:
- uses: actions/checkout@v3

- 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

package:
name: Check packaging
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11]

steps:
- uses: actions/checkout@v3

- 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

- name: Build docs
run: make docs
- name: Package
run: poetry build
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ image:
develop:
poetry install -E grpc

tests:
@echo "Installing dependencies..."
poetry install
test-unit:
@echo "Running tests..."
poetry run pytest --cov=pinecone --timeout=120 tests/unit

test-grpc-unit:
@echo "Running tests..."
poetry run pytest --cov=pinecone --timeout=120 tests/unit_grpc

version:
poetry version

Expand Down
23 changes: 2 additions & 21 deletions pinecone/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
"""
.. include:: ../README.md
"""
from pinecone.core.utils.constants import CLIENT_VERSION as __version__
from .config import *
from .exceptions import *
from .info import *
from .manage import *
from .index import *

try:
from .core.grpc.index_grpc import *
except ImportError:
pass # ignore for non-[grpc] installations

# Kept for backwards-compatibility
UpsertResult = None
"""@private"""
DeleteResult = None
"""@private"""
QueryResult = None
"""@private"""
FetchResult = None
"""@private"""
InfoResult = None
"""@private"""
from .control.pinecone import Pinecone
from .data.index import *
Loading