Skip to content

Commit 1cd1f8e

Browse files
committed
Documentation tweaks
1 parent 7b5d84e commit 1cd1f8e

9 files changed

Lines changed: 39 additions & 31 deletions

File tree

apsw/__init__.pyi

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,11 +1959,11 @@ class Connection:
19591959
def load_extension(self, filename: str, entrypoint: str | None = None) -> None:
19601960
"""Loads *filename* as an `extension <https://www.sqlite.org/loadext.html>`_
19611961
1962-
:param filename: The file to load.
1962+
:param filename: The file to load, the extension is optional
19631963
19641964
:param entrypoint: The initialization method to call. If this
1965-
parameter is not supplied then the SQLite default of
1966-
``sqlite3_extension_init`` is used.
1965+
parameter is not supplied, then SQLite tries :code:`sqlite3_extension_init`
1966+
and a name derived from the filename.
19671967
19681968
:raises ExtensionLoadingError: If the extension could not be
19691969
loaded. The exception string includes more details.
@@ -1972,7 +1972,8 @@ class Connection:
19721972
19731973
.. seealso::
19741974
1975-
* :meth:`~Connection.enable_load_extension`"""
1975+
* :meth:`~Connection.enable_load_extension`
1976+
* :func:`apsw.sqlite_extra.load`"""
19761977
...
19771978

19781979
loadextension = load_extension ## OLD-NAME
@@ -6792,11 +6793,11 @@ class AsyncConnection:
67926793
async def load_extension(self, filename: str, entrypoint: str | None = None) -> None:
67936794
"""Loads *filename* as an `extension <https://www.sqlite.org/loadext.html>`_
67946795
6795-
:param filename: The file to load.
6796+
:param filename: The file to load, the extension is optional
67966797
67976798
:param entrypoint: The initialization method to call. If this
6798-
parameter is not supplied then the SQLite default of
6799-
``sqlite3_extension_init`` is used.
6799+
parameter is not supplied, then SQLite tries :code:`sqlite3_extension_init`
6800+
and a name derived from the filename.
68006801
68016802
:raises ExtensionLoadingError: If the extension could not be
68026803
loaded. The exception string includes more details.
@@ -6805,7 +6806,8 @@ class AsyncConnection:
68056806
68066807
.. seealso::
68076808
6808-
* :meth:`~Connection.enable_load_extension`"""
6809+
* :meth:`~Connection.enable_load_extension`
6810+
* :func:`apsw.sqlite_extra.load`"""
68096811
...
68106812

68116813
open_flags: int

apsw/shell.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,8 +2185,8 @@ def command_load(self, cmd):
21852185
Note: Extension loading may not be enabled in the SQLite
21862186
library version you are using.
21872187
2188-
By default sqlite3_extension_init is called in the library but
2189-
you can specify an alternate entry point.
2188+
By default sqlite3_extension_init and a name derived from the filename
2189+
is tried, or you can specify an alternate entry point.
21902190
21912191
If you get an error about the extension not being found you
21922192
may need to explicitly specify the directory. For example if
@@ -2195,7 +2195,7 @@ def command_load(self, cmd):
21952195
.load ./extension
21962196
21972197
:doc:`sqlite_extra <extra>` will also be searched for
2198-
extensions if the parameter is not found. Use --list to see a
2198+
extensions if the file is not found. Use --list to see a
21992199
list available in this installation.
22002200
"""
22012201
if len(cmd) < 1 or len(cmd) > 2:

apsw/sqlite_extra.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ class NotAvailable(Exception):
1818
pass
1919

2020
def load(db: apsw.Connection, extension: str):
21-
"""Loads the extension into the provided database"""
21+
"""Loads the extension into the provided database
22+
23+
:meth:`Extension loading <apsw.Connection.enable_load_extension>` will
24+
also be turned on.
25+
"""
2226
db.enable_load_extension(True)
2327
entry, path = _get_entry(extension)
2428
if entry["type"] != "extension":

doc/changes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ compiled. These can be packaged with APSW for convenient access. See
4545
Also included is the experimental under development `vec1 vector
4646
search extension <https://sqlite.org/vec1>`__.
4747

48-
Added :meth:`Connection.reserve_bytes`.
48+
Added :meth:`Connection.reserve_bytes`. This is useful for some of
49+
the :doc:`extras <extra>` like the `checksum VFS
50+
<https://sqlite.org/cksumvfs.html>`__.
4951

5052
Fix wrapping, indents. and space for hyphens in
5153
:func:`apsw.unicode.text_wrap` under various conditions (:issue:`600`)

doc/cli.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,18 +553,17 @@ Loads a SQLite extension library
553553
Note: Extension loading may not be enabled in the SQLite library version you are
554554
using.
555555

556-
By default sqlite3_extension_init is called in the library but you can specify
557-
an alternate entry point.
556+
By default sqlite3_extension_init and a name derived from the filename is tried,
557+
or you can specify an alternate entry point.
558558

559559
If you get an error about the extension not being found you may need to
560560
explicitly specify the directory. For example if it is in the current directory
561561
then use::
562562

563563
.load ./extension
564564

565-
:doc:`sqlite_extra <extra>` will also be searched for extensions if the
566-
parameter is not found. Use --list to see a list available in this
567-
installation.
565+
:doc:`sqlite_extra <extra>` will also be searched for extensions if the file is
566+
not found. Use --list to see a list available in this installation.
568567

569568

570569
.log ON|OFF

doc/shell.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,18 +509,17 @@ load FILE ?ENTRY?
509509
Note: Extension loading may not be enabled in the SQLite library version you are
510510
using.
511511

512-
By default sqlite3_extension_init is called in the library but you can specify
513-
an alternate entry point.
512+
By default sqlite3_extension_init and a name derived from the filename is tried,
513+
or you can specify an alternate entry point.
514514

515515
If you get an error about the extension not being found you may need to
516516
explicitly specify the directory. For example if it is in the current directory
517517
then use::
518518

519519
.load ./extension
520520

521-
:doc:`sqlite_extra <extra>` will also be searched for extensions if the
522-
parameter is not found. Use --list to see a list available in this
523-
installation.
521+
:doc:`sqlite_extra <extra>` will also be searched for extensions if the file is
522+
not found. Use --list to see a list available in this installation.
524523

525524
.. _shell-cmd-log:
526525
.. index::

doc/sqlite_extra.rst-inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ Extensions
286286
* Function: uuid uuid_blob uuid_str
287287

288288
* - vec1
289-
- `link <https://sqlite.org/vec1/doc/trunk/doc/vec1intro.md>`__
289+
- `link <https://sqlite.org/vec1>`__
290290
- Vector search. !Experimental! !Under development! Loading on before 2013 CPU may crash process
291291
-
292292
* Function: vec1_cos_distance vec1_from_json vec1_info vec1_l2_distance vec1_qinstr vec1_test_pq_decode vec1_test_pq_distortion vec1_test_pq_encode vec1_to_json vec1_to_json_f vec1_to_json_i vec1_train

src/apsw.docstrings

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,11 +2327,11 @@
23272327
#define Connection_load_extension_DOC "Connection.load_extension(filename: str, entrypoint: str | None = None) -> None\n\n" \
23282328
"Loads *filename* as an `extension <https://www.sqlite.org/loadext.html>`_\n" \
23292329
"\n" \
2330-
":param filename: The file to load.\n" \
2330+
":param filename: The file to load, the extension is optional\n" \
23312331
"\n" \
23322332
":param entrypoint: The initialization method to call. If this\n" \
2333-
" parameter is not supplied then the SQLite default of\n" \
2334-
" ``sqlite3_extension_init`` is used.\n" \
2333+
" parameter is not supplied, then SQLite tries :code:`sqlite3_extension_init`\n" \
2334+
" and a name derived from the filename.\n" \
23352335
"\n" \
23362336
":raises ExtensionLoadingError: If the extension could not be\n" \
23372337
" loaded. The exception string includes more details.\n" \
@@ -2340,7 +2340,8 @@
23402340
"\n" \
23412341
".. seealso::\n" \
23422342
"\n" \
2343-
" * :meth:`~Connection.enable_load_extension`\n"
2343+
" * :meth:`~Connection.enable_load_extension`\n" \
2344+
" * :func:`apsw.sqlite_extra.load`\n"
23442345

23452346
#define Connection_load_extension_KWNAMES "filename", "entrypoint"
23462347
#define Connection_load_extension_USAGE "Connection.load_extension(filename: str, entrypoint: str | None = None) -> None"

src/connection.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,11 +2915,11 @@ Connection_enable_load_extension(PyObject *self_, PyObject *const *fast_args, Py
29152915
29162916
Loads *filename* as an `extension <https://www.sqlite.org/loadext.html>`_
29172917
2918-
:param filename: The file to load.
2918+
:param filename: The file to load, the extension is optional
29192919
29202920
:param entrypoint: The initialization method to call. If this
2921-
parameter is not supplied then the SQLite default of
2922-
``sqlite3_extension_init`` is used.
2921+
parameter is not supplied, then SQLite tries :code:`sqlite3_extension_init`
2922+
and a name derived from the filename.
29232923
29242924
:raises ExtensionLoadingError: If the extension could not be
29252925
loaded. The exception string includes more details.
@@ -2929,6 +2929,7 @@ Connection_enable_load_extension(PyObject *self_, PyObject *const *fast_args, Py
29292929
.. seealso::
29302930
29312931
* :meth:`~Connection.enable_load_extension`
2932+
* :func:`apsw.sqlite_extra.load`
29322933
*/
29332934
static PyObject *
29342935
Connection_load_extension(PyObject *self_, PyObject *const *fast_args, Py_ssize_t fast_nargs, PyObject *fast_kwnames)

0 commit comments

Comments
 (0)