Skip to content

Commit 4358df1

Browse files
authored
docs: organize contents into sections (#3528)
Better organize the content into structures. Part 2/N of #2423
1 parent f85787d commit 4358df1

File tree

8 files changed

+84
-46
lines changed

8 files changed

+84
-46
lines changed

docs/arrays.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ a 32-bit float: ~1e-38 to ~1e38. By comparison, a 16-bit float has a range of
1414
~5.96e-8 to 65504.
1515

1616
Lance provides an Arrow extension array (:class:`lance.arrow.BFloat16Array`)
17-
and a Pandas extension array (:class:`lance.pandas.BFloat16Dtype`) for BFloat16.
17+
and a Pandas extension array (:class:`~lance._arrow.PandasBFloat16Type`) for BFloat16.
1818
These are compatible with the `ml_dtypes <https://github.com/jax-ml/ml_dtypes>`_
1919
bfloat16 NumPy extension array.
2020

@@ -31,7 +31,7 @@ the array:
3131
2 3.40625
3232
dtype: lance.bfloat16
3333

34-
To create an an arrow array, use the :func:`lance.arrow.bfloat16_array` function:
34+
To create an Arrow array, use the :func:`lance.arrow.bfloat16_array` function:
3535

3636
.. code-block:: python
3737

docs/blob.rst

-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ Lance provides a high-level API to store and retrieve large binary objects (blob
1010
Lance serves large binary data using :py:class:`lance.BlobFile`, which
1111
is a file-like object that lazily reads large binary objects.
1212

13-
.. autoclass:: lance.BlobFile
14-
:members:
15-
:show-inheritance:
16-
:noindex:
17-
1813
To fetch blobs from a Lance dataset, you can use :py:meth:`lance.dataset.LanceDataset.take_blobs`.
1914

2015
For example, it's easy to use `BlobFile` to extract frames from a video file without

docs/conf.py

+29-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Configuration file for the Sphinx documentation builder.
22

33
import shutil
4-
from datetime import datetime
54

65

76
def run_apidoc(_):
@@ -18,7 +17,7 @@ def setup(app):
1817
# -- Project information -----------------------------------------------------
1918

2019
project = "Lance"
21-
copyright = f"{datetime.today().year}, Lance Developer"
20+
copyright = "%Y, Lance Developer"
2221
author = "Lance Developer"
2322

2423

@@ -29,7 +28,7 @@ def setup(app):
2928
# ones.
3029
extensions = [
3130
"breathe",
32-
"sphinx_copybutton",
31+
"sphinx_immaterial",
3332
"sphinx.ext.autodoc",
3433
"sphinx.ext.doctest",
3534
"sphinx.ext.githubpages",
@@ -61,20 +60,42 @@ def setup(app):
6160

6261
# -- Options for HTML output -------------------------------------------------
6362

64-
html_theme = "piccolo_theme"
63+
html_theme = "sphinx_immaterial"
6564

6665
# Add any paths that contain custom static files (such as style sheets) here,
6766
# relative to this directory. They are copied after the builtin static files,
6867
# so a file named "default.css" will overwrite the builtin "default.css".
6968
html_static_path = ["_static"]
7069

7170
html_favicon = "_static/favicon_64x64.png"
72-
# html_logo = "_static/high-res-icon.png"
71+
html_logo = "_static/high-res-icon.png"
7372
html_theme_options = {
74-
"source_url": "https://github.com/lancedb/lance",
75-
"source_icon": "github",
73+
"icon": {
74+
"repo": "fontawesome/brands/github",
75+
"edit": "material/file-edit-outline",
76+
},
77+
"site_url": "https://github.com/lancedb/lance",
78+
"repo_url": "https://github.com/lancedb/lance",
79+
"repo_name": "Lance",
80+
"features": [
81+
"navigation.expand",
82+
# "navigation.tabs",
83+
"content.tabs.link",
84+
"content.code.copy",
85+
],
86+
"social": [
87+
{
88+
"icon": "fontawesome/brands/github",
89+
"link": "https://github.com/jbms/sphinx-immaterial",
90+
"name": "Source on github.com",
91+
},
92+
{
93+
"icon": "fontawesome/brands/python",
94+
"link": "https://pypi.org/project/pylance/",
95+
},
96+
],
7697
}
77-
html_css_files = ["custom.css"]
98+
include_in_toc = False
7899

79100
# -- doctest configuration ---------------------------------------------------
80101

docs/index.rst

+22-4
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,33 @@ Preview releases receive the same level of testing as regular releases.
3939

4040

4141
.. toctree::
42-
:maxdepth: 1
42+
:caption: Introduction
43+
:maxdepth: 2
4344

4445
Quickstart <./notebooks/quickstart>
4546
./read_and_write
46-
Lance Formats <./format>
47-
Arrays <./arrays>
47+
48+
.. toctree::
49+
:caption: Advanced Usage
50+
:maxdepth: 1
51+
52+
Lance Format Spec <./format>
4853
Blob API <./blob>
49-
Integrations <./integrations/integrations>
5054
Performance Guide <./performance>
55+
Tokenizer <./tokenizer>
56+
Extension Arrays <./arrays>
57+
58+
.. toctree::
59+
:caption: Integrations
60+
61+
Huggingface <./integrations/huggingface>
62+
Tensorflow <./integrations/tensorflow>
63+
PyTorch <./integrations/pytorch>
64+
Ray <./integrations/ray>
65+
66+
.. toctree::
67+
:maxdepth: 1
68+
5169
API References <./api/api>
5270
Contributor Guide <./contributing>
5371
Examples <./examples/examples>

docs/integrations/integrations.rst

-10
This file was deleted.

docs/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
pyarrow
22
sphinx>=8
33
sphinx-copybutton
4+
sphinx-immaterial
45
breathe
56
cython
67
pandas

docs/tokenizer.rst

+21-16
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,37 @@ If tokenization is needed, you can download language models by yourself.
66
You can specify the location where the language models are stored by setting the environment variable LANCE_LANGUAGE_MODEL_HOME.
77
If it's not set, the default value is
88

9-
... code-block::bash
9+
.. code-block:: bash
10+
1011
${system data directory}/lance/language_models
1112
1213
It also supports configuring user dictionaries,
1314
which makes it convenient for users to expand their own dictionaries without retraining the language models.
1415

1516
Language Models of Jieba
16-
---------------
17+
------------------------
1718

1819
Downloading the Model
19-
~~~~~~~~~~~
20+
~~~~~~~~~~~~~~~~~~~~~
21+
22+
.. code-block:: bash
2023
21-
... code-block::bash
2224
python -m lance.download jieba
2325
2426
The language model is stored by default in `${LANCE_LANGUAGE_MODEL_HOME}/jieba/default`.
2527

2628
Using the Model
27-
~~~~~~~~~~~
29+
~~~~~~~~~~~~~~~
2830

29-
... code-block::python
31+
.. code-block:: python
3032
ds.create_scalar_index("text", "INVERTED", base_tokenizer="jieba/default")
3133
3234
User Dictionaries
33-
~~~~~~~~~~~
35+
~~~~~~~~~~~~~~~~~
3436
Create a file named config.json in the root directory of the current model.
3537

36-
... code-block::json
38+
.. code-block:: json
39+
3740
{
3841
"main": "dict.txt",
3942
"users": ["path/to/user/dict.txt"]
@@ -44,30 +47,32 @@ Create a file named config.json in the root directory of the current model.
4447

4548

4649
Language Models of Lindera
47-
---------------
50+
--------------------------
4851

4952
Downloading the Model
50-
~~~~~~~~~~~
53+
~~~~~~~~~~~~~~~~~~~~~
54+
55+
.. code-block:: bash
5156
52-
... code-block::bash
5357
python -m lance.download lindera -l [ipadic|ko-dic|unidic]
5458
5559
Note that the language models of Lindera need to be compiled. Please install lindera-cli first. For detailed steps, please refer to https://github.com/lindera/lindera/tree/main/lindera-cli.
5660

5761
The language model is stored by default in ${LANCE_LANGUAGE_MODEL_HOME}/lindera/[ipadic|ko-dic|unidic]
5862

5963
Using the Model
60-
~~~~~~~~~~~
64+
~~~~~~~~~~~~~~~
65+
66+
.. code-block:: python
6167
62-
... code-block::python
6368
ds.create_scalar_index("text", "INVERTED", base_tokenizer="lindera/ipadic")
6469
6570
User Dictionaries
66-
~~~~~~~~~~~
71+
~~~~~~~~~~~~~~~~~
6772

6873
Create a file named config.json in the root directory of the current model.
6974

70-
... code-block::json
75+
.. code-block::json
7176
{
7277
"main": "main",
7378
"users": "path/to/user/dict.bin",
@@ -80,7 +85,7 @@ Create a file named config.json in the root directory of the current model.
8085

8186

8287
Create your own language model
83-
---------------
88+
------------------------------
8489

8590
Put your language model into `LANCE_LANGUAGE_MODEL_HOME`.
8691

notebooks/quickstart.ipynb

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "7980c1ca",
6+
"metadata": {},
7+
"source": [
8+
"# Quickstart"
9+
]
10+
},
311
{
412
"cell_type": "code",
513
"execution_count": 1,
@@ -981,7 +989,7 @@
981989
}
982990
],
983991
"source": [
984-
"%%time \n",
992+
"%%time\n",
985993
"\n",
986994
"sift1m.create_index(\n",
987995
" \"vector\",\n",

0 commit comments

Comments
 (0)