Skip to content
Permalink
Browse files

Have token export be same as interface

  • Loading branch information...
saulshanabrook committed Aug 20, 2019
1 parent eb4d860 commit f407b873e6323d3bfbfffbe84d6d3579d271c3e8
@@ -58,7 +58,7 @@ made up the `application/x.jupyter.resolve` mime type for this. All datasets sta
### Support a new data type or conversion:

You can either add support in this repo or by creating a new JupyterLab extension
that depends on the `RegistryToken` exposed by this extension. You can access a `Registry`, which you can use to add your own converter.
that depends on the `IRegistry` exposed by this extension. You can access a `Registry`, which you can use to add your own converter.

It might also be useful to view the existing data types, by looking at the source code in this repo and by using the debugger. You can open this in JupyterLab by looking for the "Data Debugger" command:

@@ -20,7 +20,7 @@ import { Token } from "@phosphor/coreutils";
import { Widget } from "@phosphor/widgets";
import { BehaviorSubject } from "rxjs";
import { map } from "rxjs/operators";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import { hasURL_ } from "./widgets";

export interface IActiveDataset extends BehaviorSubject<URL_ | null> {}
@@ -35,7 +35,7 @@ export const ACTIVE_URL = new URL("active:").toString();
export default {
activate,
id: "@jupyterlab/dataregistry-extension:active-dataset",
requires: [ILabShell, RegistryToken, IDocumentManager],
requires: [ILabShell, IRegistry, IDocumentManager],
provides: IActiveDataset,
autoStart: true
} as JupyterFrontEndPlugin<IActiveDataset>;
@@ -12,7 +12,7 @@ import {
import { Registry } from "@jupyterlab/dataregistry";

import * as React from "react";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import { widgetDataType } from "./widgets";
import { IActiveDataset } from ".";
import { Widget } from "@phosphor/widgets";
@@ -107,7 +107,7 @@ function Browser({
export default {
activate,
id: "@jupyterlab/dataregistry-extension:browser",
requires: [RegistryToken, ILayoutRestorer, ICommandPalette, IActiveDataset],
requires: [IRegistry, ILayoutRestorer, ICommandPalette, IActiveDataset],
autoStart: true
} as JupyterFrontEndPlugin<void>;

@@ -13,7 +13,7 @@ import {
} from "@jupyterlab/dataregistry";
import { widgetDataType } from "./widgets";
import { Observable, Subscription } from "rxjs";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import { Message } from "@phosphor/messaging";

export const CSVDataType = new DataTypeNoArgs<Observable<string>>("text/csv");
@@ -45,7 +45,7 @@ const id = "@jupyterlab/dataregistry-extension:csv-viewer";
export default {
activate,
id,
requires: [RegistryToken],
requires: [IRegistry],
autoStart: true
} as JupyterFrontEndPlugin<void>;

@@ -18,7 +18,7 @@ import {
} from "@jupyterlab/apputils";

import * as React from "react";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import { Registry, CachedObservable } from "@jupyterlab/dataregistry";
import { UseBehaviorSubject } from "./utils";

@@ -90,7 +90,7 @@ function Debugger({ registry }: { registry: Registry }) {
export default {
activate,
id,
requires: [RegistryToken, ILayoutRestorer, ICommandPalette],
requires: [IRegistry, ILayoutRestorer, ICommandPalette],
autoStart: true
} as JupyterFrontEndPlugin<void>;

@@ -1,5 +1,5 @@
import { IDocumentManager } from "@jupyterlab/docmanager";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import {
JupyterFrontEnd,
JupyterFrontEndPlugin
@@ -91,7 +91,7 @@ function activate(

export default {
id: "@jupyterlab/dataregistry-extension:documents",
requires: [RegistryToken, IDocumentManager],
requires: [IRegistry, IDocumentManager],
activate,
autoStart: true
} as JupyterFrontEndPlugin<void>;
@@ -19,7 +19,7 @@ import { classes, style } from "typestyle";
import { IActiveDataset, ACTIVE_URL } from "./active";
import { UseObservable } from "./utils";
import { viewerDataType } from "./viewers";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import {
Registry,
URL_,
@@ -342,7 +342,7 @@ const id = "@jupyterlab/dataregistry-extension:data-explorer";
export default {
activate,
id,
requires: [ILabShell, RegistryToken, ILayoutRestorer, IActiveDataset],
requires: [ILabShell, IRegistry, ILayoutRestorer, IActiveDataset],
provides: IDataExplorer,
autoStart: true
} as JupyterFrontEndPlugin<IDataExplorer>;
@@ -24,7 +24,7 @@ import {
textDataType
} from "@jupyterlab/dataregistry";
import { Observable, of } from "rxjs";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import { map } from "rxjs/operators";
import * as yaml from "js-yaml";
import { snippedDataType } from "./snippets";
@@ -130,7 +130,7 @@ function activate(app: JupyterFrontEnd, registry: Registry) {

export default {
id: "@jupyterlab/dataregistry-extension:file",
requires: [RegistryToken],
requires: [IRegistry],
activate,
autoStart: true
} as JupyterFrontEndPlugin<void>;
@@ -13,7 +13,7 @@ import {
} from "@jupyterlab/dataregistry";
import { IFileBrowserFactory } from "@jupyterlab/filebrowser";
import * as React from "react";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import { UseObservable } from "./utils";
import { reactDataType } from "./widgets";

@@ -23,7 +23,7 @@ import { reactDataType } from "./widgets";
export default {
activate,
id: "@jupyterlab/dataregistry-extension:files",
requires: [RegistryToken, IFileBrowserFactory],
requires: [IRegistry, IFileBrowserFactory],
autoStart: true
} as JupyterFrontEndPlugin<void>;

@@ -9,13 +9,13 @@ import {
createFolderConverter
} from "@jupyterlab/dataregistry";
import { IFileBrowserFactory } from "@jupyterlab/filebrowser";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import { Contents } from "@jupyterlab/services";

export default {
activate,
id: "@jupyterlab/dataregistry-extension:folders",
requires: [RegistryToken, IFileBrowserFactory],
requires: [IRegistry, IFileBrowserFactory],
autoStart: true
} as JupyterFrontEndPlugin<void>;

@@ -20,7 +20,7 @@ import {
observableListToObservable,
outputAreaModelToObservable
} from "./observables";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import { notebookContextDataType } from "./documents";


@@ -266,7 +266,7 @@ function activate(

export default {
id: "@jupyterlab/dataregistry-extension:notebooks",
requires: [RegistryToken],
requires: [IRegistry],
activate,
autoStart: true
} as JupyterFrontEndPlugin<void>;
@@ -6,7 +6,9 @@
import { JupyterFrontEndPlugin } from "@jupyterlab/application";
import { Token } from "@phosphor/coreutils";
import { Registry, relativeNestedURLConverter } from "@jupyterlab/dataregistry";
export const RegistryToken = new Token<Registry>(

export interface IRegistry extends Registry {}
export const IRegistry = new Token<IRegistry>(
"@jupyterlab/dataregistry:Registry"
);

@@ -17,7 +19,7 @@ export default {
activate,
id: "@jupyterlab/dataregistry-extension:data-registry",
requires: [],
provides: RegistryToken,
provides: IRegistry,
autoStart: true
} as JupyterFrontEndPlugin<Registry>;

@@ -15,7 +15,7 @@ import { relativeNestedDataType, Registry } from "@jupyterlab/dataregistry";
import { IActiveDataset } from "./active";
import { IRenderMimeRegistry, IRenderMime } from "@jupyterlab/rendermime";
import { ReactWidget } from "@jupyterlab/apputils";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import * as React from "react";
import { OutputArea } from "@jupyterlab/outputarea";
import { PanelLayout, Panel } from "@phosphor/widgets";
@@ -84,6 +84,6 @@ function activate(
export default {
activate,
id: "@jupyterlab/dataregistry-extension:rendermime",
requires: [IRenderMimeRegistry, IActiveDataset, RegistryToken],
requires: [IRenderMimeRegistry, IActiveDataset, IRegistry],
autoStart: true
} as JupyterFrontEndPlugin<void>;
@@ -21,7 +21,7 @@ import {
Registry
} from "@jupyterlab/dataregistry";
import { viewerDataType } from "./viewers";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";

type SnippetContext = {
path: string;
@@ -90,7 +90,7 @@ export function URLSnippetConverter({

export default {
id: "@jupyterlab/dataregistry-extension:snippets",
requires: [RegistryToken, INotebookTracker],
requires: [IRegistry, INotebookTracker],
activate: (
app: JupyterFrontEnd,
registry: Registry,
@@ -15,7 +15,7 @@ import * as React from "react";
import "react-table/react-table.css";
import { reactDataType } from "./widgets";
import { Observable } from "rxjs";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";
import { UseObservable } from "./utils";

/**
@@ -59,6 +59,6 @@ export default {
registry.addConverter(nteractDataExplorerConverter);
},
id: "@jupyterlab/dataregistry-extension:table-data",
requires: [RegistryToken],
requires: [IRegistry],
autoStart: true
} as JupyterFrontEndPlugin<void>;
@@ -12,12 +12,12 @@ import {
resolverURLConverter,
Registry
} from "@jupyterlab/dataregistry";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";

export default {
activate,
id: "@jupyterlab/dataregistry-extension:urls",
requires: [RegistryToken],
requires: [IRegistry],
autoStart: true
} as JupyterFrontEndPlugin<void>;

@@ -24,7 +24,7 @@ import {
import { Widget } from "@phosphor/widgets";
import * as React from "react";
import { viewerDataType } from "./viewers";
import { RegistryToken } from "./registry";
import { IRegistry } from "./registry";

const tracker = new WidgetTracker({ namespace: "dataregistry" });
const commandID = "dataregistry:view-url";
@@ -79,7 +79,7 @@ export const reactDataType: DataType<
export default {
activate,
id: "@jupyterlab/dataregistry-extension:widgets",
requires: [ILabShell, RegistryToken, ILayoutRestorer],
requires: [ILabShell, IRegistry, ILayoutRestorer],
autoStart: true
} as JupyterFrontEndPlugin<void>;

0 comments on commit f407b87

Please sign in to comment.
You can’t perform that action at this time.