Release 1.0a25

Refs #2636, #2641, #2646, #2647, #2650
This commit is contained in:
Simon Willison 2026-02-25 16:49:14 -08:00
commit 1246c6576b
4 changed files with 43 additions and 1 deletions

View file

@ -4,6 +4,47 @@
Changelog
=========
.. _v1_0_a25:
1.0a25 (2026-02-25)
-------------------
``write_wrapper`` plugin hook for intercepting write operations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A new :ref:`write_wrapper() <plugin_hook_write_wrapper>` plugin hook allows plugins to intercept and wrap database write operations. (`#2636 <https://github.com/simonw/datasette/pull/2636>`__)
Plugins implement the hook as a generator-based context manager:
.. code-block:: python
@hookimpl
def write_wrapper(datasette, database, request):
def wrapper(conn):
# Setup code runs before the write
yield
# Cleanup code runs after the write
return wrapper
``register_token_handler()`` plugin hook for custom API token backends
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A new :ref:`register_token_handler() <plugin_hook_register_token_handler>` plugin hook allows plugins to provide custom token backends for API authentication. (`#2650 <https://github.com/simonw/datasette/pull/2650>`__)
This includes a **backwards incompatible change**: the ``datasette.create_token()`` internal method is now an ``async`` method. Consult the :ref:`upgrade guide <upgrade_guide_v1_a25>` for details on how to update your code.
``render_cell()`` now receives a ``pks`` parameter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The :ref:`render_cell() <plugin_hook_render_cell>` plugin hook now receives a ``pks`` parameter containing the list of primary key column names for the table being rendered. This avoids plugins needing to make redundant async calls to look up primary keys. (`#2641 <https://github.com/simonw/datasette/pull/2641>`__)
Other changes
~~~~~~~~~~~~~
- Facets defined in metadata now preserve their configured order, instead of being sorted by result count. Request-based facets added via the ``_facet`` parameter are still sorted by result count and appear after metadata-defined facets. (:issue:`2647`)
- Fixed ``--reload`` incorrectly interpreting the ``serve`` command as a file argument. Thanks, `Daniel Bates <https://github.com/danielalanbates>`__. (`#2646 <https://github.com/simonw/datasette/pull/2646>`__)
.. _v1_0_a24:
1.0a24 (2026-01-29)

View file

@ -90,6 +90,7 @@ If you want to change Datasette's Python code you can use the ``--reload`` optio
You can also use the ``fixtures.py`` script to recreate the testing version of ``metadata.json`` used by the unit tests. To do that::
uv run python tests/fixtures.py fixtures.db fixtures-metadata.json
Or to output the plugins used by the tests, run this::
uv run python tests/fixtures.py fixtures.db fixtures-metadata.json fixtures-plugins

View file

@ -2,7 +2,6 @@
orphan: true
---
(upgrade_guide_v1_a20)=
# Datasette 1.0a20 plugin upgrade guide
Datasette 1.0a20 makes some breaking changes to Datasette's permission system. Plugins need to be updated if they use **any of the following**:

View file

@ -111,6 +111,7 @@ Instead, one should use the following methods on a Datasette class:
- {ref}`get_resource_metadata() <datasette_get_resource_metadata>`
- {ref}`get_column_metadata() <datasette_get_column_metadata>`
(upgrade_guide_v1_a20)=
```{include} upgrade-1.0a20.md
:heading-offset: 1
```