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

Ability to only load a specific list of plugins #2164

Closed
simonw opened this issue Aug 30, 2023 · 1 comment
Closed

Ability to only load a specific list of plugins #2164

simonw opened this issue Aug 30, 2023 · 1 comment

Comments

@simonw
Copy link
Owner

simonw commented Aug 30, 2023

I'm going to try and get this working through an environment variable, so that you can start Datasette and it will only load a subset of plugins including those that use the register_commands() hook.

Initial research on this:

@simonw
Copy link
Owner Author

simonw commented Aug 30, 2023

Figured this out so far with the help of GPT-4: https://chat.openai.com/share/0e785865-621b-4fb3-ba05-7449e57c8496

Now this works:

DATASETTE_LOAD_PLUGINS=datasette-write-ui datasette plugins
[
    {
        "name": "datasette_write_ui",
        "static": true,
        "templates": true,
        "version": null,
        "hooks": [
            "extra_template_vars",
            "register_routes"
        ]
    }
]

Or multiple plugins:

DATASETTE_LOAD_PLUGINS=datasette-write-ui,datasette-pretty-json datasette plugins

Outputs:

[
    {
        "name": "datasette_pretty_json",
        "static": false,
        "templates": false,
        "version": null,
        "hooks": [
            "render_cell"
        ]
    },
    {
        "name": "datasette_write_ui",
        "static": true,
        "templates": true,
        "version": null,
        "hooks": [
            "extra_template_vars",
            "register_routes"
        ]
    }
]

@simonw simonw closed this as completed in 6bfe104 Aug 30, 2023
@simonw simonw changed the title Research ability to only load a specific list of plugins Ability to only load a specific list of plugins Sep 8, 2023
simonw added a commit that referenced this issue Sep 8, 2023
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