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

Only load enabled extension packages #1180

Merged
merged 1 commit into from
Jan 17, 2023

Conversation

minrk
Copy link
Contributor

@minrk minrk commented Jan 16, 2023

  • only load metadata if a given extension package is enabled (closes Jupyter Server imports extensions even when they are disabled, slowing down startup #1177)
  • module will be None, extension points will be empty if disabled. Version will be empty, though we could look it up most of the time via importlib_metadata (module name != package name, etc.). I'm not sure how relevant the version number is for disabled extensions, though.
  • unify use of traitlets, removing redundant use of public properties exposing identical private attributes, when public attributes will do (no change to api).

@yuvipanda
Copy link
Contributor

Thanks a lot for working on this, @minrk!

@blink1073
Copy link
Contributor

Not sure why CI didn't run, kicking.

@blink1073 blink1073 closed this Jan 17, 2023
@blink1073 blink1073 reopened this Jan 17, 2023
Copy link
Contributor

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

Thanks!

@blink1073 blink1073 changed the title only load enabled extension packages Only load enabled extension packages Jan 17, 2023
@blink1073 blink1073 enabled auto-merge (squash) January 17, 2023 13:50
@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Base: 80.09% // Head: 80.14% // Increases project coverage by +0.05% 🎉

Coverage data is based on head (bdd8dbc) compared to base (4e9d105).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1180      +/-   ##
==========================================
+ Coverage   80.09%   80.14%   +0.05%     
==========================================
  Files          68       68              
  Lines        8153     8149       -4     
  Branches     1606     1604       -2     
==========================================
+ Hits         6530     6531       +1     
+ Misses       1196     1191       -5     
  Partials      427      427              
Impacted Files Coverage Δ
jupyter_server/extension/manager.py 93.17% <100.00%> (+0.82%) ⬆️
jupyter_server/extension/handler.py 67.69% <0.00%> (-1.54%) ⬇️
jupyter_server/gateway/managers.py 83.13% <0.00%> (-0.24%) ⬇️
jupyter_server/serverapp.py 79.92% <0.00%> (+0.08%) ⬆️
jupyter_server/extension/serverextension.py 87.83% <0.00%> (+2.70%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@minrk minrk force-pushed the import-if-enabled branch 2 times, most recently from 2f8cace to d643985 Compare January 17, 2023 14:05
- only load metadata if a given extension package is enabled
- module will be None, extension points will be empty if disabled
- unify use of traitlets, removing redundant use of properties
@xinliupitt
Copy link

xinliupitt commented Feb 1, 2023

I have a question. Is functionality "only load metadata if a given extension package is enabled" by default in this release:
https://github.com/jupyter-server/jupyter_server/releases/tag/v2.2.0

We don't need any flags to enable this functionality, right?

@xinliupitt
Copy link

Another question: if I directly install Jupyterlab by any method here, will it automatically include the latest v2.2.0 jupyter server release?

@minrk minrk deleted the import-if-enabled branch February 1, 2023 10:21
@blink1073
Copy link
Contributor

You do not need any flags to enable this functionality. Yes, if you install JupyterLab 3.5+ then pip/conda/mamba should also install Jupyter Server 2.2, unless the installer decides to use a local cached version. If you run pip list (or conda list) you can check which version got installed. If it is less than Server 2.2, you can run pip install --upgrade jupyter_server or conda install jupyter_server==2.2.

@xinliupitt
Copy link

Thanks a lot! I encountered an issue during installation. That is, I put jupyter_server==2.2 in my requirement file. However, the log shows only some 2.0.0 versions are available

ERROR: Could not find a version that satisfies the requirement jupyter_server==2.2 (from versions: 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.1.0, 0.1.1, 0.2.0, 0.2.1, 0.3.0, 1.0.0rc0, 1.0.0rc1, 1.0.0rc2, 1.0.0rc3, 1.0.0rc4, 1.0.0rc5, 1.0.0rc6, 1.0.0rc7, 1.0.0rc8, 1.0.0rc9, 1.0.0rc10, 1.0.0rc11, 1.0.0rc12, 1.0.0rc13, 1.0.0rc14, 1.0.0rc15, 1.0.0rc16, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.0.9, 1.0.10, 1.0.11, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.7.0a1, 1.7.0a2, 1.7.0, 1.8.0, 1.9.0, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.11.1, 1.11.2, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.2, 1.13.3, 1.13.4, 1.13.5, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.15.5, 1.15.6, 1.16.0, 1.17.0, 1.17.1, 1.18.0, 1.18.1, 1.19.0, 1.19.1, 1.21.0, 1.23.0, 1.23.1, 1.23.2, 1.23.3, 1.23.4, 1.23.5, 2.0.0a0, 2.0.0a1, 2.0.0a2, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0rc3)
ERROR: No matching distribution found for jupyter_server==2.2
Traceback (most recent call last):
  File "/home/kbuilder/miniconda3/bin/conda-build", line 11, in <module>
    sys.exit(main())
  File "/home/kbuilder/miniconda3/lib/python3.7/site-packages/conda_build/cli/main_build.py", line 495, in main
    execute(sys.argv[1:])
  File "/home/kbuilder/miniconda3/lib/python3.7/site-packages/conda_build/cli/main_build.py", line 485, in execute
    cache_dir=args.cache_dir,
  File "/home/kbuilder/miniconda3/lib/python3.7/site-packages/conda_build/api.py", line 189, in build
    variants=variants
  File "/home/kbuilder/miniconda3/lib/python3.7/site-packages/conda_build/build.py", line 3102, in build_tree
    notest=notest,
  File "/home/kbuilder/miniconda3/lib/python3.7/site-packages/conda_build/build.py", line 2210, in build
    cwd=src_dir, stats=build_stats)
  File "/home/kbuilder/miniconda3/lib/python3.7/site-packages/conda_build/utils.py", line 402, in check_call_env
    return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
  File "/home/kbuilder/miniconda3/lib/python3.7/site-packages/conda_build/utils.py", line 382, in _func_defaulting_env_to_os_environ
    raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-o', 'errexit', '/home/kbuilder/miniconda3/conda-bld/dlenv-base_1675280443233/work/conda_build.sh']' returned non-zero exit status 1.

Does this mean 2.2.0 hasn't been released?

@kevin-bates
Copy link
Member

kevin-bates commented Feb 1, 2023

Hi @xinliupitt - the conda-forge PR was merged 7 hours ago (thank @bollwyvl), so it may still be propagating (or however that works).

FWIW, I just now issued:

$ conda install -c conda-forge jupyter_server==2.2.0

and it appears to have installed:

$ conda list jupyter_server
# packages in environment at /opt/miniconda3/envs/elyra-dev:
#
# Name                    Version                   Build  Channel
jupyter_server            2.2.0              pyhd8ed1ab_0    conda-forge

so I suspect you hit that window in which things were still getting "into position".

@xinliupitt
Copy link

Thanks a lot! Finally I find I need JupyterLab 3.5 + Python 3.8 as the dependencies, in order to upgrade to jupyter-server 2.2.0.

@blink1073
Copy link
Contributor

@meeseeksdev please backport to 1.x

@lumberbot-app
Copy link

lumberbot-app bot commented Feb 6, 2023

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout 1.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 3d96cf81b61cfe84dbae46031047d9fc138d3642
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #1180: Only load enabled extension packages'
  1. Push to a named branch:
git push YOURFORK 1.x:auto-backport-of-pr-1180-on-1.x
  1. Create a PR against branch 1.x, I would have named this PR:

"Backport PR #1180 on branch 1.x (Only load enabled extension packages)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

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.

Jupyter Server imports extensions even when they are disabled, slowing down startup
5 participants