Wykres commitów

61 Commity (main)

Autor SHA1 Wiadomość Data
Simon Willison 69c6e95323 Fixed a bunch of unused imports spotted with ruff 2024-02-06 17:27:20 -08:00
Simon Willison bcc4f6bf1f
track_event() mechanism for analytics and plugins
* Closes #2240
* Documentation for event plugin hooks, refs #2240
* Include example track_event plugin in docs, refs #2240
* Tests for track_event() and register_events() hooks, refs #2240
* Initial documentation for core events, refs #2240
* Internals documentation for datasette.track_event()
2024-01-31 15:21:40 -08:00
Simon Willison 5c64af6936 Upgrade to latest Black, closes #2239 2024-01-30 19:55:26 -08:00
Alex Garcia b2ec8717c3
Plugin configuration now lives in datasette.yaml/json
* Checkpoint, moving top-level plugin config to datasette.json
* Support database-level and table-level plugin configuration in datasette.yaml

Refs #2093
2023-09-13 14:06:25 -07:00
Alex Garcia 92b8bf38c0
Add new `--internal internal.db` option, deprecate legacy `_internal` database
Refs:
- #2157 
---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2023-08-28 20:24:23 -07:00
Simon Willison d8351b08ed datasette --get --actor 'JSON' option, closes #2153
Refs #2154
2023-08-28 13:15:38 -07:00
Simon Willison d9aad1fd04
-s/--setting x y gets merged into datasette.yml, refs #2143, #2156
This change updates the `-s/--setting` option to `datasette serve` to allow it to be used to set arbitrarily complex nested settings in a way that is compatible with the new `-c datasette.yml` work happening in:
- #2143

It will enable things like this:
```
datasette data.db --setting plugins.datasette-ripgrep.path "/home/simon/code"
```
For the moment though it just affects [settings](https://docs.datasette.io/en/1.0a4/settings.html) - so you can do this:
```
datasette data.db --setting settings.sql_time_limit_ms 3500
```
I've also implemented a backwards compatibility mechanism, so if you use it this way (the old way):
```
datasette data.db --setting sql_time_limit_ms 3500
```
It will notice that the setting you passed is one of Datasette's core settings, and will treat that as if you said `settings.sql_time_limit_ms` instead.
2023-08-28 13:06:14 -07:00
Simon Willison 2ce7872e3b -c shortcut for --config - refs #2143, #2149 2023-08-22 19:33:26 -07:00
Alex Garcia 17ec309e14
Start datasette.json, re-add --config, rm settings.json
The first step in defining the new `datasette.json/yaml` configuration mechanism.

Refs #2093, #2143, #493
2023-08-22 18:26:11 -07:00
Simon Willison 4a42476bb7 datasette plugins --requirements, closes #2133 2023-08-09 15:04:16 -07:00
Simon Willison 25fdbe6b27 use tmpdir instead of isolated_filesystem, refs #2037
Should hopefully get tests passing for #2036 too.
2023-03-08 12:33:23 -08:00
Simon Willison 1ad92a1d87 datasette install -r requirements.txt, closes #2033 2023-03-06 14:27:30 -08:00
Simon Willison c41278b46f default_allow_sql setting, closes #1409
Refs #1410
2023-01-04 16:51:26 -08:00
Simon Willison 260fbb598e Fix some failing tests, refs #1855 2022-12-12 21:00:40 -08:00
Simon Willison 64288d827f
Workaround for test failure: RuntimeError: There is no current event loop (#1803)
* Remove ensure_eventloop hack
* Hack to recover from intermittent RuntimeError calling asyncio.Lock()
2022-09-05 17:40:19 -07:00
Simon Willison 7d1e004ff6 Fix test I broke in #1744 2022-05-17 13:09:07 -07:00
Simon Willison 9979dcd07f Also remove default_cache_ttl_hashed setting, refs #1661 2022-03-18 17:25:14 -07:00
Simon Willison 8658c66438 Show error if --setting hash_urls 1 used, refs #1661 2022-03-18 17:19:31 -07:00
Simon Willison a35393b29c
Tilde encoding (#1659)
Closes #1657

Refs #1439
2022-03-15 11:01:57 -07:00
Simon Willison 1baa030eca
Switch to dash encoding for table/database/row-pk in paths
* Dash encoding functions, tests and docs, refs #1439
* dash encoding is now like percent encoding but with dashes
* Use dash-encoding for row PKs and ?_next=, refs #1439
* Use dash encoding for table names, refs #1439
* Use dash encoding for database names, too, refs #1439

See also https://simonwillison.net/2022/Mar/5/dash-encoding/
2022-03-07 07:38:29 -08:00
Simon Willison 0cd982fc6a De-duplicate 'datasette db.db db.db', closes #1632
Refs https://github.com/simonw/datasette-publish-fly/pull/12
2022-02-07 15:28:59 -08:00
Simon Willison e1770766ce Return plugins and hooks in predictable order 2022-01-19 21:14:04 -08:00
Simon Willison 77f46297a8 Rename --help-config to --help-settings, closes #1431 2021-08-12 18:01:57 -07:00
Simon Willison 180c7a5328 --uds option for binding to Unix domain socket, closes #1388 2021-07-10 16:37:30 -07:00
Konstantin Baikov 8e18c79431
Use context manager instead of plain open (#1211)
Context manager with open closes the files after usage.

When the object is already a pathlib.Path i used read_text
write_text functions

In some cases pathlib.Path.open were used in context manager,
it is basically the same as builtin open.

Thanks, Konstantin Baikov!
2021-03-11 08:15:49 -08:00
Simon Willison 6f41c8a2be
--crossdb option for joining across databases (#1232)
* Test for cross-database join, refs #283
* Warn if --crossdb used with more than 10 DBs, refs #283
* latest.datasette.io demo of --crossdb joins, refs #283
* Show attached databases on /_memory page, refs #283
* Documentation for cross-database queries, refs #283
2021-02-18 14:09:12 -08:00
Simon Willison 36a44bffbf Validation for --port, closes #1226 2021-02-18 10:05:27 -08:00
Simon Willison eda652cf6e
--ssl-keyfile and --ssl-certfile options to "datasette serve"
Closes #1221
2021-02-11 16:52:16 -08:00
Simon Willison 1600d2a3ec Renamed /:memory: to /_memory, with redirects - closes #1205 2021-01-28 14:48:56 -08:00
Simon Willison a5ede3cdd4 Fixed bug loading database called 'test-database (1).sqlite'
Closes #1181.

Also now ensures that database URLs have special characters URL-quoted.
2021-01-24 21:13:05 -08:00
Miroslav Šedivý a882d67962
Modernize code to Python 3.6+ (#1158)
* Compact dict and set building
* Remove redundant parentheses
* Simplify chained conditions
* Change method name to lowercase
* Use triple double quotes for docstrings

Thanks, @eumiro!
2020-12-23 09:04:32 -08:00
Simon Willison 8919f99c2f Improved .add_database() method design
Closes #1155 - _internal now has a sensible name

Closes #509 - Support opening multiple databases with the same stem
2020-12-22 12:04:18 -08:00
Simon Willison fe86d85308 datasette serve --create option, closes #1135 2020-12-09 11:45:45 -08:00
Simon Willison eae103a82b Write errors to stderr, closes #1131 2020-12-04 21:21:11 -08:00
Simon Willison 4777362bf2 Work around CI bug with ensure_eventloop, refs #1115 2020-11-29 12:19:24 -08:00
Simon Willison 09033c08be Suggest --load-extension=spatialite, closes #1115 2020-11-29 12:13:16 -08:00
Simon Willison 2a3d5b720b Redirect /-/config to /-/settings, closes #1103 2020-11-24 12:19:14 -08:00
Simon Willison 3159263f05 New --setting to replace --config, closes #992 2020-11-24 12:01:47 -08:00
Simon Willison 30e64c8d3b
Use f-strings in place of .format()
Code transformed like so:

    pip install flynt
    flynt .
    black .
2020-11-15 15:24:22 -08:00
Simon Willison cefd058c1c
New explicit versioning mechanism
Closes #1054
2020-10-28 20:38:15 -07:00
Simon Willison 310c3a3e05 New datasette.urls URL builders, refs #904 2020-10-19 17:33:59 -07:00
Simon Willison 6aa5886379 --load-extension=spatialite shortcut, closes #1028 2020-10-19 15:37:43 -07:00
Simon Willison 7e70643852 Removed --debug option, which didn't do anything - closes #814 2020-10-10 16:39:38 -07:00
Simon Willison 8f97b9b58e
datasette.client internal requests mechanism
Closes #943

* Datasette now requires httpx>=0.15
* Support OPTIONS without 500, closes #1001
* Added internals tests for datasette.client methods
* Datasette's own test mechanism now uses httpx to simulate requests
* Tests simulate HTTP 1.1 now
* Added base_url in a bunch more places
* Mark some tests as xfail - will remove that when new httpx release ships: #1005
2020-10-09 09:11:24 -07:00
Simon Willison cac051bb8a Fix for 'open' bug, closes #973 2020-09-22 08:39:48 -07:00
Simon Willison a980199e61 New -o option for opening Datasette in your browser, closes #970 2020-09-22 07:26:47 -07:00
Simon Willison ca5c405d0f New 'datasette --pdb' option, closes #962 2020-09-11 11:37:55 -07:00
Simon Willison 69033c6ec4 datasette install --upgrade option, closes #945 2020-08-19 10:20:41 -07:00
Simon Willison 45414f8412 --get now calls startup() plugin hooks, closes #934 2020-08-15 13:52:41 -07:00
Simon Willison e139a7619f
'datasette --get' option, closes #926
Also made a start on the datasette.utils.testing module, refs #898
2020-08-11 17:24:40 -07:00