32

I do a lot of stuff over a remote jupyter server. I've been using vscode to run notebooks on those servers because it was the easiest way I could find to develop while using copilot, but it's become rather cumbersome and was hoping for a simpler solution.

Thanks for any help y'all can provide!

aaportel
  • 471
  • 1
  • 3
  • 6

4 Answers4

14

Not an answer, but too long for a comment.

There does not seem to be as of mid 2022 an implementation.

Copilot uses an underlying tool, OpenAI Codex, which has a model called codex-davinci-002, which can do code completion. https://beta.openai.com/docs/models/codex-series-private-beta (it's worth noting that OpenAI also have a model confusingly called text-davinci-002 which converts natural language to code, which is not what we want). It's free but has a beta waiting list. There is a jupyterlab attempt at this called jupyterlab-codex. It may have worked at some point given the search results, eg. https://medium.com/codex/jupyter-notebook-can-do-that-b3185058fe76. So a thing to keep an eye out for is "Jupyter + Codex" in addition to "Jupyter + copilot".

Edit There are several recent GPT3-based tools for code completion in Jupyter Lab, but, as far as I have found they are not as good or even slightly eerie as Copilot. Copilot does have the annoyance that the tab key is for its accepting Copilot suggestion and PyCharm's suggestion and for adding spaces. In Jupyter Lab tab gives a tooltip with a select element, and this seem the tools Tabnine or kite cleanly use this, but will not go beyond variable completion. Say the simple case were you have written def convert_centimetres_to_inches(centimetres:float) -> float:, in Copilot 3-4 correct lines will be suggested with docstrings too, this is not the case in the jupyterlab clones I have tried, which cannot be coerced into suggestion even the 2.6 factor.

Matteo Ferla
  • 2,128
  • 1
  • 16
  • 27
  • 2
    There is an open source implementation for emacs (https://github.com/zerolfx/copilot.el) so it's doable. – Att Righ Dec 19 '22 at 15:11
  • 2
    In GitHub @parththakkar has a great breakdown of Copilot frontend, https://thakkarparth007.github.io/copilot-explorer/ which may be a good starting point for making a Copilot plugin. A notebook ipynb file is just a JSON in a simple schema and jupyterlab extensions frequently requires nodeJS, so I agree it could be doable albeit with a decent amount of coding. However, lawyers are scary, annoying and inexplicably slow, so before venturing into this territory one would need to get a MoU with GitHub lest one get a cease and desist order after writing 20-50,000 lines of code, many of which JS. – Matteo Ferla Dec 20 '22 at 09:55
  • 1
    Hmm, I'd be inclined to just do it, but human experience has altered my risk tolernace. The emacs backend actually uses a nodeJS server for what it's worth - so perhaps some of this code could be reused or one could communicate to this server used by emacs via HTTP. This might reduce the legal liability but not the "shifting sand effect". It might be nice to have a "standard" interface for completion... which this server might represent - one could replace copilot with [one of these https://visualstudiomagazine.com/articles/2021/09/24/github-copilot-alternatives.aspx]. – Att Righ Dec 20 '22 at 11:52
  • The best experience for CoPilot with Jupyter Notebooks I know is really VSCode. It works great for local notebooks, but also allows for remote servers (the annoying part is that you don't open the remote notebook but rather connect a local notebook to a remote kernel). https://code.visualstudio.com/docs/datascience/jupyter-notebooks#_connect-to-a-remote-jupyter-server – Christian Heine Apr 24 '23 at 03:57
  • You can us starcoder and open source alternative to copilot – Att Righ May 05 '23 at 13:07
1

There is now a way to do something similar. With the new edge the bing tool can read the juypter notebook and you can ask it to generate you code

Trevor
  • 35
  • 4
  • 2
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 11 '23 at 01:06
0

Jupyter note book can also run on PyCharm or DataShell, with which copilot is compatible.

Other code completion AI may also worth considering. Tabnine, which can run directly on the browser for jupyter lab or notebook, is available for free or as a more powerful paid version.

YuhaoHanHarry
  • 61
  • 1
  • 6
0

You can use this : https://github.com/bigcode-project/jupytercoder
It's a solution to have AI code completion with starcoder (supported by huggingface).
You have to create a free API token from hugging face personal account and build chrome extension from the github repository (switch to developer mode in chrome extension menu).
To have a code completion, press ctrl+space and then press ctrl to accept the proposition.
It works in jupyter notebook (only jupyter notebook, not lab).

Yunnosch
  • 26,130
  • 9
  • 42
  • 54
Bertrand
  • 89
  • 10
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 30 '23 at 08:00
  • 2
    I helped you with polishing a little (me not being a native speaker either). But do not bother to apologise for your English, as long as you do your best (and already quite decent). Have fun. Thanks for taking the feedback. – Yunnosch May 30 '23 at 08:26