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

Cascading Schemas #10010

Closed
mlucool opened this issue Mar 25, 2021 · 12 comments · Fixed by jupyterlab/jupyterlab_server#179 or jupyterlab/jupyterlab_server#188
Closed

Cascading Schemas #10010

mlucool opened this issue Mar 25, 2021 · 12 comments · Fixed by jupyterlab/jupyterlab_server#179 or jupyterlab/jupyterlab_server#188
Assignees
Labels
enhancement status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

Comments

@mlucool
Copy link
Contributor

mlucool commented Mar 25, 2021

Problem

Jupyter's config (and data) use a cascading model for loading configs. An admin can set a systemwide default config in the venv which overrides the Jupyter defaults; then a user can set another config to override those. This model works very well for deploying Jupyter in a shared environment. Schemas don't share this cascading model, making it hard to override defaults as an administrator. In jupyter@2.0, an admin could override the generated schema directory, but with federated modules, that does not seem possible.

Proposed Solution

Add a third directory for schemas that is configurable. This would be merged with federated/installed modules default schema to become the "System Defaults" that a user sees. "User preferences" overriding these would remain unchanged.

Note: I am unfamiliar with this code, so there may be a much simpler way.

@jasongrout
Copy link
Contributor

You can still override schema defaults as a system administrator with the overrides.json file. See https://jupyterlab.readthedocs.io/en/stable/user/directories.html?highlight=overrides.json#overrides-json

@mlucool mlucool closed this as completed Mar 25, 2021
@jasongrout jasongrout added the status:Answered The issue has been answered by a community member. label Mar 25, 2021
@mlucool
Copy link
Contributor Author

mlucool commented Mar 26, 2021

Hi @jasongrout,

This worked pretty well, but I ran into three issues:

  1. From what I can tell there is no way to override shortcuts. Notably, we prefer documentsearch:start as Accel Shift F as you have suggested elsewhere.
  2. If you are setting one property of an object, the settings menu loses the other properties. It is understandable why this was chosen, but it means that every new property requires admins to track and add back. Example:
    "@jupyterlab/notebook-extension:tracker": {
        "codeCellConfig": {
            "lineNumbers": True,
          }
     }

image
3. While minor, it would be nice to support json5 or a py file (mostly so that we can comment why something was done)

@mlucool mlucool reopened this Mar 26, 2021
@jasongrout
Copy link
Contributor

jasongrout commented Mar 26, 2021

From what I can tell there is no way to override shortcuts. Notably, we prefer documentsearch:start as Accel Shift F as you have suggested elsewhere.

This is #9858 (for 3.1)

If you are setting one property of an object, the settings menu loses the other properties. It is understandable why this was chosen, but it means that every new property requires admins to track and add back. Example:

Right, we don't merge keys. Perhaps we should? That comes with its own set of problems to make sure things are consistent, etc.

@mlucool
Copy link
Contributor Author

mlucool commented Mar 26, 2021

Perhaps we should? That comes with its own set of problems to make sure things are consistent, etc.

What if we did something a bit hacky?

    "@jupyterlab/notebook-extension:tracker": {
        "codeCellConfig": {
            "__merge": True # Not sure if the default is to merge or replace.
            "lineNumbers": True,
          }
     }

@jasongrout
Copy link
Contributor

What if we did something a bit hacky?

Great question, thanks for asking. I haven't thought a lot about it, so I'm not sure how I feel about it (and of course would love others to chime in as well about what they think). Is this something you'd want to open a PR for?

@jasongrout jasongrout removed the status:Answered The issue has been answered by a community member. label Mar 27, 2021
@mlucool
Copy link
Contributor Author

mlucool commented Apr 12, 2021

Is this something you'd want to open a PR for?

Depends on how complex it would be - any pointers?

Also, where is overrides.json loaded from? Would it be ok if I made a PR to support another format (json5)? Notably, I'd like to have comments in this file. We may want to consider that support for all schema files

@jasongrout
Copy link
Contributor

The code is in https://github.com/jupyterlab/jupyterlab_server/blob/master/jupyterlab_server/settings_handler.py (search for "overrides" to see places where the logic is implemented).

@jasongrout
Copy link
Contributor

@mlucool
Copy link
Contributor Author

mlucool commented Apr 23, 2021

Is this something you'd want to open a PR for?

We can open a PR for this. Any objections to the magic private key proposal above (i.e. __merge)? For backwards compatibility, it should default to not merge. On the other hand, I suspect people expect it to merge as that's what is happening on the top level (e.g. the codeCellConfig is merged into the object as a replacement and we don't lose all other keys)

@mlucool
Copy link
Contributor Author

mlucool commented Apr 23, 2021

@blink1073 this issue is still open as we discuss what to do about _merge. It won't let me reopen, so will you?

@blink1073 blink1073 reopened this Apr 23, 2021
@blink1073
Copy link
Contributor

👍🏼

@goanpeca
Copy link
Member

goanpeca commented May 1, 2021

We can open a PR for this. Any objections to the magic private key proposal above (i.e. __merge)? For backwards compatibility, it should default to not merge. On the other hand, I suspect people expect it to merge as that's what is happening on the top level (e.g. the codeCellConfig is merged into the object as a replacement and we don't lose all other keys)

Thoughts on this @blink1073 ?

@blink1073 blink1073 reopened this May 10, 2021
@goanpeca goanpeca self-assigned this May 10, 2021
@github-actions github-actions bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Jan 5, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
4 participants