Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

jupyter_ext_dev: pull request for jupyter extension 2.x and 3.x recap… #4167

Merged
merged 1 commit into from
Sep 16, 2021

Conversation

Johnsonms
Copy link
Contributor

setup.py Outdated
@@ -58,13 +62,25 @@
import shutil
import sys

import jupyterlab
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add try-catch for this import. The script should not crash when building machine has not installed jupyter.
And I personally suggest put this and jupyter_lab_version = ... into a function get_jupyter_lab_version().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed, In this way, the building machine without jupyterlab installed will report error and the package related jupyter lab extension will not built, but continue to build other package

setup_ts.py Outdated
@@ -22,10 +22,11 @@
import traceback
from zipfile import ZipFile

import jupyterlab
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as setup.py.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed

setup_ts.py Outdated
if Path('ts/jupyter_extension/dist').exists():
if jupyter_lab_version == '2':
_symlink('ts/jupyter_extension/build', 'nni_node/jupyter-extension')
_symlink(sys.exec_prefix+'/share/jupyter/lab/extensions', 'nni_node/jupyter-extension/extensions')
Copy link
Contributor

Choose a reason for hiding this comment

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

Using + to glue two paths is not recommended.


def restore_package():
if jupyter_lab_version == '2':
package_json = json.load(open('ts/jupyter_extension/.package_default.json'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete .package_default.json or put it into gitignore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, make sense

setup.py Outdated
if jupyter_lab_version.split('.')[0] != environ_version.split('.')[0]:
sys.exit(f'ERROR: To build a jupyter lab extension, run "JUPYTER_LAB_VERSION={jupyter_lab_version}", current: {environ_version} ')
elif jupyter_lab_version.split('.')[0] != '3':
sys.exit(f'ERROR: To build a jupyter lab extension, run "JUPYTER_LAB_VERSION={jupyter_lab_version}" first for nondefault version(3.x)')
Copy link
Contributor

Choose a reason for hiding this comment

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

Bad indent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed it

@acured acured merged commit c5c3db2 into microsoft:master Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants