Skip to content

Treat "plugins" in metadata as if it was "plugins" in configuration on startup #2248

@simonw

Description

@simonw

We migrated plugin settings from metadata.yaml to datasette.yaml in:

See b2ec871

This is a breaking change - Datasette currently shows an error if you attempt to start it with a metadata file that includes a "plugins" block:

https://github.com/simonw/datasette/blob/b466749e88b2ffbd925b6b3e777c8527ebc54e78/datasette/app.py#L347C32-L347C47

def fail_if_plugins_in_metadata(metadata: dict, filename=None):
"""If plugin config is inside metadata, raise an Exception"""
if metadata is not None and metadata.get("plugins") is not None:
suggested_extension = (
".yaml"
if filename is not None
and (filename.endswith(".yaml") or filename.endswith(".yml"))
else ".json"
)
raise Exception(
f'Datasette no longer accepts plugin configuration in --metadata. Move your "plugins" configuration blocks to a separate file - we suggest calling that datasette.{suggested_extension} - and start Datasette with datasette -c datasette.{suggested_extension}. See https://docs.datasette.io/en/latest/configuration.html for more details.'
)
return metadata

This turns out to be hugely inconvenient - way more than I expected!

So... I'm going to change this policy such that, while the documentation recommends putting plugin settings in datasette.yaml (see https://docs.datasette.io/en/latest/configuration.html) it continues to work with plugin settings in metadata.yaml/json - it shows a warning message and then treats them as if they were in config instead.

This will make the upgrade to Datasette 1.08a and beyond less painful for people (myself included).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions