-
-
Notifications
You must be signed in to change notification settings - Fork 694
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
Support YAML in metadata - metadata.yaml #713
Comments
I can add https://pypi.org/project/PyYAML/ as a dependency for this. One open question: how best to tell the difference between a JSON and a YAML file? I'd rather not do it based on a file extension. Since I'm going to read the whole file into memory anyway (rather than try to stream it) and I only load it once at startup, maybe I try to parse with one and, if there's a parsing error, try the other one before giving up? |
I'm going to depend on ~=5.3 https://github.com/yaml/pyyaml/blob/master/CHANGES - though |
I'm going to try to parse as JSON first, then fall back to YAML, then error. |
Don't forget to fix the code in publish that loads and modifies metadata, e.g.: datasette/datasette/utils/__init__.py Lines 361 to 367 in 2aaad72
And: datasette/datasette/publish/heroku.py Lines 156 to 168 in 2aaad72
|
datasette/datasette/utils/__init__.py Lines 795 to 803 in 6717c71
|
I was originally going to do this with a plugin - see #357 - but the more I work with
metadata.json
the more I want it to just accept YAML as an optional alternative to JSON.The best example why is still this one: https://github.com/simonw/russian-ira-facebook-ads-datasette/blob/master/russian-ads-metadata.yaml
YAML is just SO much better than JSON for multi-line strings - in particular HTML and SQL, both of which are common in
metadata.json
files.The text was updated successfully, but these errors were encountered: