From 193c9d8e2e98aa60c17a82302ed41796701476db Mon Sep 17 00:00:00 2001 From: Sushanth012 <146400678+Sushanth012@users.noreply.github.com> Date: Tue, 1 Dec 2026 10:03:26 -0800 Subject: [PATCH] docs: fail docs build on warnings (#3707) ## Summary - run the existing MkDocs deployment build in strict mode - turn documentation warnings, including unresolved references, into CI failures instead of deploying them ## Why The docs workflow currently completes when MkDocs emits warnings. Using MkDocs' built-in strict mode makes the deployment stop on those warnings and surfaces documentation problems immediately. This addresses the warning-detection portion of #572 without adding another dependency or duplicating the docs build. ## Validation - `git diff --check` - parsed `.github/workflows/docs.yml` with PyYAML - full `mkdocs build --strict` was not run locally because MkDocs is not installed; the existing docs workflow has the required dependencies --------- Co-authored-by: Will Jones Co-authored-by: Xuanwo --- .github/workflows/docs.yml | 31 +++++++++++++------ AGENTS.md | 5 +-- docs/README.md | 9 +++--- docs/mkdocs.yml | 4 ++- docs/src/js/classes/BooleanQuery.md | 2 +- .../embedding/classes/EmbeddingFunction.md | 2 +- .../classes/TextEmbeddingFunction.md | 4 +-- docs/src/python/python.md | 2 ++ nodejs/typedoc_post_process.js | 6 ++++ python/python/lancedb/db.py | 12 ++++--- python/python/lancedb/functions.py | 5 ++- python/python/lancedb/namespace.py | 2 +- python/python/lancedb/query.py | 4 +++ python/python/lancedb/streaming.py | 14 ++++++--- python/python/lancedb/table.py | 14 ++++----- 15 files changed, 75 insertions(+), 41 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9de5d9176..8d9c6c11e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -4,18 +4,23 @@ on: push: branches: ["main"] + # Validate the SDK reference on PRs that touch the docs or their Python sources. + pull_request: + paths: + - .github/workflows/docs.yml + - docs/** + - python/python/** + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +# The build executes checked-out code, so keep its token read-only. permissions: contents: read - pages: write - id-token: write -# Allow one concurrent deployment +# Serialize deployments and give each PR its own concurrency group. concurrency: - group: "pages" + group: ${{ github.event_name == 'pull_request' && format('pages-pr-{0}', github.event.pull_request.number) || 'pages' }} cancel-in-progress: true env: @@ -34,6 +39,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 + with: + persist-credentials: false - name: Install dependencies needed for ubuntu run: | sudo apt update @@ -63,13 +70,13 @@ jobs: - name: Build docs working-directory: docs run: | - PYTHONPATH=. mkdocs build - - name: Setup Pages - uses: actions/configure-pages@v5 + PYTHONPATH=. mkdocs build --strict - name: Set artifact name + if: github.event_name != 'pull_request' id: artifact-name run: echo "name=github-pages-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT" - name: Upload artifact + if: github.event_name != 'pull_request' uses: actions/upload-pages-artifact@v3 with: name: ${{ steps.artifact-name.outputs.name }} @@ -81,11 +88,17 @@ jobs: deploy: name: Deploy to GitHub Pages needs: build - runs-on: ubuntu-24.04 + if: github.event_name != 'pull_request' + permissions: + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-24.04 steps: + - name: Setup Pages + uses: actions/configure-pages@v5 - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 diff --git a/AGENTS.md b/AGENTS.md index 8a95dc983..b4b0d97be 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -137,10 +137,11 @@ Plain relative links such as `[Table](Table)` do not resolve. To check your work ```shell pip install -r docs/requirements.txt -cd docs && PYTHONPATH=. mkdocs build +cd docs && PYTHONPATH=. mkdocs build --strict ``` -The docs site only builds on pushes to `main`, so this is not covered by PR CI. +PR CI runs the same strict SDK reference build when the docs, Python sources, +or Pages workflow change. ## Review Guidelines diff --git a/docs/README.md b/docs/README.md index 5e434c520..0d4c9d0cd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,9 +5,10 @@ For website guides in `docs/web`, start with covers editing pages, generated examples, previews, availability and drafts. This page covers the SDK reference in `docs/src`, built with MkDocs. Its -[GitHub Actions workflow](../.github/workflows/docs.yml) builds and deploys on -pushes to `main`, so it can include unreleased APIs. That is separate from the -release editions of the Mintlify website. +[GitHub Actions workflow](../.github/workflows/docs.yml) runs a strict build on +PRs that change the docs, Python sources, or workflow. Pushes to `main` build and +deploy the reference, so it can include unreleased APIs. That is separate from +the release editions of the Mintlify website. ## Building the docs @@ -28,7 +29,7 @@ Run these commands from the LanceDB repository root. The subshell changes into If you want to just generate the HTML files: ```shell -(cd docs && PYTHONPATH=. mkdocs build) +(cd docs && PYTHONPATH=. mkdocs build --strict) ``` If successful, you should see a `docs/site` directory in the repository root that diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index b2bd4738a..639ae9316 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -42,7 +42,9 @@ theme: plugins: - search - - autorefs + # Use mkdocstrings' autorefs integration for API cross-references. Registering + # Markdown headings globally can link Python types (such as list or bytes) + # to unrelated TypeScript members with the same name. - mkdocstrings: handlers: python: diff --git a/docs/src/js/classes/BooleanQuery.md b/docs/src/js/classes/BooleanQuery.md index 7925f4732..202ccf7fc 100644 --- a/docs/src/js/classes/BooleanQuery.md +++ b/docs/src/js/classes/BooleanQuery.md @@ -26,7 +26,7 @@ Creates an instance of BooleanQuery. #### Parameters -* **queries**: [[`Occur`](../enumerations/Occur.md), [`FullTextQuery`](../interfaces/FullTextQuery.md)][] +* **queries**: [[`Occur`](../enumerations/Occur.md), [`FullTextQuery`](../interfaces/FullTextQuery.md)][] An array of (Occur, FullTextQuery objects) to combine. Occur specifies whether the query must match, or should match. diff --git a/docs/src/js/namespaces/embedding/classes/EmbeddingFunction.md b/docs/src/js/namespaces/embedding/classes/EmbeddingFunction.md index b6291e0be..bd0e1729b 100644 --- a/docs/src/js/namespaces/embedding/classes/EmbeddingFunction.md +++ b/docs/src/js/namespaces/embedding/classes/EmbeddingFunction.md @@ -81,7 +81,7 @@ Creates a vector representation for the given values. #### Returns -`Promise`<`number`[][] \| `Float32Array`[] \| `Float64Array`[]> +`Promise`<`number`[][] \| `Float32Array`[] \| `Float64Array`[]> *** diff --git a/docs/src/js/namespaces/embedding/classes/TextEmbeddingFunction.md b/docs/src/js/namespaces/embedding/classes/TextEmbeddingFunction.md index 0a0cc619d..2f26e6372 100644 --- a/docs/src/js/namespaces/embedding/classes/TextEmbeddingFunction.md +++ b/docs/src/js/namespaces/embedding/classes/TextEmbeddingFunction.md @@ -70,7 +70,7 @@ Creates a vector representation for the given values. #### Returns -`Promise`<`number`[][] \| `Float32Array`[] \| `Float64Array`[]> +`Promise`<`number`[][] \| `Float32Array`[] \| `Float64Array`[]> #### Overrides @@ -110,7 +110,7 @@ abstract generateEmbeddings(texts, ...args): Promise (match === "[]" ? "[]" : match), + ) // Also trim trailing whitespace .replace(/([^ \t])[ \t]+\n/g, "$1\n") ); diff --git a/python/python/lancedb/db.py b/python/python/lancedb/db.py index 61dafc855..4e55424a8 100644 --- a/python/python/lancedb/db.py +++ b/python/python/lancedb/db.py @@ -1136,6 +1136,8 @@ class DBConnection(EnforceOverrides): Display lifecycle state and elapsed time, or receive structured snapshots through a callback. See [Job.wait][lancedb.job.Job.wait]. + Notes + ----- When the registration job resolves, each resolved-environment warning reported by the server is emitted as a Python ``UserWarning``. Catalog reads do not replay those registration warnings. @@ -2373,7 +2375,7 @@ class LanceDBConnection(DBConnection): ``experimental-functions`` Cargo feature. Published packages leave it disabled; LanceDB Enterprise operations remain available. See - [DBConnection.create_materialized_view][lancedb.DBConnection.create_materialized_view]. + [DBConnection.create_materialized_view][lancedb.db.DBConnection.create_materialized_view]. Examples -------- @@ -3800,7 +3802,7 @@ class AsyncConnection(object): ``experimental-functions`` Cargo feature. Published packages leave it disabled; LanceDB Enterprise operations remain available. See - [DBConnection.create_materialized_view][lancedb.DBConnection.create_materialized_view]. + [DBConnection.create_materialized_view][lancedb.db.DBConnection.create_materialized_view]. """ _resource_options( total_cpu_millis, @@ -4561,7 +4563,7 @@ class AsyncConnection(object): """Create a view: a named query the database plans on every read. See - [DBConnection.create_view][lancedb.DBConnection.create_view]. + [DBConnection.create_view][lancedb.db.DBConnection.create_view]. """ return _view_description( await self._inner.create_view( @@ -4638,7 +4640,7 @@ class AsyncConnection(object): """Create a property graph over tables in its namespace. See - [DBConnection.create_property_graph][lancedb.DBConnection.create_property_graph]. + [DBConnection.create_property_graph][lancedb.db.DBConnection.create_property_graph]. """ definition = _definition_json(nodes, edges) graph = AsyncPropertyGraph(self._inner, name, namespace_path) @@ -4652,7 +4654,7 @@ class AsyncConnection(object): it exists. See - [DBConnection.open_property_graph][lancedb.DBConnection.open_property_graph]. + [DBConnection.open_property_graph][lancedb.db.DBConnection.open_property_graph]. """ graph = AsyncPropertyGraph(self._inner, name, namespace_path) await graph.describe() diff --git a/python/python/lancedb/functions.py b/python/python/lancedb/functions.py index d1857de55..445e3e206 100644 --- a/python/python/lancedb/functions.py +++ b/python/python/lancedb/functions.py @@ -784,9 +784,8 @@ class FunctionVersion(_RemoteValue): unknown fields inside the open ``image.descriptor`` mapping remain available. - ``name`` and ``namespace_path`` are the Function's parts, as a - [SecretReference][lancedb.functions.SecretReference] carries a Secret's; - they are what [get_function][lancedb.db.DBConnection.get_function] takes. + ``name`` and ``namespace_path`` identify the Function. Pass them to + [get_function][lancedb.db.DBConnection.get_function] to look up the Function. An empty ``namespace_path`` is the root namespace. ``source_digest`` identifies the registered source artifact, independently diff --git a/python/python/lancedb/namespace.py b/python/python/lancedb/namespace.py index bee9576c2..944cf15f4 100644 --- a/python/python/lancedb/namespace.py +++ b/python/python/lancedb/namespace.py @@ -747,7 +747,7 @@ class LanceNamespaceDBConnection(DBConnection): ) -> "MaterializedView": """Define a materialized view over a table in the root namespace. See - [DBConnection.create_materialized_view][lancedb.DBConnection.create_materialized_view]. + [DBConnection.create_materialized_view][lancedb.db.DBConnection.create_materialized_view]. """ return MaterializedView( self.open_table( diff --git a/python/python/lancedb/query.py b/python/python/lancedb/query.py index be593e85a..e6cd3c624 100644 --- a/python/python/lancedb/query.py +++ b/python/python/lancedb/query.py @@ -3325,6 +3325,8 @@ class LanceEmptyQueryBuilder(LanceQueryBuilder): unordered. Leave the method uncalled to preserve the backend default. + Notes + ----- An unfiltered plain base-only scan of an Embedded table, pinned to one dataset version, returns manifest order by default. RTE tables scan the LSM by default and do not provide this guarantee unless @@ -5229,6 +5231,8 @@ class AsyncQuery(AsyncStandardQuery): unordered. Leave the method uncalled to preserve the backend default. + Notes + ----- An unfiltered plain base-only scan of an Embedded table, pinned to one dataset version, returns manifest order by default. RTE tables scan the LSM by default and do not provide this guarantee unless diff --git a/python/python/lancedb/streaming.py b/python/python/lancedb/streaming.py index f568b7c7c..95e9641d2 100644 --- a/python/python/lancedb/streaming.py +++ b/python/python/lancedb/streaming.py @@ -2710,13 +2710,17 @@ class StreamingDataset(IterableDataset): subset merging step, because each split's exact state is only known to whichever iterator owned that split. + Examples + -------- For example, checkpointing 8 ranks and resuming on 4 (the same - pattern applies when growing, e.g. 4 ranks resuming on 8):: + pattern applies when growing, e.g. 4 ranks resuming on 8): - states = [ds.state_dict() for ds in previous_run_datasets] # 8 - merged = StreamingDataset.merge_state_dicts(states) - for ds in resumed_datasets: # now only 4 ranks - ds.load_state_dict(merged) # same dict on every rank + ```python + states = [ds.state_dict() for ds in previous_run_datasets] # 8 + merged = StreamingDataset.merge_state_dicts(states) + for ds in resumed_datasets: # now only 4 ranks + ds.load_state_dict(merged) # same dict on every rank + ``` The rank count on either side never affects the merge itself, since ``merge_state_dicts`` only cares about the list of states it is diff --git a/python/python/lancedb/table.py b/python/python/lancedb/table.py index 03759c5b5..ef637e152 100644 --- a/python/python/lancedb/table.py +++ b/python/python/lancedb/table.py @@ -1562,7 +1562,7 @@ class Table(ABC): Examples -------- - Create using [DBConnection.create_table][lancedb.DBConnection.create_table] + Create using [DBConnection.create_table][lancedb.db.DBConnection.create_table] (more examples in that method's documentation). >>> import lancedb @@ -7562,13 +7562,13 @@ class AsyncTable: An AsyncTable is a collection of Records in a LanceDB Database. An AsyncTable can be obtained from the - [AsyncConnection.create_table][lancedb.AsyncConnection.create_table] and - [AsyncConnection.open_table][lancedb.AsyncConnection.open_table] methods. + [AsyncConnection.create_table][lancedb.db.AsyncConnection.create_table] and + [AsyncConnection.open_table][lancedb.db.AsyncConnection.open_table] methods. An AsyncTable object is expected to be long lived and reused for multiple operations. AsyncTable objects will cache a certain amount of index data in memory. This cache will be freed when the Table is garbage collected. To eagerly free the - cache you can call the [close][lancedb.AsyncTable.close] method. Once the + cache you can call the [close][lancedb.table.AsyncTable.close] method. Once the AsyncTable is closed, it cannot be used for any further operations. An AsyncTable can also be used as a context manager, and will automatically close @@ -7578,7 +7578,7 @@ class AsyncTable: Examples -------- - Create using [AsyncConnection.create_table][lancedb.AsyncConnection.create_table] + Create using [AsyncConnection.create_table][lancedb.db.AsyncConnection.create_table] (more examples in that method's documentation). >>> import lancedb @@ -7637,8 +7637,8 @@ class AsyncTable: You should not create AsyncTable objects directly. - Use [AsyncConnection.create_table][lancedb.AsyncConnection.create_table] and - [AsyncConnection.open_table][lancedb.AsyncConnection.open_table] to obtain + Use [AsyncConnection.create_table][lancedb.db.AsyncConnection.create_table] and + [AsyncConnection.open_table][lancedb.db.AsyncConnection.open_table] to obtain Table objects.""" self._inner = table self._namespace_path = namespace_path or []