-
Notifications
You must be signed in to change notification settings - Fork 391
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
a helper tool for initializing defaultViewers in labconfig/ #1094
Conversation
browsing the doc, I come across this section this could be taken care of in |
Hey @parmentelat , thank you for suggesting this. This reminds me of some config file that are installed by the Obviously, making text files open as notebook with a single click for every Jupytext user would be quite a strong move and might not be appropriate, but maybe there's something interesting in that approach? I.e. do you think the setting could be an extension that the users could activate by typing something like |
let me clarify
so I was more hoping that my installation instructions could just read
or something along these lines |
@mwouts |
hi @mwouts I'm not sure that I fully understand your suggestion about again I was just proposing that, instead of instructing my newcomer students to mess with the file this would be an explicit choice indeed I do not know enough about the |
I went ahead and the latest tip of that branch has support for
if you first use |
@mwouts you are loudly silent on this thread, is there any chance I can get you to accept this PR ? believe me it would really really improve many teachers' life :) |
Thank you @parmentelat for this PR, I agree that it addresses the need of configuring the default viewers in Jupyter Lab/Notebook. I am sorry I have not answered earlier, this was because 1. your other PR seemed more urgent and 2. I have not taken/had time to test this myself yet, and maybe also 3. until now the configuration was done through |
Hi @mwouts in my use case, the feature addresses newbie L3 students, and during the very first course we have them install the software stack that they will use throughout the year to read the course notebooks I have seen your proposal that was about using instead plus, because we already have miniconda as part of the stack, my first inclination had been to propose the current code actually implements now if you'd rather that we define a new command instead, like, I don't know so to summarize, anything that can be made available for sept. 4 and that's reasonably easy to remember would work for me :-) |
Hey @parmentelat, no worries, I pretty am sure we will be able to meet the deadline on this one! What would you think about a new command line tool that we would call like this:
The idea is that later on maybe |
Hey @mwouts |
Hey @parmentelat , thanks for offering this. I think I will need to experiment a bit with this on my end too, so maybe I give it a try this weekend and I make a PR on top of yours ? |
Hi @mwouts |
plus, hopefully made pre-commit happy
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.
Thank you @parmentelat for providing this!
This sounds great. I have added a few comments about subcommand names/help if you don't mind to address them.
Also, would you mind updating the documentation under https://github.com/mwouts/jupytext/blob/main/docs/text-notebooks.md#with-a-single-click to mention the new tool jupytext-config
? We can probably remove the GIF and the other alternatives (e.g. the wget
command).
Also in the section https://github.com/mwouts/jupytext/blob/main/docs/text-notebooks.md#how-to-open-a-text-notebook-in-jupyter-notebook, I think we should mention that from notebook>=7
on, text notebooks open with the editor by default, but that this can be changed with either jupytext-config
or with the advanced settings editor.
Kind regards,
subparser.set_defaults(subcommand=subcommand) | ||
subcommand.fill_parser(subparser) | ||
args = parser.parse_args() | ||
return args.subcommand.main(args) |
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.
When we run jupytext-config
with no argument, the output is like this:
usage: jupytext-config [-h] {list,set-default-viewer} ...
jupytext-config: error: the following arguments are required: {list,set-default-viewer}
If possible I would prefer it to say one of the following sub-commands is required.
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.
see df4dcec
I'm not exactly comfy enough with subparsers to do what you ask without heavy surgery
so this is not quite what you asked, but without argument we now show the --help
message, which is a little more verbose
hi @mwouts |
I made all the code changes as far as the doc, I have a question about the |
oops, sorry, I was trying to rename in my repo the branch that this PR is built against, it did not work as I expected... |
so, trying to clarify the behaviour of the 2 entries in the Open With submenu: both Notebook and Jupytext Notebook behave the same, i.e. each will result in opening a new tab with the contents opened as a notebook and given that the default viewer with I mean, if I do Open with → Notebook and then later I double click on the same notebook, I will get 2 tabs with the same contents... what do you think @mwouts ? |
Hey @parmentelat , thank you for the changes!
These are three experimental builds, they are allowed to fail. Version 4.0 of
Well historically we only had a Notebook entry. We had to add Jupytext Notebook to the list of editors to allow opening |
Hi @mwouts
please review the latter and let me know of anything that needs further trimming |
last minute: I came across another section in the doc that needed a tweak about the classic notebook |
Hey @parmentelat , this looks great! Let me know when you want me to release this. |
Well as far as I am concerned this is good to fly :) $ grep 1\.15\.1 docs/*.md
docs/install.md:*Note*: as of this writing (version 1.15.1) this section **applies only to
docs/text-notebooks.md:Since version 1.15.1, `jupytext` comes with a helper command that allows you to so you may want to tweak these files if you want to issue this under another version number |
Awesome ! Yes 1.15.1 is the version number that I am planning to use for the new release. |
with nb7 about to be released, the default versions of jupyterlab(4)/notebook(7) will both require to configure
defaultViewers
if one wants, for example, to easily open text notebooks from the web app, or to be able to open notebooks through a URL (these settings were not required with nbclassic)here's a typical setup (this one is right for my use case, but more languages could be added of course)
So I've been thinking that providing a simple way to safely implement these settings would be helpful, especially for large classes of beginner students
Here's a POC for that
Of course it would need to be integrated more nicely, and could be exposed as either
jupytext init
jupytext --init
or any variant, to be discussed...
the first form would resonate with
conda init bash
but it might have ambiguous meaning (and/or be harder to implement)what if a file is named
init
?on the other hand, there's a precedent with
jupyter notebook mynotebook
andjupyter notebook list
that behave differently - so in this instance too, what if your notebook is calledlist
?anyways, just throwing the idea in the air, I just feel like having this could save a lot of frustration