Skip to content

Implement docs with sphinx #508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 4, 2025
Merged
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
28 changes: 22 additions & 6 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Build client documentation'
description: 'Generates client documentation using pdoc'
description: 'Generates client documentation using sphinx'
inputs:
python-version:
description: 'Python version to use'
Expand All @@ -13,15 +13,31 @@ runs:
with:
include_grpc: 'true'
include_dev: 'true'
include_asyncio: 'true'
python_version: ${{ inputs.python-version }}

- name: Pretend this project requires Python 3.11
shell: bash
run: |
# Poetry won't let me install sphinx as a dev dependency in this project
# because of the wide range of versions our library supports. So during this
# action, we'll pretend this project requires Python 3.11 or greater.
sed -i 's/python = "^3.9"/python = "^3.11"/' pyproject.toml
poetry lock
poetry install -E grpc -E asyncio

- name: Install sphinx
shell: bash
run: |
poetry add sphinx myst-parser --group dev
Comment on lines +19 to +32
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a minor atrocity, but for now it's the best way to work around sphinx's relatively narrow python version support. Poetry won't let me install it normally (and add it as a dev dependency in pyproject.toml) because our library has a wider range of python version support than sphinx.


- name: Build html documentation
shell: bash
run: |
poetry run pdoc pinecone '!pinecone.core' '!pinecone.utils' --favicon ./favicon-32x32.png --docformat google -o ./pdoc
poetry run sphinx-build -b html docs docsbuild

- name: Fix relative links
- name: Discard changes to pyproject.toml and poetry.lock
shell: bash
run: |
poetry run python3 ./.github/actions/build-docs/fix-relative-links.py ./pdoc ./pdoc
env:
BASE_URL: "https://github.com/pinecone-io/pinecone-python-client/blob/main/"
git checkout pyproject.toml
git checkout poetry.lock
66 changes: 0 additions & 66 deletions .github/actions/build-docs/fix-relative-links.py

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/build-and-publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Generate pdoc documentation
- name: Generate sphinx documentation
uses: ./.github/actions/build-docs
with:
python-version: 3.11
Expand All @@ -24,7 +24,7 @@ jobs:
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: pdoc
source-directory: docsbuild
destination-github-username: pinecone-io
destination-repository-name: sdk-docs
user-email: [email protected]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/on-pr-dep-change.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
if: ${{ always() }}
needs:
- dependency-tests
- create-project
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I removed pdoc, this workflow got triggered and I noticed this mistake in my recent "create a project for every test run" PR.

uses: './.github/workflows/project-cleanup.yaml'
secrets: inherit
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ venv.bak/
pdoc/*
!pdoc/pinecone-python-client-fork.png
!pdoc/favicon-32x32.png
docsbuild

# mypy
.mypy_cache/
Expand Down
33 changes: 33 additions & 0 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
body,
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6,
div.admonition p.admonition-title {
font-family: "Inter", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
}

.blurb {
font-size: 16px;
}

p.admonition-title:after {
content: "";
}

div.code-block-caption {
background-color: #EEE;
border-bottom: 1px solid #CCC;
font-size: 17px;
padding: 10px;
}

dt:target {
background-color: #E8E8E8;
}

.highlight {
background-color: #F8F8F8;
}
1 change: 1 addition & 0 deletions docs/_static/pinecone-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions docs/asyncio.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
===============
PineconeAsyncio
===============

.. autoclass:: pinecone::PineconeAsyncio

.. automethod:: pinecone::PineconeAsyncio.__init__

DB Control Plane
================

Indexes
-------

.. automethod:: pinecone::PineconeAsyncio.create_index

.. automethod:: pinecone::PineconeAsyncio.create_index_for_model

.. automethod:: pinecone::PineconeAsyncio.create_index_from_backup

.. automethod:: pinecone::PineconeAsyncio.list_indexes

.. automethod:: pinecone::PineconeAsyncio.describe_index

.. automethod:: pinecone::PineconeAsyncio.configure_index

.. automethod:: pinecone::PineconeAsyncio.delete_index

.. automethod:: pinecone::PineconeAsyncio.has_index

Backups
-------

.. automethod:: pinecone::PineconeAsyncio.create_backup

.. automethod:: pinecone::PineconeAsyncio.list_backups

.. automethod:: pinecone::PineconeAsyncio.describe_backup

.. automethod:: pinecone::PineconeAsyncio.delete_backup

Collections
-----------

.. automethod:: pinecone::PineconeAsyncio.create_collection

.. automethod:: pinecone::PineconeAsyncio.list_collections

.. automethod:: pinecone::PineconeAsyncio.describe_collection

.. automethod:: pinecone::PineconeAsyncio.delete_collection

Restore Jobs
------------

.. automethod:: pinecone::PineconeAsyncio.list_restore_jobs

.. automethod:: pinecone::PineconeAsyncio.describe_restore_job

DB Data Plane
=============

.. autoclass:: pinecone.db_data::IndexAsyncio

.. automethod:: pinecone.db_data::IndexAsyncio.__init__

.. automethod:: pinecone.db_data::IndexAsyncio.describe_index_stats

Vectors
-------

.. automethod:: pinecone.db_data::IndexAsyncio.upsert

.. automethod:: pinecone.db_data::IndexAsyncio.query

.. automethod:: pinecone.db_data::IndexAsyncio.query_namespaces

.. automethod:: pinecone.db_data::IndexAsyncio.delete

.. automethod:: pinecone.db_data::IndexAsyncio.fetch

.. automethod:: pinecone.db_data::IndexAsyncio.list

.. automethod:: pinecone.db_data::IndexAsyncio.list_paginated

Records
-------

If you have created an index using integrated inference, you can use the following methods to
search and retrieve records.

.. automethod:: pinecone.db_data::IndexAsyncio.search

.. automethod:: pinecone.db_data::IndexAsyncio.search_records



Inference
=========

.. automethod:: pinecone.inference::Inference.embed

.. automethod:: pinecone.inference::Inference.rerank

.. automethod:: pinecone.inference::Inference.list_models

.. automethod:: pinecone.inference::Inference.get_model
42 changes: 42 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import pinecone

project = "Pinecone Python SDK"
author = "Pinecone Systems, Inc."
version = pinecone.__version__
copyright = "%Y, Pinecone Systems, Inc."

html_baseurl = "https://sdk.pinecone.io/python"
html_static_path = ["_static"]
html_favicon = "favicon-32x32.png"

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.todo",
"sphinx.ext.napoleon",
"sphinx.ext.coverage",
"sphinx.ext.autodoc.typehints",
"myst_parser",
]

# -- HTML Configuration -------------------------------------------------

html_theme = "alabaster"
html_theme_options = {
"logo": "pinecone-logo.svg",
"description": "Pinecone Python SDK",
"github_user": "pinecone-io",
"github_repo": "pinecone-python-client",
"github_button": True,
"fixed_sidebar": True,
"page_width": "1140px",
"sidebar_width": "300px",
"show_related": False,
"show_powered_by": False,
"extra_nav_links": {
"Github Source": "https://github.com/pinecone-io/pinecone-python-client",
"Pinecone Home": "https://pinecone.io",
"Pinecone Docs": "https://docs.pinecone.io",
"Pinecone Console": "https://app.pinecone.io",
},
}
2 changes: 1 addition & 1 deletion docs/db_control/pod-indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,6 @@ pc.configure_index(
)
```

# Configuring, listing, describing, and deleting
## Configuring, listing, describing, and deleting

See [shared index actions](shared-index-actions.md) to learn about how to manage the lifecycle of your index after it is created.
2 changes: 1 addition & 1 deletion docs/db_control/serverless-indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ pc.create_index(
)
```

# Configuring, listing, describing, and deleting
## Configuring, listing, describing, and deleting

See [shared index actions](shared-index-actions.md) to learn about how to manage the lifecycle of your index after it is created.
2 changes: 1 addition & 1 deletion docs/db_control/shared-index-configs.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Optional Index configurations
# Index configuration

This page covers some optional configurations that can be used with all index types.

Expand Down
2 changes: 1 addition & 1 deletion docs/db_data/index-usage-byov.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Using your Pinecone index
# Vectors

## Describe index statistics

Expand Down
2 changes: 2 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# FAQ

## How does connection pooling work in the Pinecone SDK?

Before any data can be sent or received from Pinecone, your application must first establish a TCP connection with our API gateway. Establishing a TCP connection is a costly operation from a performance standpoint and so we use connection pooling to cache and reuse these connections across many different requests.
Expand Down
File renamed without changes
Loading