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 our versions.json support a top-level dictionary instead of just a list #786

Open
choldgraf opened this issue Jul 5, 2022 · 0 comments

Comments

@choldgraf
Copy link
Collaborator

Context

In our version switching implementation, we currently ask people to provide a JSON file that is a list of entries, each of which corresponds to a version. Something like:

  {
    "name": "dev",
    "version": "latest",
    "description": "the development version",
    "url": "https://pydata-sphinx-theme.readthedocs.io/en/latest/"
  },
  {
    "name": "0.10.0 (stable)",
    "version": "stable",
    "preferred": "true",
    "url": "https://pydata-sphinx-theme.readthedocs.io/en/stable/"
  },

However, there may be cases where we want to configure behavior changes for the switcher across all versions of documentation without requiring them to edit conf.py in each version. In that case, we need a single place to define the new configuration.

One example of this is discussed in:

Proposal

I propose that we allow the switcher.json structure to also be a dictionary instead of just a list of entries.

If switcher.json is a dictionary, then it must have a key versions: <list-of-entries>, where <list-of-entries> is the structure we currently support. It may also have other keys that configure it in different ways (e.g. preferred: "some-version")

If switcher.json is a list, then assume it is just <list-of-entries> with no extra configuration (AKA, the current behavior).

I think this would let us extend the functionality of the version switcher, without breaking current implementations, and without being too brittle since the check of "is it a dict or a list" is pretty straightforward.

Any objections / suggestions otherwise?

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

No branches or pull requests

1 participant