# datasette-ui-extras
[](https://pypi.org/project/datasette-ui-extras/)
[](https://github.com/cldellow/datasette-ui-extras/releases)
[](https://github.com/cldellow/datasette-ui-extras/actions?query=workflow%3ATest)
[](https://github.com/cldellow/datasette-ui-extras/blob/main/LICENSE)
This plugin aims to be a batteries-included theme that makes Datasette more like a self-hosted Airtable or Notion.
You can share read-only access, while still allowing authenticated users to edit data.
You can see a demo at https://dux.fly.dev/
The plugin _tries_ to use stable Datasette hooks where possible. Some of the features
I add aren't natively extensible. In those cases, I do some shenanigans. I try to
exercise good judgment so that we can fail gracefully if Datasette makes a breaking
change.
## Installation
Install this plugin in the same environment as Datasette.
datasette install datasette-ui-extras
## Usage
The read-only changes are all enabled by default.
To enable the edit UI by default for a given table, list them in your metadata.json:
```json
{
"databases": {
"mydb": {
"plugins": {
"datasette-ui-extras": {
"editable": ["my_table", "my_view"]
}
}
}
}
}
```
You can also add `?_dux_edit=1` to the URL of a row page to get the edit view.
## Features
### Writing
- Adds an `edit-row.html` template which is used on row pages when `_dux_edit=1` is present.
- Adds an `edit_control` hook that you can use to override which control should be rendered to edit a given `(database, table, column)` tuple.
In progress, see the [Edit UI issue](https://github.com/cldellow/datasette-ui-extras/issues/48) for the roadmap.
### Reading / browsing
The plugin tries to emphasize your data, and de-emphasize any other
chrome.
- Tables have sticky headers so you can keep track of columns while
scrolling big data sets.
- Facets are rendered in a sidebar, lazy loaded after your core
table has been shown.
- The human description for '=' and '!=' against a column that is a
foreign key includes the label of the foreign row.
- New facet types:
- facet by year (`2022`)
- facet by year/month (`2022-10`)
- statistical summary (min, median, p90, p95, p99, max)
- Pressing `/` focuses the search box.
- When viewing a single entry's page, we render the data as a vertical
column, with one attribute per row.
- Mobile column options: Click the column name to see the column options, for sorting and faceting.
- JSON arrays of strings are displayed as a comma-separated list.
- JSON arrays of strings are 3x faster to filter and 4x faster to facet.
- Views: better support for views of the shape `SELECT ... FROM base_table`
- Can navigate to row page, e.g. https://dux.fly.dev/cooking/questions/1
- Advanced export: This control is hidden by default. Click the `(Advanced)` link to see it.
- Filters: These controls are hidden by default. Click the funnel icon to see them.
- Suggested facets: We no longer suggest facets. Instead, use the cog menu
on the column to add facets.
- Table/view definitions: These are hidden.
### API
- Views: better support for views of the shape `SELECT ... FROM base_table`
- JSON API can update these rows, assuming they have an [INSTEAD OF trigger](https://www.sqlite.org/lang_createtrigger.html#instead_of_trigger)
## Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd datasette-ui-extras
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Raw data
{
"_id": null,
"home_page": "https://github.com/cldellow/datasette-ui-extras",
"name": "datasette-ui-extras",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Colin Dellow",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/70/e1/ff04cf831662d0b437c1d04204d51ef3197b92b99f09e00601aefd5f9356/datasette-ui-extras-0.20.tar.gz",
"platform": null,
"description": "# datasette-ui-extras\n\n[](https://pypi.org/project/datasette-ui-extras/)\n[](https://github.com/cldellow/datasette-ui-extras/releases)\n[](https://github.com/cldellow/datasette-ui-extras/actions?query=workflow%3ATest)\n[](https://github.com/cldellow/datasette-ui-extras/blob/main/LICENSE)\n\nThis plugin aims to be a batteries-included theme that makes Datasette more like a self-hosted Airtable or Notion.\n\nYou can share read-only access, while still allowing authenticated users to edit data.\n\nYou can see a demo at https://dux.fly.dev/\n\nThe plugin _tries_ to use stable Datasette hooks where possible. Some of the features\nI add aren't natively extensible. In those cases, I do some shenanigans. I try to\nexercise good judgment so that we can fail gracefully if Datasette makes a breaking\nchange.\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n\n datasette install datasette-ui-extras\n\n## Usage\n\nThe read-only changes are all enabled by default.\n\nTo enable the edit UI by default for a given table, list them in your metadata.json:\n\n```json\n{\n \"databases\": {\n \"mydb\": {\n \"plugins\": {\n \"datasette-ui-extras\": {\n \"editable\": [\"my_table\", \"my_view\"]\n }\n }\n }\n }\n}\n```\n\nYou can also add `?_dux_edit=1` to the URL of a row page to get the edit view.\n\n## Features\n\n### Writing\n\n\n- Adds an `edit-row.html` template which is used on row pages when `_dux_edit=1` is present.\n\n- Adds an `edit_control` hook that you can use to override which control should be rendered to edit a given `(database, table, column)` tuple.\n\nIn progress, see the [Edit UI issue](https://github.com/cldellow/datasette-ui-extras/issues/48) for the roadmap.\n\n\n### Reading / browsing\n\nThe plugin tries to emphasize your data, and de-emphasize any other\nchrome.\n\n- Tables have sticky headers so you can keep track of columns while\n scrolling big data sets.\n\n- Facets are rendered in a sidebar, lazy loaded after your core\n table has been shown.\n\n- The human description for '=' and '!=' against a column that is a\n foreign key includes the label of the foreign row.\n\n- New facet types:\n - facet by year (`2022`)\n - facet by year/month (`2022-10`)\n - statistical summary (min, median, p90, p95, p99, max)\n\n- Pressing `/` focuses the search box.\n\n- When viewing a single entry's page, we render the data as a vertical\n column, with one attribute per row.\n\n- Mobile column options: Click the column name to see the column options, for sorting and faceting.\n\n- JSON arrays of strings are displayed as a comma-separated list.\n\n- JSON arrays of strings are 3x faster to filter and 4x faster to facet.\n\n- Views: better support for views of the shape `SELECT ... FROM base_table`\n - Can navigate to row page, e.g. https://dux.fly.dev/cooking/questions/1\n\n- Advanced export: This control is hidden by default. Click the `(Advanced)` link to see it.\n\n- Filters: These controls are hidden by default. Click the funnel icon to see them.\n\n- Suggested facets: We no longer suggest facets. Instead, use the cog menu\n on the column to add facets.\n\n- Table/view definitions: These are hidden.\n\n### API\n\n- Views: better support for views of the shape `SELECT ... FROM base_table`\n - JSON API can update these rows, assuming they have an [INSTEAD OF trigger](https://www.sqlite.org/lang_createtrigger.html#instead_of_trigger)\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n\n cd datasette-ui-extras\n python3 -m venv venv\n source venv/bin/activate\n\nNow install the dependencies and test dependencies:\n\n pip install -e '.[test]'\n\nTo run the tests:\n\n pytest\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "Adds UI enhancements to Datasette",
"version": "0.20",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9e371128c25dc4f07ce073c873208ab330aad7390a0d4efcc320965153bdf6da",
"md5": "764cb25e0a50df0ed0a4f406c08454d9",
"sha256": "0e9cfe3ccc2cfb5ffd525a1407de81c9f4647ed922baa8ba5aff8640c18cf9a2"
},
"downloads": -1,
"filename": "datasette_ui_extras-0.20-py3-none-any.whl",
"has_sig": false,
"md5_digest": "764cb25e0a50df0ed0a4f406c08454d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 34971,
"upload_time": "2023-02-05T23:14:36",
"upload_time_iso_8601": "2023-02-05T23:14:36.626302Z",
"url": "https://files.pythonhosted.org/packages/9e/37/1128c25dc4f07ce073c873208ab330aad7390a0d4efcc320965153bdf6da/datasette_ui_extras-0.20-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "70e1ff04cf831662d0b437c1d04204d51ef3197b92b99f09e00601aefd5f9356",
"md5": "4a6c06e1064fb2adee8dbb4b2180022b",
"sha256": "8144de139f3a12ce9dc586c4523706d57d74c308068e91f1a165bec461bcbc99"
},
"downloads": -1,
"filename": "datasette-ui-extras-0.20.tar.gz",
"has_sig": false,
"md5_digest": "4a6c06e1064fb2adee8dbb4b2180022b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 28097,
"upload_time": "2023-02-05T23:14:38",
"upload_time_iso_8601": "2023-02-05T23:14:38.287819Z",
"url": "https://files.pythonhosted.org/packages/70/e1/ff04cf831662d0b437c1d04204d51ef3197b92b99f09e00601aefd5f9356/datasette-ui-extras-0.20.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-05 23:14:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "cldellow",
"github_project": "datasette-ui-extras",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "datasette-ui-extras"
}