datasette-edit-schema 0.7.1__tar.gz → 0.8a5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. {datasette-edit-schema-0.7.1/datasette_edit_schema.egg-info → datasette_edit_schema-0.8a5}/PKG-INFO +46 -11
  2. datasette-edit-schema-0.7.1/PKG-INFO → datasette_edit_schema-0.8a5/README.md +35 -23
  3. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema/__init__.py +231 -67
  4. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema/templates/edit_schema_create_table.html +6 -3
  5. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema/templates/edit_schema_database.html +1 -1
  6. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema/templates/edit_schema_table.html +32 -23
  7. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema/utils.py +2 -1
  8. datasette_edit_schema-0.8a5/datasette_edit_schema.egg-info/PKG-INFO +123 -0
  9. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema.egg-info/SOURCES.txt +1 -1
  10. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema.egg-info/requires.txt +1 -1
  11. datasette_edit_schema-0.8a5/pyproject.toml +36 -0
  12. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/tests/test_edit_schema.py +461 -135
  13. datasette-edit-schema-0.7.1/README.md +0 -70
  14. datasette-edit-schema-0.7.1/setup.py +0 -33
  15. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/LICENSE +0 -0
  16. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema/static/draggable.1.0.0-beta.11.bundle.js +0 -0
  17. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema/static/draggable.1.0.0-beta.11.bundle.min.js +0 -0
  18. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema/templates/edit_schema_index.html +0 -0
  19. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema.egg-info/dependency_links.txt +0 -0
  20. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema.egg-info/entry_points.txt +0 -0
  21. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/datasette_edit_schema.egg-info/top_level.txt +0 -0
  22. {datasette-edit-schema-0.7.1 → datasette_edit_schema-0.8a5}/setup.cfg +0 -0
@@ -1,20 +1,25 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: datasette-edit-schema
3
- Version: 0.7.1
3
+ Version: 0.8a5
4
4
  Summary: Datasette plugin for modifying table schemas
5
- Home-page: https://github.com/simonw/datasette-edit-schema
6
5
  Author: Simon Willison
7
- License: Apache License, Version 2.0
8
- Requires-Python: >=3.7
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://datasette.io/plugins/datasette-edit-schema
8
+ Project-URL: Changelog, https://github.com/simonw/datasette-edit-schema/releases
9
+ Project-URL: Issues, https://github.com/simonw/datasette-edit-schema/issues
10
+ Project-URL: CI, https://github.com/simonw/datasette-edit-schema/actions
11
+ Classifier: Framework :: Datasette
12
+ Requires-Python: >=3.10
9
13
  Description-Content-Type: text/markdown
10
14
  License-File: LICENSE
11
- Requires-Dist: datasette>=0.63
15
+ Requires-Dist: datasette>=1.0a21
12
16
  Requires-Dist: sqlite-utils>=3.35
13
17
  Provides-Extra: test
14
18
  Requires-Dist: pytest; extra == "test"
15
19
  Requires-Dist: pytest-asyncio; extra == "test"
16
20
  Requires-Dist: beautifulsoup4; extra == "test"
17
21
  Requires-Dist: html5lib; extra == "test"
22
+ Dynamic: license-file
18
23
 
19
24
  # datasette-edit-schema
20
25
 
@@ -25,6 +30,8 @@ Requires-Dist: html5lib; extra == "test"
25
30
 
26
31
  Datasette plugin for modifying table schemas
27
32
 
33
+ > :warning: The latest alpha release depends on Datasette 1.09a. Use [version 0.7.1](https://github.com/simonw/datasette-edit-schema/blob/0.7.1/README.md) with older releases of Datasette.
34
+
28
35
  ## Features
29
36
 
30
37
  * Add new columns to a table
@@ -54,13 +61,41 @@ By default only [the root actor](https://datasette.readthedocs.io/en/stable/auth
54
61
 
55
62
  ## Permissions
56
63
 
57
- The `edit-schema` permission governs access. You can use permission plugins such as [datasette-permissions-sql](https://github.com/simonw/datasette-permissions-sql) to grant additional access to the write interface.
64
+ This plugin registers an `edit-schema` action that applies to databases. Granting that action gives an actor access to every feature in the UI. Instances launched with `datasette --root` automatically allow the signed-in root actor to perform this action.
65
+
66
+ All permission checks now call `datasette.allowed()` with `DatabaseResource` or `TableResource` objects, so they work seamlessly with Datasette’s `permission_resources_sql()` hook and configuration-based permission rules. Plugins such as [datasette-permissions-sql](https://github.com/simonw/datasette-permissions-sql) can continue to be used to grant access to the write interface.
67
+
68
+ For finer control you can combine Datasette’s built-in actions:
69
+
70
+ - `create-table` allows users to create a new table (database-level resource).
71
+ - `drop-table` allows users to drop a table (table-level resource).
72
+ - `alter-table` allows users to alter a table (table-level resource).
73
+
74
+ To rename a table a user must have both `drop-table` permission for that table and `create-table` permission for that database.
75
+
76
+ For example, to configure Datasette to allow the user with ID `pelican` to create, alter and drop tables in the `marketing` database and to alter just the `notes` table in the `sales` database, you could use the following configuration:
77
+
78
+ ```yaml
79
+ databases:
80
+ marketing:
81
+ permissions:
82
+ create-table:
83
+ id: pelican
84
+ drop-table:
85
+ id: pelican
86
+ alter-table:
87
+ id: pelican
88
+ sales:
89
+ tables:
90
+ notes:
91
+ permissions:
92
+ alter-table:
93
+ id: pelican
94
+ ```
58
95
 
59
- These permission checks will call the `permission_allowed()` plugin hook with three arguments:
96
+ ## Events
60
97
 
61
- - `action` will be the string `"edit-schema"`
62
- - `actor` will be the currently authenticated actor - usually a dictionary
63
- - `resource` will be the string name of the database
98
+ This plugin fires `create-table`, `alter-table` and `drop-table` events when tables are modified, using the [Datasette Events](https://docs.datasette.io/en/latest/events.html) system introduced in [Datasette 1.0a8](https://docs.datasette.io/en/latest/changelog.html#a8-2024-02-07).
64
99
 
65
100
  ## Screenshot
66
101
 
@@ -1,21 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: datasette-edit-schema
3
- Version: 0.7.1
4
- Summary: Datasette plugin for modifying table schemas
5
- Home-page: https://github.com/simonw/datasette-edit-schema
6
- Author: Simon Willison
7
- License: Apache License, Version 2.0
8
- Requires-Python: >=3.7
9
- Description-Content-Type: text/markdown
10
- License-File: LICENSE
11
- Requires-Dist: datasette>=0.63
12
- Requires-Dist: sqlite-utils>=3.35
13
- Provides-Extra: test
14
- Requires-Dist: pytest; extra == "test"
15
- Requires-Dist: pytest-asyncio; extra == "test"
16
- Requires-Dist: beautifulsoup4; extra == "test"
17
- Requires-Dist: html5lib; extra == "test"
18
-
19
1
  # datasette-edit-schema
20
2
 
21
3
  [![PyPI](https://img.shields.io/pypi/v/datasette-edit-schema.svg)](https://pypi.org/project/datasette-edit-schema/)
@@ -25,6 +7,8 @@ Requires-Dist: html5lib; extra == "test"
25
7
 
26
8
  Datasette plugin for modifying table schemas
27
9
 
10
+ > :warning: The latest alpha release depends on Datasette 1.09a. Use [version 0.7.1](https://github.com/simonw/datasette-edit-schema/blob/0.7.1/README.md) with older releases of Datasette.
11
+
28
12
  ## Features
29
13
 
30
14
  * Add new columns to a table
@@ -54,13 +38,41 @@ By default only [the root actor](https://datasette.readthedocs.io/en/stable/auth
54
38
 
55
39
  ## Permissions
56
40
 
57
- The `edit-schema` permission governs access. You can use permission plugins such as [datasette-permissions-sql](https://github.com/simonw/datasette-permissions-sql) to grant additional access to the write interface.
41
+ This plugin registers an `edit-schema` action that applies to databases. Granting that action gives an actor access to every feature in the UI. Instances launched with `datasette --root` automatically allow the signed-in root actor to perform this action.
42
+
43
+ All permission checks now call `datasette.allowed()` with `DatabaseResource` or `TableResource` objects, so they work seamlessly with Datasette’s `permission_resources_sql()` hook and configuration-based permission rules. Plugins such as [datasette-permissions-sql](https://github.com/simonw/datasette-permissions-sql) can continue to be used to grant access to the write interface.
44
+
45
+ For finer control you can combine Datasette’s built-in actions:
46
+
47
+ - `create-table` allows users to create a new table (database-level resource).
48
+ - `drop-table` allows users to drop a table (table-level resource).
49
+ - `alter-table` allows users to alter a table (table-level resource).
50
+
51
+ To rename a table a user must have both `drop-table` permission for that table and `create-table` permission for that database.
52
+
53
+ For example, to configure Datasette to allow the user with ID `pelican` to create, alter and drop tables in the `marketing` database and to alter just the `notes` table in the `sales` database, you could use the following configuration:
54
+
55
+ ```yaml
56
+ databases:
57
+ marketing:
58
+ permissions:
59
+ create-table:
60
+ id: pelican
61
+ drop-table:
62
+ id: pelican
63
+ alter-table:
64
+ id: pelican
65
+ sales:
66
+ tables:
67
+ notes:
68
+ permissions:
69
+ alter-table:
70
+ id: pelican
71
+ ```
58
72
 
59
- These permission checks will call the `permission_allowed()` plugin hook with three arguments:
73
+ ## Events
60
74
 
61
- - `action` will be the string `"edit-schema"`
62
- - `actor` will be the currently authenticated actor - usually a dictionary
63
- - `resource` will be the string name of the database
75
+ This plugin fires `create-table`, `alter-table` and `drop-table` events when tables are modified, using the [Datasette Events](https://docs.datasette.io/en/latest/events.html) system introduced in [Datasette 1.0a8](https://docs.datasette.io/en/latest/changelog.html#a8-2024-02-07).
64
76
 
65
77
  ## Screenshot
66
78