Open simonw opened 7 months ago
Option 1. is where we are now, and it's beginning to suck.
Option 2 is plausible? My datasette-secrets
plugin failed on from datasette import Permission
- but maybe I could have that class in <1.0 without it doing anything useful, just so plugins can start using register_permissions()
? Bit messy though.
What's the minimal work I could do for option 3 to be worthwhile I wonder?
After browsing through https://github.com/simonw/datasette/compare/0.64.6...1.0a13 a bit I think a full forward-porting of the permissions work would be too hard. But having a Permission
class that can be imported and does nothing except for allow register_permissions()
to be called for 1.0a+ might be worthwhile.
The rest of the problem could then be solved in datasette-test
. Maybe something like this:
from datasette_test import Datasette
ds = Datasette(
plugin_config={"datasette-extract": "..."},
permissions={"manage-secrets": {"id": "admin"}}
)
Where that permissions=
thing uses config={"permissions": ...}
for Datasette 1.0a+ and some more complex plugin-based mechanism for <1.0
.
With 1.0 growing ever closer, I'm running into some problems with plugins. datasette-secrets is currently only compatible with 1.0a+ because of the way it uses the new permissions infrastructure from 1.0. But I want a bunch of other plugins to make use of
datasette-secrets
:And this means that those plugins will stop working with Datasette <1.0 due to that dependency.
I looked into changing
datasette-secrets
to be compatible with both versions and it's a tiny bit inconvenient mainly because the test suite uses some conveniences in 1.0 - this for example:That
permissions
piece of configuration is a much more convenient way of testing permissions.Some options:
0.65
which backports some of these conveniences from 1.0, such that it's pleasant and easy to write tests that work in bothI already have a good pattern for running CI against both versions, as seen here: https://github.com/simonw/datasette-configure-fts/blob/1.1.3/.github/workflows/test.yml