Repository navigation
Implement docs with sphinx - #508
Conversation
| @@ -0,0 +1,260 @@ | |||
| .. toctree:: | |||
There was a problem hiding this comment.
This file is the main entry point for sphinx when the static site is regenerated.
The .. toctree:: directive is how navigation is defined and dictates what other content is pulled in.
| @@ -0,0 +1,126 @@ | |||
| ======== | |||
There was a problem hiding this comment.
To determine what methods are actually documented, they need to be declared in an rst file that is mentioned in the root toctree. Currently we have three things we're documenting: Pinecone in rest.rst, PineconeAsyncio in asyncio.rst, and PineconeGRPC in grpc.rst.
| > [!NOTE] | ||
| > The official SDK package was renamed from `pinecone-client` to `pinecone` beginning in version 5.1.0. | ||
| > Please remove `pinecone-client` from your project dependencies and add `pinecone` instead to get | ||
| > the latest updates. |
There was a problem hiding this comment.
We're using something called myst-parser to suck in some content that already existed in the repo as markdown files and render it into the sphinx static site. For the most part it does a good job, but the myst-parser didn't handle this comment block syntax. I think this is a github-specific addition to the markdown syntax, so I guess I'm not surprised.
| @@ -1,62 +0,0 @@ | |||
| class IndexClientInstantiationError(Exception): | |||
There was a problem hiding this comment.
In the past we were doing some weird stuff where we aliased the real implementation of Index to _Index and then threw an error message if anybody tried to directly instantiate the Index class. I can't remember now, but I think this was something a field engineer requested.
I decided to nix these because it was causing a problem when generating docs. In the past, this was added to chastise people if they tried to instantiate the Index class without going through a parent client object such as Pinecone (which was handling a bunch of configuration stuff), but that small benefit is not worth having wonky looking documentation.
| if: ${{ always() }} | ||
| needs: | ||
| - dependency-tests | ||
| - create-project |
There was a problem hiding this comment.
Since I removed pdoc, this workflow got triggered and I noticed this mistake in my recent "create a project for every test run" PR.
| - 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 |
There was a problem hiding this comment.
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.
…ecated accessors (pinecone-io#503) (pinecone-io#508) Adds dimension, metric, and vector_type back to IndexModel as computed read-only properties resolved from schema.fields, so a describe_index() round-trip no longer hard-stops at the first read of one of these. Each raises the existing guided AttributeError when unresolvable (no matching field, or more than one candidate field), and vector_type reports "dense" whenever a DenseVectorField is present regardless of any synthesized SparseVectorField (the pinecone-io/pinecone-db#18066 hybrid trap). spec, embed, and created_at are untouched. Updates the migration guide's removal table to split out these three as deprecated-but-working.
Problem
Recent changes to implement lazy loading in the SDK have broken compatibility with our previous docs tool, pdoc. After some investigation, it seemed easier to adopt a new docs solution than to try to manipulate pdoc internals to work for our usecase.
Solution
docsfolder. Main points of interest:docs/conf.pyanddocs/index.rstdocs/_static/custom.cssto tweak the look of the default sphinx theme which is using Garamond font and doesn't really match our branding at all. Changing up to use sans-serif fonts and tweaking a few other things gets us a long way there, although I'm sure there are still things to refine on that over time.poetry run sphinx-build -b html docs docsbuildsphinxand the publishedpinecone. Neither one of those sound like good options to me.Type of Change
Testing
New docs visible at https://sdk.pinecone.io/python
I published these by manually triggering the build-and-publish-docs job from this branch