Skip to content

Commit a6cd478

Browse files
committed
Warm tab complete.
1 parent 7169150 commit a6cd478

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

docker/client/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,9 @@ COPY jupyter /.jupyter
5555
RUN chown cryo:smurf -R /.jupyter
5656
ENV JUPYTER_CONFIG_DIR=/.jupyter
5757

58+
# IPython startup script to pre-warm tab completion
59+
RUN mkdir -p /.ipython/profile_default/startup
60+
COPY jupyter/ipython_startup.py /.ipython/profile_default/startup/00-warm-completion.py
61+
RUN chown cryo:smurf -R /.ipython
62+
5863
ENTRYPOINT ["start_client.sh"]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import threading
2+
3+
4+
def _warm_completion():
5+
"""Pre-warm jedi's completion cache for SmurfControl."""
6+
try:
7+
import pysmurf.client
8+
obj = pysmurf.client.SmurfControl(offline=True)
9+
dir(obj)
10+
from IPython import get_ipython
11+
ip = get_ipython()
12+
if ip is not None:
13+
ip.complete('obj.get')
14+
except Exception:
15+
pass
16+
17+
18+
threading.Thread(target=_warm_completion, daemon=True).start()

0 commit comments

Comments
 (0)