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

Make _config.yml have top-level keys that map onto extensions #1728

Open
chrisjsewell opened this issue May 12, 2022 · 3 comments
Open

Make _config.yml have top-level keys that map onto extensions #1728

chrisjsewell opened this issue May 12, 2022 · 3 comments
Labels
enhancement New feature or request 🏷️ config

Comments

@chrisjsewell
Copy link
Contributor

chrisjsewell commented May 12, 2022

With new versions of myst-parser and myst-nb, file-level configuration is now available under the myst/mystnb` "namespaces":

Both of which are auto-generated from a central "source of truth"

This may also be the case with the sphinx-book-theme: executablebooks/sphinx-book-theme#557

It would be desirable for the _config.yml to have the same structure, e.g.

general:
  author: Bob Geldof
myst:
  enable_extensions: [deflist]
mystnb:
  execution_mode: auto
theme_html:
  collapse_sidebar: true
other:
  suppress_warnings: ["myst.strikethrough"]

To address issues like #1673, it might also be desirable to first run the YAML through jinja, with filters added to handle general use cases, e.g. for environmental variables:

mystnb:
  execution_show_tb: {{ true if env('READTHEDOCS') else false }}

cc @choldgraf @mmcky

@chrisjsewell chrisjsewell added enhancement New feature or request 🏷️ config labels May 12, 2022
@choldgraf
Copy link
Collaborator

I think this is an important topic to get correct in order to avoid us having a lot of configuration confusion in the future. I agree with @chrisjsewell's assessment here - it would simplify our configuration considerably if we could have a reliable parent_key -> configuration for parent mapping pattern. This could also have the benefit of minimizing documentation and upgrade toil as these configurations change over time.

For example, many Sphinx configurations begin with {prefix}_option_name (e.g. nb_execution_mode). It would simplify our configuration considerably if we could make assumptions like:

mystnb:
  execution_mode:

maps directly on to nb_execution_mode. Then we could reduce the user friction associated with seeing two different configurations for the same tool (one in Sphinx and one in Jupyter Book).

Then we could also start to remove unnecessarily idiosynchratic configuration differences that we need to hack around with stuff like:

https://github.com/executablebooks/jupyter-book/blob/a72e43ae5755515208a028f69b3d17c4d0c4a062/jupyter_book/config.py#L333-L342

I can't tell if this is what @chrisjsewell is suggesting or not so wanted to throw it out there 😅

@chrisjsewell
Copy link
Contributor Author

many Sphinx configurations begin with {prefix}_option_name (e.g. nb_execution_mode). It would simplify our configuration considerably if we could make assumptions

Oh yeh, this is literally how the config is generated, for myst-parser and myst-nb, you just iterate over the config dataclasses and add the prefix:

@mmcky
Copy link
Contributor

mmcky commented May 16, 2022

I really like the namespaces idea here.

This will also really help align options with their software "layer of responsibility".

@choldgraf choldgraf changed the title Restructure _config.yml Make _config.yml have top-level keys that map onto extensions Jun 9, 2022
This was referenced Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🏷️ config
Projects
None yet
Development

No branches or pull requests

3 participants