Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider releasing a 0.65 with some forwards compatibility for 1.0 #2335

Open
simonw opened this issue Apr 26, 2024 · 2 comments
Open

Consider releasing a 0.65 with some forwards compatibility for 1.0 #2335

simonw opened this issue Apr 26, 2024 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Apr 26, 2024

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:

@pytest.fixture
def ds():
    return Datasette(
        config={
            "plugins": {
                "datasette-secrets": {
                    "database": "_internal",
                    "encryption-key": TEST_ENCRYPTION_KEY,
                }
            },
            "permissions": {"manage-secrets": {"id": "admin"}},
        }
    )

That permissions piece of configuration is a much more convenient way of testing permissions.

Some options:

  1. Ignore this. Have more plugins that require 1.0a+ and hurry towards a 1.0 proper release
  2. Expand the https://github.com/datasette/datasette-test tool which is already intended to help paper over gaps between the two versions
  3. Release a 0.65 which backports some of these conveniences from 1.0, such that it's pleasant and easy to write tests that work in both

I 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

@simonw
Copy link
Owner Author

simonw commented Apr 26, 2024

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?

@simonw
Copy link
Owner Author

simonw commented Apr 26, 2024

After browsing through 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant