Skip to content

Commit ba9bfa5

Browse files
committed
Datasette 0.19: plugin preview (with release notes)
1 parent e7c769e commit ba9bfa5

File tree

4 files changed

+63
-3
lines changed

4 files changed

+63
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Some examples: https://github.com/simonw/datasette/wiki/Datasettes
1515

1616
## News
1717

18+
* 16th April 2018: [Datasette 0.19: plugins preview](https://github.com/simonw/datasette/releases/tag/0.19)
1819
* 14th April 2018: [Datasette 0.18: units](https://github.com/simonw/datasette/releases/tag/0.18)
1920
* 9th April 2018: [Datasette 0.15: sort by column](https://github.com/simonw/datasette/releases/tag/0.15)
2021
* 28th March 2018: [Baltimore Sun Public Salary Records](https://simonwillison.net/2018/Mar/28/datasette-in-the-wild/) - a data journalism project from the Baltimore Sun powered by Datasette - source code [is available here](https://github.com/baltimore-sun-data/salaries-datasette)

datasette/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version_info__ = (0, 18)
1+
__version_info__ = (0, 19)
22
__version__ = '.'.join(map(str, __version_info__))

docs/changelog.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,61 @@
11
Changelog
22
=========
33

4+
0.19 (2018-04-16)
5+
-----------------
6+
7+
This is the first preview of the new Datasette plugins mechanism. Only two
8+
plugin hooks are available so far - for custom SQL functions and custom template
9+
filters. There's plenty more to come - read `the documentation
10+
<https://datasette.readthedocs.io/en/latest/plugins.html>`_ and get involved in
11+
`the tracking ticket <https://github.com/simonw/datasette/issues/14>`_ if you
12+
have feedback on the direction so far.
13+
14+
- Fix for ``_sort_desc=sortable_with_nulls`` test, refs `#216 <https://github.com/simonw/datasette/issues/216>`_
15+
16+
- Fixed `#216 <https://github.com/simonw/datasette/issues/216>`_ - paginate correctly when sorting by nullable column
17+
18+
- Initial documentation for plugins, closes `#213 <https://github.com/simonw/datasette/issues/213>`_
19+
20+
https://datasette.readthedocs.io/en/latest/plugins.html
21+
22+
- New ``--plugins-dir=plugins/`` option (`#212 <https://github.com/simonw/datasette/issues/212>`_)
23+
24+
New option causing Datasette to load and evaluate all of the Python files in
25+
the specified directory and register any plugins that are defined in those
26+
files.
27+
28+
This new option is available for the following commands::
29+
30+
datasette serve mydb.db --plugins-dir=plugins/
31+
datasette publish now/heroku mydb.db --plugins-dir=plugins/
32+
datasette package mydb.db --plugins-dir=plugins/
33+
34+
- Start of the plugin system, based on pluggy (`#210 <https://github.com/simonw/datasette/issues/14>`_)
35+
36+
Uses https://pluggy.readthedocs.io/ originally created for the py.test project
37+
38+
We're starting with two plugin hooks:
39+
40+
``prepare_connection(conn)``
41+
42+
This is called when a new SQLite connection is created. It can be used to register custom SQL functions.
43+
44+
``prepare_jinja2_environment(env)``
45+
46+
This is called with the Jinja2 environment. It can be used to register custom template tags and filters.
47+
48+
An example plugin which uses these two hooks can be found at https://github.com/simonw/datasette-plugin-demos or installed using ``pip install datasette-plugin-demos``
49+
50+
Refs `#14 <https://github.com/simonw/datasette/issues/14>`_
51+
52+
- Return HTTP 405 on InvalidUsage rather than 500. [Russ Garrett]
53+
54+
This also stops it filling up the logs. This happens for HEAD requests
55+
at the moment - which perhaps should be handled better, but that's a
56+
different issue.
57+
58+
459
0.18 (2018-04-14)
560
-----------------
661

docs/plugins.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ Plugins
33

44
Datasette's plugin system is currently under active development. It allows
55
additional features to be implemented as Python code (or, soon, JavaScript)
6-
which can be wrapped up in a separate Python package.
6+
which can be wrapped up in a separate Python package. The underlying mechanism
7+
uses `pluggy <https://pluggy.readthedocs.io/>`_.
78

89
You can follow the development of plugins in `issue #14 <https://github.com/simonw/datasette/issues/14>`_.
910

@@ -110,7 +111,6 @@ To learn how to upload your plugin to `PyPI <https://pypi.org/>`_ for use by
110111
other people, read the PyPA guide to `Packaging and distributing projects
111112
<https://packaging.python.org/tutorials/distributing-packages/>`_.
112113

113-
114114
Plugin hooks
115115
------------
116116

@@ -154,3 +154,7 @@ example:
154154
@hookimpl
155155
def prepare_jinja2_environment(env):
156156
env.filters['uppercase'] = lambda u: u.upper()
157+
158+
You can now use this filter in your custom templates like so::
159+
160+
Table name: {{ table|uppercase }}

0 commit comments

Comments
 (0)