mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
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 <willjones127@gmail.com> Co-authored-by: Xuanwo <github@xuanwo.io>
This commit is contained in:
co-authored by
Will Jones
Xuanwo
parent
a0ff67e13e
commit
193c9d8e2e
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+5
-4
@@ -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
|
||||
|
||||
+3
-1
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ Creates a vector representation for the given values.
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`[][] \| `Float32Array`[] \| `Float64Array`[]>
|
||||
`Promise`<`number`[][] \| `Float32Array`[] \| `Float64Array`[]>
|
||||
|
||||
***
|
||||
|
||||
|
||||
@@ -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<number[][] | Float32Array[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`[][] \| `Float32Array`[] \| `Float64Array`[]>
|
||||
`Promise`<`number`[][] \| `Float32Array`[] \| `Float64Array`[]>
|
||||
|
||||
***
|
||||
|
||||
|
||||
@@ -1343,6 +1343,8 @@ and sample positions.
|
||||
::: lancedb.permutation.PermutationBuilder
|
||||
|
||||
::: lancedb.permutation.Permutation
|
||||
options:
|
||||
filters: ["!^_", "^__getitem__$", "^__getitems__$"]
|
||||
|
||||
::: lancedb.permutation.Transforms
|
||||
|
||||
|
||||
@@ -59,6 +59,12 @@ function processContents(contents) {
|
||||
});
|
||||
return lines.join("\n") + "\n\n";
|
||||
})
|
||||
// Escape array suffixes that MkDocs could read as reference links.
|
||||
// Preserve the contents of fenced blocks and inline code spans.
|
||||
.replace(
|
||||
/^(`{3,})[^\n]*\n[\s\S]*?^\1[ \t]*$|(`+).*?\2|(?<=\])\[\]/gm,
|
||||
(match) => (match === "[]" ? "[]" : match),
|
||||
)
|
||||
// Also trim trailing whitespace
|
||||
.replace(/([^ \t])[ \t]+\n/g, "$1\n")
|
||||
);
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 []
|
||||
|
||||
Reference in New Issue
Block a user