File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,9 @@ jobs:
106
106
- script : ${{ platform.activate }} && jupyter labextension list
107
107
displayName : list labextensions after build
108
108
109
+ - script : ${{ platform.activate }} && python scripts/jedi_cache.py
110
+ displayName : warm up jedi cache
111
+
109
112
- script : ${{ platform.activate }} && python scripts/atest.py
110
113
displayName : run browser tests
111
114
Original file line number Diff line number Diff line change
1
+ """ utility script to warm up/validate the jedi cache
2
+ """
3
+ import sys
4
+ import time
5
+
6
+ import IPython
7
+ import jedi
8
+ import jupyterlab
9
+
10
+ SOURCE_TEMPLATE = """
11
+ import {module}
12
+ {module}."""
13
+
14
+ MODULES_TO_CACHE = [
15
+ "sys" ,
16
+ "itertools" ,
17
+ "IPython" ,
18
+ "statistics" ,
19
+ "os" ,
20
+ "time" ,
21
+ * sys .modules ,
22
+ ]
23
+
24
+
25
+ def warm_up_one (module ):
26
+ start = time .time ()
27
+ script = jedi .Script (SOURCE_TEMPLATE .format (module = module ))
28
+ completions = len (script .complete (3 , len ("{}." .format (module ))))
29
+ end = time .time ()
30
+ print (module , completions , end - start )
31
+
32
+
33
+ if __name__ == "__main__" :
34
+ print (IPython .__version__ )
35
+ print (jupyterlab .__version__ )
36
+ start = time .time ()
37
+ modules = sorted (set (sys .argv [1 :] or MODULES_TO_CACHE ))
38
+ [warm_up_one (module ) for module in modules ]
39
+ end = time .time ()
40
+ print ("------------------" )
41
+ print (len (modules ), "modules" , end - start )
You can’t perform that action at this time.
0 commit comments