Skip to content

Conversation

@mahendrapaipuri
Copy link

@mahendrapaipuri mahendrapaipuri commented Apr 8, 2023

EDIT by Erik: for a background of changes, see #389 (comment)

@welcome
Copy link

welcome bot commented Apr 8, 2023

Thanks for submitting your first pull request! You are awesome! 🤗

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! 👋

Welcome to the Jupyter community! 🎉

Copy link
Member

@consideRatio consideRatio left a comment

Choose a reason for hiding this comment

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

Thank you @mahendrapaipuri for helping out resolving this!!! ❤️ 🎉 🌻


I made some comments favoring reducing code complexity by hardcoding a labextension name not expected to change. Besides that, I think this LGTM!


@bollwyvl being a jupyterlab savvy person, does this look good to you?

def _jupyter_labextension_paths():
return [{
"src": "labextension",
"dest": data["name"]
Copy link
Member

Choose a reason for hiding this comment

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

This is not something we should be changing, so I figure we don't need to have logic to import this name.

Suggested change
"dest": data["name"]
"dest": "@jupyterhub/jupyter-server-proxy",

Comment on lines 9 to 13
HERE = Path(__file__).parent.resolve()

with (HERE / "labextension" / "package.json").open() as fid:
data = json.load(fid)

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
HERE = Path(__file__).parent.resolve()
with (HERE / "labextension" / "package.json").open() as fid:
data = json.load(fid)

Comment on lines 1 to 3
import json
from pathlib import Path

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import json
from pathlib import Path

[tool.hatch.build.hooks.jupyter-builder.editable-build-kwargs]
path = "labextension"
build_cmd = "install:extension"
build_cmd = "build"
Copy link
Member

Choose a reason for hiding this comment

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

I'm not 100% confident on the change from install:extension to build, but I see this be done also in another project and Jeremy that made the that change is experienced with these matters.


Do you think we should have force = true as well as they have in that project? I think it relates to forcing rebuild of the labextension if it already exists.

https://github.com/jupyterlab/hatch-jupyter-builder/blob/12ef08143544fb954a4e5dfeb54b61f6e2ad084d/hatch_jupyter_builder/utils.py#L106-L109

But, our contributing docs mentions jlpm watch, which seem to trigger build of this also... Overall I'm not at all confident here, but I've seen this to work and the previous to not work at all.

I feel confident this is an incremental improvement, so I'm okay with a merge.

Copy link
Author

Choose a reason for hiding this comment

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

I have been working on JupyterLab extensions for the past few months and I have noticed that build is used as a standard for editable installs in different extension sources and cookie-cutter examples. But I am happy to get feedback from JupyterLab developers.

I think we can set force = true without any side effect. Yes, jlpm run watch is more convenient way to develop extensions as every change to source code will be compiled in real time.

pyproject.toml Outdated
artifacts = [
"jupyter_server_proxy/labextension",
]

Copy link
Author

Choose a reason for hiding this comment

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

If we are hard coding the extension name, we do not need to distribute the labextension files in the package as we do not need to read package.json file anymore

@consideRatio
Copy link
Member

@mahendrapaipuri this now seems to me like a very clear improvement, I'll go for a merge here now! Thank you!!! ❤️ 🎉 🌻

@consideRatio consideRatio merged commit 230c069 into jupyterhub:main Apr 10, 2023
@welcome
Copy link

welcome bot commented Apr 10, 2023

Congrats on your first merged pull request in this project! 🎉
congrats
Thank you for contributing, we are very proud of you! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editable install is broken

2 participants