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

(WIP) Yaml playground #2821

Closed
wants to merge 7 commits into from
Closed

(WIP) Yaml playground #2821

wants to merge 7 commits into from

Conversation

ralsina
Copy link
Member

@ralsina ralsina commented Jun 4, 2017

Exploratory work for using YAML config instead/along conf.py (#2475)

@ralsina
Copy link
Member Author

ralsina commented Mar 15, 2018

Change of approach:

  • What is the minimal conf.yaml that works?
  • How can we help the user configure things?

I think we can do something like

nikola config OPT_NAME

that will add the option to conf.yaml if it exists in our option schema (to be created)

We can then add a nikola config update that will do the config updates we now have as fallbacks in code inside nikola

I think this can work nicely.

@Kwpolska
Copy link
Member

This is terrible for discoverability. By editing conf.py right now, you can find all the settings in one place. In the new model, how would you learn about settings? From the website?

@ralsina
Copy link
Member Author

ralsina commented Mar 15, 2018

On one hand yes, conf.py makes it possible to discover things by reading a thousand lines of code.

On the other hand, we have had complaints that conf.py is horribly confusing, and we have no way to actually do things like adding new options to conf.py once we add them in master.

So, maybe a nikola config --add-all that adds all options with default values?

@Kwpolska
Copy link
Member

Makes sense. We would probably need a web resource for settings, perhaps with categorization?

@ralsina
Copy link
Member Author

ralsina commented Mar 15, 2018

Something like that.

I think plugins should be able to introduce their own options, too.

@ralsina
Copy link
Member Author

ralsina commented Mar 15, 2018

Of course the real work is:

  1. Figure out how to describe a setting properly
  2. Make the commands to manage settings
  3. Port all settings to the new framework

@polyzen
Copy link
Contributor

polyzen commented Mar 15, 2018

The UX for WeeChat's key command comes to mind here: https://weechat.org/files/doc/stable/weechat_user.en.html#command_weechat_key

@ralsina
Copy link
Member Author

ralsina commented Mar 16, 2018

@polyzen nice!

@asmeurer
Copy link
Contributor

Isn't YAML better for discovery, because you can add commented out descriptions for new keys to an existing YAML when Nikola is updated? Doing this with conf.py is more difficult. Granted the current space for round-trip YAML parsing in Python is pretty abysmal (simply put, there is currently no existing 100% round tripping YAML parser). You might also consider some of the downsides of YAML as a language. It has a lot of gotchas related to its automatic type inference.

@polyzen
Copy link
Contributor

polyzen commented Mar 17, 2018

TOML is another consideration as it's (more) configuration-oriented.

@ralsina
Copy link
Member Author

ralsina commented Mar 17, 2018

@asmeurer ruamel does roundtrip comments which is the part I am most interested in

@polyzen TOML doesn't really roundtrip comments, last I checked.

@polyzen
Copy link
Contributor

polyzen commented Mar 17, 2018

┐('~`;)┌ https://github.com/LeopoldArkham/Molten

@Kwpolska
Copy link
Member

@polyzen

TOML sucks because of it's table syntax.
@ralsina in 2016

I’ll also add the lack of null values to this.

@ralsina
Copy link
Member Author

ralsina commented Mar 18, 2018

I had totally forgot how awful TOML tables were

@gwax
Copy link
Contributor

gwax commented Oct 30, 2019

There are things that I prefer about YAML and there are things that I prefer about TOML. In a context like this where we are working with large config files, with many options, I lean towards TOML because I feel that nested structures are more legible from a user perspective.

TOML Kit can round trip TOML and allows for adding / manipulating comments.

Caveat: I am pretty ok with conf.py so I don't have much of a horse in this race.

@ralsina
Copy link
Member Author

ralsina commented Oct 30, 2019

@gwax TOML's support for table-like data is horrible.

@ralsina
Copy link
Member Author

ralsina commented Apr 13, 2020

Playground is closed forever.

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

Successfully merging this pull request may close these issues.

5 participants