Skip to content

Commit 9ee4dc8

Browse files
authored
add comments on the jedi cache script
1 parent 2226696 commit 9ee4dc8

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

scripts/jedi_cache.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,40 @@
11
""" utility script to warm up/validate the jedi cache
2+
what does it do:
3+
- Deletes the jedi cache (usually already empty on CI)
4+
- Imports a bunch of libraries
5+
- Prints out some versions, especially ones that are
6+
at times troublesome
7+
- Forces indexing all of the loaded libraries and their
8+
dependencies
9+
10+
why is this needed:
11+
- Before we had this, a couple of browser tests appeared
12+
"consistently flakier" than they were, as they were
13+
time-bounded by creating the jedi cache.
14+
- This was taking up to a minute to get a single
15+
completion value back
16+
- Further, were this cache to get corrupted (perhaps due to
17+
killing a running test :P) things go very mysteriously bad.
18+
- We need a way for the cache to be right before testing
19+
20+
how does it work:
21+
- When _using_ jedi for the first time, the cache gets
22+
created in `jedi.settings.cache_directory`, usually
23+
somewhere in $HOME.
24+
- As different libriraries are inspected by jedi, they get
25+
added to the cache.
26+
- This is very slow, especially on windows, and cannot
27+
feasibly be cached, today.
28+
- This script accelerates this process, so it can be done
29+
in a controlled manner rather than during some other test
30+
- also, by running it ahead of time, if the jedi dependency
31+
chain is broken in any way, this should help determine
32+
if faster, before trying to build everything
33+
34+
see more:
35+
- https://jedi.readthedocs.io/en/latest/docs/settings.html
36+
- https://github.com/krassowski/jupyterlab-lsp/pull/284
37+
238
"""
339
import os
440
import pathlib

0 commit comments

Comments
 (0)