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

Setting System Feature #2157

Merged
merged 123 commits into from Jun 6, 2017
Merged

Setting System Feature #2157

merged 123 commits into from Jun 6, 2017

Conversation

@afshin
Copy link
Member

@afshin afshin commented May 8, 2017

This PR introduces a setting system for JupyterLab. There are a few core concepts:

  • Settings are stored as JSON blobs tied/namespaced to plugins.
  • Each plugin's settings have two tiers: user and system. The system JSON represents the default values and is read-only. The user values are editable by the end user by opening the settings editor from the Help menu.

Change list

  • Add the IDatastore interface to describe a low-level read/write database. IStateDB and ISettingRegistry both depend on it. This simplifies swapping out back-ends for state and setting databases, and others if they arise.
  • Make InstanceTracker independent of @jupyterlab/application.
  • Create a setting registry extension: ISettingRegistry, defined in @jupyterlab/coreutils.
  • Create a setting system editor.
@afshin afshin added this to the 1.0 milestone May 8, 2017
@afshin afshin self-assigned this May 8, 2017
@afshin afshin changed the title Setting System feature Setting System Feature May 8, 2017
@afshin afshin force-pushed the settings branch 4 times, most recently from 4b4dec8 to 7527a8f May 17, 2017
if (typeof settings['lineNumbers'] === 'string') {
commands.execute(CommandIDs.lineNumbers, settings);

lineNumbers = !!settings.get('lineNumbers');
Copy link
Member

@blink1073 blink1073 May 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noice

@afshin afshin force-pushed the settings branch 2 times, most recently from be7344d to c3c9fef May 19, 2017
@ellisonbg
Copy link
Contributor

@ellisonbg ellisonbg commented May 23, 2017

Let us know when this is ready for review ;-)

@afshin
Copy link
Member Author

@afshin afshin commented May 23, 2017

@ellisonbg I will let you know. And I'll write it up so that it's not just a big blob of code.

@afshin afshin force-pushed the settings branch 3 times, most recently from 90f78f4 to c1efa1d May 23, 2017
id: 'jupyter.services.setting-registry',
requires: [IStateDB],
activate: (app: JupyterLab, state: IStateDB) => {
const registry = new SettingRegistry();
Copy link
Member

@blink1073 blink1073 May 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the statedb here?

Copy link
Member Author

@afshin afshin May 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens automatically inside the SettingRegistry constructor:

/**
 * Create a new setting registry.
 */
constructor(options: SettingRegistry.IOptions = { datastore: null }) {
  const namespace = 'jupyter.db.settings';
  this._datastore = options.datastore || new StateDB({ namespace });
}

Copy link
Member

@blink1073 blink1073 May 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is that the state instance should be used (new SettingRegistry({ datastore: state }))

Copy link
Member

@blink1073 blink1073 May 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either that or the plugin shouldn't depend on a statedb.

Copy link
Member Author

@afshin afshin May 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, good point. I originally did it that way and then I forgot to remove IStateDB as a requirement when I switched it.

@afshin
Copy link
Member Author

@afshin afshin commented May 25, 2017

FYI @ellisonbg, I had some merge conflicts when I rebased, so while I was resolving them, I also refactored this file which may affect work you want to do: e7dbedc

@ellisonbg
Copy link
Contributor

@ellisonbg ellisonbg commented May 25, 2017

@vineetgorhe would also affect you if you dive into the markdown stuff again.

@afshin afshin force-pushed the settings branch 5 times, most recently from 1359842 to 20b2da0 May 30, 2017
@@ -101,6 +104,17 @@ const palettePlugin: JupyterLabPlugin<ICommandPalette> = {


/**
* The default layout restorer provider.
Copy link
Member

@blink1073 blink1073 Jun 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect description

@mpacer
Copy link
Member

@mpacer mpacer commented Jun 6, 2017

Just a note about an example of a SublimeText Package that has an extremely complicated settings format with tonnes of documentation: https://github.com/SublimeText/LaTeXTools.

It's not the case that we should design for, but it's something that is likely to come up if people are doing complicated publishing oriented tasks like writing papers/reports. So having it in mind as this moves forward is likely to be helpful.

@blink1073
Copy link
Member

@blink1073 blink1073 commented Jun 6, 2017

Looks and works great!

@blink1073 blink1073 merged commit bdcb204 into jupyterlab:master Jun 6, 2017
2 checks passed
@blink1073 blink1073 mentioned this pull request Jun 14, 2017
@jasongrout jasongrout removed this from the 1.0 milestone Feb 1, 2019
@jasongrout jasongrout added this to the 0.24 milestone Feb 1, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants