Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codota/jupyter-tabnine
Autocompletion with Deep Learning on Jupyter Notebook
https://github.com/codota/jupyter-tabnine
Last synced: 1 day ago
JSON representation
Autocompletion with Deep Learning on Jupyter Notebook
- Host: GitHub
- URL: https://github.com/codota/jupyter-tabnine
- Owner: codota
- License: mit
- Created: 2019-09-07T00:30:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-05T13:08:34.000Z (about 2 years ago)
- Last Synced: 2025-02-12T20:04:55.003Z (9 days ago)
- Language: JavaScript
- Homepage:
- Size: 5.95 MB
- Stars: 794
- Watchers: 17
- Forks: 119
- Open Issues: 47
-
Metadata Files:
- Readme: README.ch.md
- License: LICENSE
Awesome Lists containing this project
README
# Jupyter Notebook的TabNine自动补全插件
*Read this in other languages: [English](README.md), [中文](README.ch.md)*
Jupyter Notebook上基于TabNine的自动补全插件,实现基于深度学习的代码自动补全功能。
其他TabNine插件的实现版本通过在client端启动一个TabNine子进程,并通过管道读写来和TabNine子进程通信。这在Jupyter Notebook上是没法直接实现的,
因为Jupyter Notebook客户端插件不支持安装第三方库,原有的库又不支持启动子进程。本项目通过分别实现一个Jupyter Notebook插件和一个Jupyter Server插件来解决这个问题。客户端和服务器通过HTTP来通信。
基于`JavaScript`的客户端插件根据文件内容构造请求数据,并向Server插件发送请求。基于`Python`的server插件在初始化时启动一个子进程来执行`TabNine`二进制文件,
在收到客户端请求后,将请求通过管道发送给`TabNine`并将TabNine的返回结果发送给客户端。客户端收到结果后解析生成HTML组件并响应键盘事件。## 安装
整个安装步骤分为:安装python包、安装客户端插件和`enable`客户端、服务器插件,所有安装步骤都可以通过`pip`和`jupyter`命令完成。### 1. 安装python包(以下任选其一)
* 从github repo 安装: `pip3 install https://github.com/wenmin-wu/jupyter-tabnine/archive/master.zip [--user][--upgrade]`
* 或者 从`pypi` 安装: `pip3 install jupyter-tabnine [--user][--upgrade]`
* 或者 从源码安装:
```Bash
git clone https://github.com/wenmin-wu/jupyter-tabnine.git
python3 setup.py install
```
### 2. 安装Notebook插件
`jupyter nbextension install --py jupyter_tabnine [--user|--sys-prefix|--system]`### 3. enable Notebook 和 Server 插件
```Bash
jupyter nbextension enable --py jupyter_tabnine [--user|--sys-prefix|--system]
jupyter serverextension enable --py jupyter_tabnine [--user|--sys-prefix|--system]
```---
如果你的Jupyter版本在4.2以前,因为`--py`在4.2版本以前的jupyter上没法用,所以步骤1以后操作比较tricky。你需要先找到`jupyter_tabnine`的安装路径,
然后手动安装。安装路径可以通过下面的命令找到:
```Python
python -c "import os.path as p; from jupyter_tabnine import __file__ as f, _jupyter_nbextension_paths as n; print(p.normpath(p.join(p.dirname(f), n()[0]['src'])))"
```
然后执行:
```Bash
jupyter nbextension install
jupyter nbextension enable jupyter_tabnine/main
jupyter serverextension enable
```
`` 是第一个`python`命令的输出结果。## 使用说明
在安装完成后,该插件自动处于激活状态,任何字母、操作符、数字键入都会trigger自动补全。* 有时你可能想临时查看Jupyter原来的补全结果,可以按`Shift` + `空格`

* 如果你想关掉TabNine自动补全,既可以在Notebook nbextension 的页面 disable Jupyter TabNine。也可以点击 `Help` 在弹框中找到 Jupyter TabNine把它点掉。
* 远程补全服务器也是支持的。如果你想部署个Server来处理客户端插件请求,或者你们公司在`Kubernetes`上部署一个Server Cluter请看下面章节了解如何部署自动补全Server。## 开源许可证
[MIT License](LICENSE)
## 部署自动补全Server (可选)
很快添加
## Star 趋势
[](https://starchart.cc/wenmin-wu/jupyter-tabnine)