jupyterlab icon indicating copy to clipboard operation
jupyterlab copied to clipboard

Allow to customise directory and notebook icon

Open linlol opened this issue 2 years ago • 6 comments

References

for issue 15741 https://github.com/jupyterlab/jupyterlab/issues/15741

Code changes

as I proposed previously

currently for notebook and directory, Jupyter would ignore user-specification.

In my change, I would force lookup file type with respect to suffix/pattern, and check if the content type coincides with notebook/directory

as discussed with @krassowski and @JasonWeill , this shall be part of 4.2

User-facing changes

I believe no impact to current user (if no bug)

after implemented, user can customise icon via writing lab extensions

Backwards-incompatible changes

I guess no backwards incompatibility breaking since it is small change

linlol avatar Feb 20 '24 07:02 linlol

Thanks for making a pull request to jupyterlab! To try out this branch on binder, follow this link: Binder

jupyterlab-probot[bot] avatar Feb 20 '24 07:02 jupyterlab-probot[bot]

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly. welcome You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Feb 20 '24 07:02 welcome[bot]

@krassowski do you know how can I check the detail of those UI integration test failure? those regression failure looks irrelevant and I can see similar issue happens frequently in other PR

linlol avatar Feb 20 '24 11:02 linlol

Yes, they look unrelated, I restarted them.

krassowski avatar Feb 20 '24 11:02 krassowski

Yes, they look unrelated, I restarted them.

Thanks @krassowski for restarting it, may I know are those UI regression failure regular as I can see a few other pull requests with similar failures.

Also, (sorry that I am new to the development of Jupyter itself) honestly I don't know how to have a quick test, is there any approach to build Jupyter and link the JS target to asset like what we did in lab extension development

well, if I understand correctly, follow https://jupyterlab.readthedocs.io/en/latest/developer/contributing.html#installing-jupyterlab shall be good enough... please ignore

linlol avatar Feb 20 '24 12:02 linlol

looks like one test passed after retry and the other still failing, can someone help re-trigger the failed one

Feel sorry that it is a bit difficult to build Jupyter from source code in local development environment, can anyone help make a quick test? (such as grant node_modules folder a JuliaIcon)

linlol avatar Feb 20 '24 12:02 linlol

Hello @krassowski, @JasonWeill. Sorry that I was AFK for a few personal issue.

Looks like my change works

My sample change:

import {juliaIcon} from '@jupyterlab/ui-components';
    app.docRegistry.addFileType({
      name: 'node_module',
      contentType: 'directory',
      icon: juliaIcon,
      pattern: '^node_modules$'
    })

As you can see below, looks like icon of node_modules is changed to JuliaIcon image

Since looks like it does not break any specific ut, let's try to fix the pipeline and merge it. or shall we include any additional unit test to handle this logic?

linlol avatar Mar 04 '24 10:03 linlol

test keeps failing with words like pluggy._manager.PluginValidationError: Plugin 'check-links' for hook 'pytest_collect_file' hookimpl definition: pytest_collect_file(path: 'Any', parent: 'pytest.Collector') -> 'CheckLinks | None' Argument(s) {'path'} are declared in the hookimpl but can not be found in the hookspec

Is there something broken by my change?

linlol avatar Mar 04 '24 10:03 linlol

@linlol this appears a recent change in a dependency which started showing up on CI today. We are investigating in https://github.com/jupyterlab/jupyterlab/issues/15908

krassowski avatar Mar 04 '24 11:03 krassowski

@linlol this appears a recent change in a dependency which started showing up on CI today. We are investigating in #15908

Thanks @krassowski! would merge main after issue resolved

linlol avatar Mar 04 '24 12:03 linlol

somehow I got this error after merged master

is this something like version auto-bump? @krassowski

Made integrity changes! Please commit the changes by running: git commit -a -m "Package integrity updates" 4.1.3 4.1.3 Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.11.8/x64/bin/jupyter-releaser", line 8, in sys.exit(main()) ^^^^^^ File "/opt/hostedtoolcache/Python/3.11.8/x64/lib/python3.11/site-packages/click/core.py", line 1157, in call return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/hostedtoolcache/Python/3.11.8/x64/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/cli.py", line 121, in invoke super().invoke(ctx) File "/opt/hostedtoolcache/Python/3.11.8/x64/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/hostedtoolcache/Python/3.11.8/x64/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/hostedtoolcache/Python/3.11.8/x64/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/cli.py", line 382, in bump_version lib.bump_version(version_spec, version_cmd, changelog_path, tag_format) File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/lib.py", line 43, in bump_version raise ValueError(msg) ValueError: Tag v4.1.3 already exists! To delete run: git push --delete origin {tag_name} Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/actions/prep_release.py", line 25, in run_action("jupyter-releaser bump-version") File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/actions/common.py", line 25, in run_action _run(target, *args, **kwargs) File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/util.py", line 94, in run raise e File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/util.py", line 86, in run process = tee(cmd, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/home/runner/work/_actions/jupyter-server/jupyter_releaser/v2/jupyter_releaser/tee.py", line 159, in run raise subprocess.CalledProcessError( subprocess.CalledProcessError: Command 'jupyter-releaser bump-version' returned non-zero exit status 1.

linlol avatar Mar 05 '24 03:03 linlol

@linlol just an unlucky timing - the CI got confused as it started before 4.1.3 got released before it was done it was already released; I restarted the test it should pass now.

krassowski avatar Mar 05 '24 10:03 krassowski

@linlol just an unlucky timing - the CI got confused as it started before 4.1.3 got released before it was done it was already released; I restarted the test it should pass now.

@krassowski lol it happens.

btw, is it correct that if UI integration failed, just retry it? I can see sometimes it failed and sometimes it works

linlol avatar Mar 05 '24 12:03 linlol

Ok, I see what is happening, we need to bump main to 4.2.0alpha0. I am working on it right now

krassowski avatar Mar 05 '24 12:03 krassowski

hi @krassowski can you retrigger it again? looks like during check-link, github raises a series of 429 too many request, I guess it is due to many similar check-link checks running at the same moment? Is it correct that we can fix it via retry

Also we can notice UI regression failure, I guess it is expected, please correct me if I am wrong

regards

linlol avatar Mar 05 '24 14:03 linlol

@krassowski similar 429 for github request for check link failure,

and do you know what does this mean

image

how can I check which test failed here?

linlol avatar Mar 06 '24 08:03 linlol

That job timed out (it has a timeout of 30 minutes, it is not clear why it got stalled but could be a runner issue) - I restarted it.

krassowski avatar Mar 06 '24 09:03 krassowski

@krassowski thanks a lot! btw any suggestion for check-link failure? Looks like it failed 3 or 4 times in a row with a series of github 429 resp, shall we make any change or just retry

linlol avatar Mar 06 '24 10:03 linlol

@krassowski thanks a lot! btw any suggestion for check-link failure? Looks like it failed 3 or 4 times in a row with a series of github 429 resp, shall we make any change or just retry

nws, let's wait for check-links got fixed first

linlol avatar Mar 06 '24 13:03 linlol

@krassowski Hi, it finally passed all checks, could you help check if it is ok to merge it?

linlol avatar Mar 07 '24 17:03 linlol

Thanks! I think we still should add a test to ensure that this does not regress in the future when someone will be optimizing this function. The test should go in:

https://github.com/jupyterlab/jupyterlab/blob/b6253d94454818b3feefbbe7a095b0da3286cfe9/packages/docregistry/test/registry.spec.ts#L682-L736

krassowski avatar Mar 07 '24 20:03 krassowski

Thanks! I think we still should add a test to ensure that this does not regress in the future when someone will be optimizing this function. The test should go in:

https://github.com/jupyterlab/jupyterlab/blob/b6253d94454818b3feefbbe7a095b0da3286cfe9/packages/docregistry/test/registry.spec.ts#L682-L736

@krassowski sure, I would handle the ut this weekend. Btw, is it correct that no UI regression requested

linlol avatar Mar 08 '24 02:03 linlol

hello @krassowski, added unit test for notebook/directory's customised FileType support and all Linux JS Tests passed.

Since the only 2 failing test (UI regression) are quite common and those test passed previously, can we merge without all success?

Anyway let me merge main to re-trigger. (This time UI test passed but checklink failed again lol)

linlol avatar Mar 09 '24 08:03 linlol

hello @krassowski, thanks for pointing out the typo, those typos shall be resolved.

Feel free to merge it anytime

linlol avatar Mar 11 '24 16:03 linlol

Cheers @krassowski for the heads up. Will look into it!!

mahendrapaipuri avatar Mar 12 '24 09:03 mahendrapaipuri

thanks everyone

btw @krassowski , sorry that just curious, do we know the root cause of UI regression failure? Looks like it failed 3 times in a row

linlol avatar Mar 12 '24 09:03 linlol

It is a problem with the tests running in parallel and the kernels not being mocked but pooled from the same server which is used to run multiple tests. #15845 might alleviate it a bit.

krassowski avatar Mar 12 '24 11:03 krassowski

Congrats on your first merged pull request in this project! :tada: congrats Thank you for contributing, we are very proud of you! :heart:

welcome[bot] avatar Mar 12 '24 12:03 welcome[bot]

Thanks @krassowski for your help. As a seven-year jupyter user, it's my great honour to contribute it

linlol avatar Mar 12 '24 13:03 linlol