-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Dummy] Support to provide advices #1
base: main
Are you sure you want to change the base?
Conversation
Should be defined only in one place (preferably in pyproject.toml)
"jupyter-releaser": { | ||
"hooks": { | ||
"before-build-npm": [ | ||
"python -m pip install jupyterlab~=3.1", | ||
"jlpm" | ||
], | ||
"before-build-python": [ | ||
"jlpm clean:all" | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an old heritage of the project template. It should now be specified in pyproject.toml
export class GalyleoModel | ||
extends CodeEditor.Model | ||
implements DocumentRegistry.ICodeModel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you said you actually don't need a specific model, you are simply applying your viewer on a file with a specific extension. Therefore you don't need a custom model,...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be wonderful (as we both know, the less code, the better :-)). But without a Model
and an associated ModelFactory
, I don't know how to associate an open command with a specific editor, since (AFAIK) the DocumentRegistry
operates on models, not extensions. But you are perfectly right, there should be no code in the GalyleoModel
class, and the only code in the GalyleoModelFactory
class should be a createNew
method, which just returns a GalyleoModel
.
If there is a better way to do this, (I am far from an expert), I would love to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I looked at the code again, and now I see what you mean! Thanks
/** | ||
* An implementation of a model factory for base64 files. | ||
*/ | ||
export class GalyleoModelFactory extends TextModelFactory { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
..., you don't need a model factory and...
@@ -332,7 +222,7 @@ function activateGalyleo( | |||
fileTypes: ['Galyleo'], | |||
defaultRendered: ['Galyleo'], | |||
defaultFor: ['Galyleo'], | |||
modelName: 'galyleo', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...and you can simply tell the widget factory it needs to use the default text model factory.
This is awesome! Every line of code I get to delete is a joy! |
@fcollonval I've created a branch, LTS-Devel (Long Term Sustainable development) where I'm implementing your changes. I'm currently getting hundreds of tsc errors, which just means I've screwed up a config file. If push comes to shove I'll just delete and redo with cookiecutter. |
@fcollonval I've merged your changes into a branch, and I will create a PR and ask you to review, if that is OK. Before I do:
I can't thank you enough for all the help you've given us, and I hesitate to ask for more, but I am hoping that the community will find our extension useful for things other than Galyleo. We called it the "JupyterLab Universal Extension" because the idea was that all we (or anyone else) would have to do to plug in a new web-based editor was write a little glue code on the editor side (it's about 30 lines of code for Galyleo) and simply provide a settings file on the JupyterLab side. |
Sure I can take a look.
If you could set up a binder for the PR with an example of what to check, it will be great. |
I have it up and running on our beta server, and so probably the easiest thing for you is for me just to give you an account on that (it's an enhanced JupyterHub). All I need is a Google-recognized email address. Is that OK? |
I sent you a PM on gitter. |
No description provided.