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

Improve integration with Notebook 7 #16

Merged
merged 10 commits into from
Feb 15, 2024
Merged

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Jan 16, 2024

Fixes #14.

Opening a notebook

jupyterlab-open-url-paramater-notebook.webm

Open a file

jupyterlab-open-url-parameter-edit.webm

@jtpio jtpio added the enhancement New feature or request label Jan 16, 2024
Copy link

Binder 👈 Launch a Binder on branch jtpio/jupyterlab-open-url-parameter/nb7

@jtpio jtpio marked this pull request as ready for review January 16, 2024 09:41
@jtpio jtpio marked this pull request as draft January 16, 2024 09:51
@jtpio jtpio marked this pull request as ready for review January 16, 2024 10:07
@jtpio jtpio requested a review from yuvipanda January 16, 2024 10:07
app.restored.then(() => {
// use the JupyterLab command to open the file from the URL
urls.forEach(url => {
void commands.execute('filebrowser:open-url', { url });
Copy link
Member Author

Choose a reason for hiding this comment

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

For reference, this drops the implicit dependency on the upstream command in JupyterLab.

Copy link
Member Author

Choose a reason for hiding this comment

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

But it would be worth reconsidering some time in the future to unify how files are fetched and opened in both JupyterLab and the different Notebook 7 applications.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think it's a good idea that we can maybe move faster here, and then upstream back?

@jtpio jtpio marked this pull request as draft January 17, 2024 12:54
});

// handle the route and remove the fromURL parameter
const handleRoute = () => {
const url = new URL(URLExt.join(PageConfig.getBaseUrl(), request));
// only remove the fromURL parameter
url.searchParams.delete(paramName);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Additionally, I'd suggest (maybe optionally, but maybe not) not deleting the query param. At least for me, that means users can copy a jupyterlite link and give it to someone else, and it will actually 'just' work

@yuvipanda
Copy link
Collaborator

Anything that can help move this forward? :D

@jtpio
Copy link
Member Author

jtpio commented Feb 12, 2024

Anything that can help move this forward? :D

We can address your suggestions above, and then it should be good to go for a new release.

@yuvipanda
Copy link
Collaborator

Sounds great! I think this is ready to come out of draft and be merged / released? (I don't have rights in this repo)

@jtpio
Copy link
Member Author

jtpio commented Feb 14, 2024

There are still a couple of rough edges, for example the file name not being shown properly in the URL after loading the file. And also since the file is downloaded, there is the popup asking to overwrite the file next time a user opens the same URL (which is technically expected, although could become annoying).

But it's usable. So we could indeed merge, release, and fix the remaining issues later?

@jtpio jtpio marked this pull request as ready for review February 14, 2024 08:35
@jtpio
Copy link
Member Author

jtpio commented Feb 14, 2024

(I don't have rights in this repo)

I added you to the repo.

We're using the Jupyter Releaser for making the releases. It's just a matter of triggering GitHub workflows: https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html

If you would like to give it a try, we can use next as the version spec which should bump the version to 0.2.1. Otherwise I'm also happy to do the release.

@yuvipanda
Copy link
Collaborator

And also since the file is downloaded, there is the popup asking to overwrite the file next time a user opens the same URL (which is technically expected, although could become annoying).

Would this occur in jupyterlite even if you're just using the memory storage backend?

@yuvipanda
Copy link
Collaborator

yay for more rights :) Although I think in this case you shouldn't wait for me, just do the release when you feel it's right.

For me, if this doesn't have the overewrite dialog show up in the memory backend, it's good to go :)

@jtpio
Copy link
Member Author

jtpio commented Feb 14, 2024

Would this occur in jupyterlite even if you're just using the memory storage backend?

Good point, it should indeed not store the file if enabled.

We can add it to the ReadTheDocs demo deployment to check if it works as expected.

@jtpio
Copy link
Member Author

jtpio commented Feb 14, 2024

@jtpio
Copy link
Member Author

jtpio commented Feb 15, 2024

To test it: https://jupyterlab-open-url-param--16.org.readthedocs.build/en/16/lite/notebooks/?fromURL=https://raw.githubusercontent.com/jupyterlab/jupyterlab-demo/master/notebooks/Lorenz.ipynb

For reference opening the same link looks fine after enabling the memory storage on the demo RTD deployment:

open-url-parameter-jupyterlite-memory-storage.webm

@jtpio jtpio merged commit 7d144fe into jupyterlab-contrib:main Feb 15, 2024
6 checks passed
@jtpio jtpio deleted the nb7 branch February 15, 2024 07:43
@jtpio
Copy link
Member Author

jtpio commented Feb 15, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doesn't work with notebook 7
2 participants