- Prevent multiple executions of the same source block as the source block is being run.
- Add a new customization
jupyter-org-queue-requestswhich, when non-nil, does client-side queuing of source block execute requests and aborts any queued requests when one that has been sent raises an error. - In Org, add an overlay to the source block regions as the source
blocks are being executed. Block users from attempting to edit the
source block while it is being edited, similar to how source blocks
can’t be edited when an
org-srcedit buffer is editing its contents.
- The results of executing named Jupyter source blocks can now be
referenced by other source blocks. In other words, referencing a
Jupyter block in the context of noweb expansion, using
org-sbe, or as the value of a source block variable works now. - Added the customizable variable
jupyter-org-auto-connectwhich determines if a session should automatically be connected to upon the first insertion into a source block’s region. - The Jupyter executable used by underlying calls to
jupyter-commandmay now be set using the variablejupyter-executable. - Virtual environments are supported. If the
VIRTUAL_ENVenvironment variable is set, then the available kernels to launch will be those under the virtual environment assuming yourexec-pathis set correctly to contain the Jupyter executable under the virtual environment. See for example https://github.com/jorgenschaefer/pyvenv. - Added
org-babel-jupyter-language-aliaseswhich allows you to change the name of the Org source block for a particular kernel language. Usually the name of the source block is jupyter-LANG where LANG is the name of the kernel language. This variable allows you to specify something else for LANG. - Added the
jupyter-use-zmqvariable which determines whether or notzmqbased connections are available for use. If this variable isnilthen only server based connections can be used and in some instances a default notebook server is started to manage those connections, e.g. when callingjupyter-run-repl.
- Additional bug fixes.
- Fixed a regression that appears when executing an
org-modesource block of a previously created session. A new connection to the session was being created before execution instead of using the old connection. See #240. - Fixed regression due to uppercase characters in kernel language
names, e.g. R.
emacs-jupyterwould not work at all with language specific features.
- Fix recursive loading error caused by
jupyter-tramp.elautoloads. - Consider kernelspecs with spaces and uppercase characters in the kernel’s language name.
- In
org-mode, fixed a bug where inline results where being displayed differently from what they would have been when the results are not inline. - When
jupyter-repl-echo-eval-pis non-nil, ensure that any cell code not sent to a kernel yet is preserved. - In
org-mode, fix a bug where if the:sessionheader argument of Jupyter source blocks is a relative file name with a.jsonsuffix anddefault-directoryis a remote directory, a file on the local machine would be read. - Use
org-babel-jupyter-async-inline-results-pending-indicatoras a placeholder when evaluating asynchronous inline source blocks inorg-mode. - Integrate better with packages like
polymodewhen evaluating source blocks inorg-modeby considering indirect buffers. Thanks to@dvzubarevfor the solution. - Fixed usage of source block parameters when evaluating source blocks
using
#+CALLinorg-mode. There are many sources of source block parameters thatorg-modemerges to produce the final set of parameters passed toorg-babel-execute:jupyter, previously that function would just re-compute source block parameters. Now it uses the parameters it was given, seeorg-babel-jupyter-current-src-block-params. - Add support for displaying evaluation results in the current buffer using
overlays. See
jupyter-eval-use-overlaysand the relevant README sections. - Fix
jupyter-repl-restart-kernelto restart a kernel using a kernel manager when one is available. Previously, restarting a kernel using that function wouldn’t work properly if the kernel was from a notebook server. - Increase default timeout until a kernel is considered dead to 30 seconds when
communicating directly with a kernel. More specifically, if a response from a
kernel is not received after three consecutive 10 s periods on the heartbeat
channel, the kernel is considered dead. Previously the timeout was five 1 s
periods. This should fix
Kernel not aliveerrors when using the REPL if the kernel being communicated with was on a slow connection. - Ensure that a non-default value of
url-cookie-fileis handled properly in the notebook support. - In
org-modehandle ANSI control codes in stream output. - In
org-modefix a regression where source block results were not being associated with#+CALLOrg elements. - Add support for the Jupyter Notebook REST API. See the relevant sections in the README.
- Add the commands
jupyter-org-(next|previous)-busy-src-blockwhich will jump to the next or previous busy source block in anorg-modebuffer. Bound toNandPin theHydraprovided inorg-mode(C-c h). - Add customizable variable
jupyter-org-adjust-image-sizeto avoid stretching images whenorg-image-actual-widthis set so that it falls back to a default width for an inline image. - Fix a message buffering issue when sending multiple requests to a kernel in
quick succession, e.g. when calling
org-babel-execute-subtreeinorg-modewhen all Jupyter source blocks in the subtree are evaluated asynchronously. - In
jupyter-org-insert-src-block(1) adjust whitespace so that there is at least one blank line before and following an inserted source block (2) do not insert a new source block between a source block and its results, always insert the new block after a source block’s results (3) do not move past an inlinetask, normally the current paragraph or element underpointis moved past before inserting a new source block. - Fix issues with undo in the REPL when trying to undo after inserting a newline. See #139.
- In
org-mode, detect Org formatted table strings when a kernel returns atext/orgmimetype. This avoids wrapping the table in a drawer. - If a file is opened via
emacsclient, attempt to associate the opened buffer with a REPL client. This is useful, e.g. when using thejulialanguage’seditfunction and theEDITORenvironment variable is set toemacsclient. Seejupyter-server-mode-set-clientfor more details. - In
org-mode, when inserting the results of an asynchronously evaluated src-block, indent the results to match the surrounding indentation level. - In
org-mode, fix an issue when a src-block is nested within a list that would cause the entire list to be erased when asynchronously evaluating the src-block. - Add new customizable variable
jupyter-repl-echo-eval-pthat causes the REPL to behave similarly to comint or ESS when evaluating code. Specifically, it causes any code that is sent to the underlying kernel to also be displayed as a REPL input cell. The previous behavior would only display the sent code as an input cell if it was explicitly typed in at the REPL. - Add the new command
jupyter-repl-clear-cellsto clear all of the current input and output cells in a REPL buffer. Bound toC-c C-oby default in the REPL. - Fix an issue where timeouts started using
with-timeoutwould timeout when the kernel requests input from the user. The timeouts are now suspended in such cases. - In
jupyter-R.elhandle theisolatedmetadata property of HTML results by opening up an external browser to display the result. - Allow
:sessionto be a remote file name fororg-modesource blocks. When:sessionis a remote file name that doesn’t end in.json, e.g./ssh:ec2:jl, a new kernel is started on the remote host using thejupyter kernelcommand on that host. The local file name part serves to distinguish different sessions on the remote host. - Add the new commands
jupyter-repl-history-previous-matchingandjupyter-repl-history-next-matching, bound toC-c M-randC-c M-sin the REPL. - In
jupyter-with-display-buffer,letbindjupyter-current-client. This fixes an issue where kernel language specific methods were not overriding the defaults when attempting to display the contents ofdisplay-datamessages received from a kernel. - Fix a regression in
jupyter-available-kernelspecswhen getting the kernelspecs on remote hosts. - Handle empty result blocks when stripping ANSI escape sequences during export
in
org-babel-jupyter-strip-ansi-escapes. - Call
downcaseon the language name when adding toorg-src-lang-modes. This fixes an issue with theC++kernel where the corresponding mode isc++-mode.
- Support Windows
- In
org-mode, support a header argument:pandoc t. Whenever this header argument is provided, certain kinds of code block results are translated intoorg-modesyntax using apandocprocess, if available. See the variablejupyter-org-pandoc-convertablefor the kinds of results which can be converted in this way. - Add initial support for C++.
- Add a new customizable variable
jupyter-repl-allow-RET-when-busywhich allowsRETto insert a newline in a REPL cell whenever the kernel of the REPL is busy. Normally this isn’t allowed since, when a kernel is busy, it doesn’t respond to messages such as the:is-complete-requestwhich is used to determine when the code should be sent to the kernel or a newline should be inserted wheneverRETis pressed. - Add initial support for R. Thanks to
jackkamm. - In
jupyter-eval-stringalso handle:display-datamessages. - Add a new
jupyter-comm-layerclass which generalizes how ajupyter-kernel-clientcommunicates with a kernel. Previously there was only one method of communication with a kernel, via a subprocess which communicates to the kernel using ZMQ sockets. In order to support other kinds of communication, e.g. using websockets, thejupyter-comm-layergeneralizes the method of communication so that a client need not know how communication occurs. - Add
jupyter-org-execute-subtree(C-M-<return>) to thejupyter-orghydra. Also, various improvements to the source block insertion functions such as how they handle whitespace and determine the language of the source block to insert. - Properly cleanup connection files when restarting a kernel.
- Fontify ANSI coded regions in example blocks and fixed width elements in
org-mode. This feature is activated whenjupyter-org-interaction-modeand currently applies to all example blocks and fixed width elements. This is useful for kernels that apply ANSI color codes to source block results such as IJulia.- Note the ANSI codes will be removed from the elements during export so that they don’t appear in the final exported document.
- In
org-modewhenpointis on a Jupyter source block inside an invisible region, e.g. when itpointlies inside a folded subtree, ignore any special keybindings for the source block. - Consider the
/docker:TRAMP method provided by https://github.com/emacs-pe/docker-tramp.el. See (magit-rev 4ef27c2) for more details. - Change the default completion context to only consider the deepest nested parenthetical level. Previously all levels were considered, but this is not a good default when interacting with LISP like kernels such as Clojupyter.
- In
org-mode, when evaluating Jupyter source blocks during export, ensure that all source blocks are evaluated synchronously even when:async yesis specified. - When using
jupyter-eval-line-or-regionand friends, don’t display a message in the*Messages*buffer if a traceback will be shown. - Be consistent with the use of the
:fileheader argument when:async nois specified vs:async yes. In particular, the:fileheader argument means to use the path specified as the name of any image file generated by the source block inemacs-jupyter. For regularorg-modesource blocks, it means to write the results of the source block to file. See #40 and #59. - Fix off by one line issue when
jupyter-org-toggle-latexis non-nil. - Don’t wrap the source code of an IJulia source block in a
letblock when using the:dirheader argument inorg-modesource blocks.
- Fix an issue where loading
jupyter-org-client.elwould trigger a recursive require oforg. - Don’t fail if a short result has
%characters in the defaultjupyter-eval-short-result-display-function. - Port scimax’s source block helper functions. Thanks to
UndeadKernelfor the work he put into this. See #45. - Fix an issue where a kernel would be stuck in the busy state waiting for
input from the user when calling
jupyter-eval-line-or-stringand friends. The:input-requesthandler was being inhibited in these cases. - When evaluating Julia code blocks with the
:dirheader argument, fix an issue where top-level expressions likeusing Plotswouldn’t work see #57. - Don’t use proportional fonts when rendering HTML. See #52.
- Fix whitespace issues when wrapping
org-modesource block results in aRESULTSdrawer. - Increase
jupyter-default-timeoutto 2.5 seconds. See #43. - Fix issues with the REPL restart process. See #50.
- Refactor REPL restart to avoid relying on a
status: startingmessage to be received. - Actually restart the kernel process when using a kernel manager.
- In
jupyter-repl-restart-kernelinhibit message handlers from running when sending a shutdown request.
- Refactor REPL restart to avoid relying on a
- Add the functions
org-babel-jupyter-override-src-blockandorg-babel-jupyter-restore-src-blockto provide a way of overriding normalorg-modesource block languages to use the Jupyter source block framework. For example, by evaluating(org-babel-jupyter-override-src-block "python")allpythonsource blocks will actually bejupyter-pythonsource blocks. - Add the customizable variable
jupyter-pop-up-framewhich controls if a frame or a window is popped up when evaluating code usingjupyter-eval-line-or-region(bound toC-c C-cwhenjupyter-repl-interaction-modeis enabled) - In
jupyter-repl-after-change, maintain the text properties at the beginning of a REPL input cell when text is deleted at the beginning of a cell. See #38. - In
jupyter-repl-font-lock-fontify-regionandjupyter-repl-syntax-propertize-functionnarrow to the REPL input cell before doing any work since the kernel language mode’s fontification functions do not know about REPL input/output boundaries. - In
jupyter-repl-do-after-change, widen the buffer before doing any work to take into account changes that narrow to fields. In such cases functions likejupyter-repl-cell-code-beginning-positionwill not work right since they look at positions before thecell-codefield. See #38. - Handle the overflow of the prompt margin in the REPL by increasing the margin
width and re-calculating all the prompts in the buffer when the length of the
prompt string exceeds the width of the margin. See #39.
- Also, for the Julia kernel, don’t replace the REPL prompt but add it as part of the REPL cell.
- Add support for suppressing
org-modetable output from source blocks by specifying:results scalar. - Add a new
org-modesource block header argument:displaywhich allows a user to control which mimetype is displayed. See #17. - Fix an issue with undo in the REPL where the addition of continuation prompts for multi-line input would add extra undo information that would interfere with undo.
- Update
org-modesource block result insertion to consider changes in howfixed-widthandexample-blockelements and are printed to the buffer inorg-mode>= 9.2. Also start testing against the latest version oforg-modein Travis. - Handle the case of an empty
RESULTSdrawer during source block result insertion in the:async yescase. - Add a
fileslot to ajupyter-org-request. Also, internally remove the:fileheader argument from anorg-modesource block’s parameters during block evaluation so thatorg-modedoesn’t specially handle the:fileargument as it interferes with insertion of results when:async yesis specified. Note this is currently only done for the:async yescase. - In
jupyter-repl-syntax-propertize-function, in addition to handling parenthesis syntax, handle string syntax. This is so that any string syntax characters in the output are not considered strings in the kernel’s language. - In
jupyter--display-eval-resultprefer Markdown if it is available.
- In
jupyter-handle-input-request, be more secure when reading passwords by usingclear-stringafter sending the message and avoiding printing passwords to the*Messages*buffer whenjupyter--debugis non-nil. - In
jupyter-insert-latexremove modification-hooks from the image overlays so that the images are not removed from the buffer when changing the text properties of the underlying text. - In
jupyter-read-expressionshow the kernel language when prompting in the minibuffer. - In
jupyter-repl-kill-buffer-query-functionalso ask to kill the kernel. - In
jupyter-with-display-bufferproperly advancejupyter-display-buffer-markerwhen contents are added to the buffer so that future inserts will insert at the end of the buffer. Also handle anilRESET argument. - Keep
:as the start of a completion prefix for the Julia kernel to allow completing dictionary keys. - Consider the state of the ioloop in the
jupyter-channel-alive-pmethod of ajupyter-kernel-client. In particular, ensure the method returns nil, when the ioloop isn’t alive. - Change the default completion context, the context returned by
jupyter-code-contextwith an argument ofcompletion, to return all nested levels of parenthesis. - In
org-babel-jupyter-setup-export, use the kernelspecs on the system to add toorg-latex-minted-langs. - Add new hook variables
jupyter-repl-cell-{pre|post}-send-hookthat are called before and after sending the contents of a REPL cell to the kernel. - In
jupyter-repl-finalize-cellensure that only the last cell in the REPL buffer is finalized by going topoint-maxbefore accessing a cell’s properties. This avoids issues with modifying the properties of previously finalized cells. - Integrate more with
font-lockandsyntax-ppssin the REPL by (1) adding a customsyntax-propertize-function(2) handle REPL mode characters in the Julia kernel and (3) use the kernel language syntax table when callingfont-lockfunctions.
- Fix a bug in
jupyter-connect-replwhich would cause the REPL to think that the kernel wasn’t alive. The issue was that the heartbeat channel was not exchanging messages with the kernel and the heartbeat channel is relied on to check for the liveness of a kernel connected to usingjupyter-connect-repl. See #29. - When using
jupyter-eval-string(C-c M-:), properly use the client local variable,jupyter-eval-expression-history, as the minibuffer history. jupyter-repl-restart-kernelnow prompts for a REPL client to restart if thejupyter-current-clientvariable is not set in the current buffer. See #28.- Fix bug when a kernel does not respond to a shutdown request. Previously in such cases, the kernel process would not be forcibly killed and would stay alive.
- Add
org-babel-jupyter-setup-exportto integrate the exporting process withemacs-jupyter. This function is added toorg-export-before-processing-hookand currently only ensures that, when exporting to LaTeX and the minted package is being used, thejupyter-LANGsource blocks useLANGfor their minted language.
- Remove compatibility with
ob-ipythonby going back to using ajupyter-prefix instead of ajupy-prefix for Jupyter src-block languages. - Re-use windows displaying
jupyterspecific buffers instead of popping up new windows whenever possible, e.g. when displaying a traceback or output caused by evaluating code. Seejupyter-display-current-buffer-reuse-window. - Consider the underlying REPL client of
org-modeJupyter src-blocks as valid clients to associate a source code buffer with usingjupyter-repl-associate-buffer. - Add the customizable variable
jupyter-org-toggle-latexwhich automatically converts latex fragment results oforg-modeJupyter src-blocks into images if non-nil. - Add the customizable variables
jupyter-eval-short-result-max-linesandjupyter-eval-short-result-display-functionwhich control how to display evaluation results having a number of lines less thanjupyter-eval-short-result-max-lines. As an example, you can setjupyter-eval-short-result-display-functiontopopup-tipfrom thepopuppackage to show short results inline after evaluation. - When
:results silentis an argument for anorg-modesrc-block and an error occurs, display a link to jump to the line of the src-block which caused the error along with the error traceback. Note this requires that the underlying kernel language extend thejupyter-org-error-locationmethod. - Fix integration with
insert-for-yankinside a REPL buffer. Previously, yanking text from the kill ring into the REPL buffer would interfere with font-lock and motion functions such asbeginning-of-line. See #14. - Add the minor mode
jupyter-org-interaction-modeenabled in allorg-modebuffers by default. This mode enables completion in Jupyter src-blocks directly from theorg-modebuffer and custom keybindings for each kernel language that are only enabled ifpointis inside a Jupyter src-block. You bind keys to commands usingjupyter-org-define-key. Inspired byscimax. - Support the
:dirheader argument oforg-modesrc-blocks. Since Jupyter src-blocks have a backing REPL session, the:dirargument only ensures that the REPL session is initialized in the specified directory. After the session is initialized, the:dirargument has no effect when evaluating src-blocks with the same underlying session. Now, the directory is changed inside the REPL environment before evaluation of a src-block and reset to the previous directory after evaluation whenever:diris specified as a header argument. Note, this requires that the backing kernel language handles:dirin the changelist argument oforg-babel-jupyter-transform-code. Also inspired byscimax. - Add support for inline Jupyter src-blocks in
org-mode. - For Jupyter src-blocks, delete files of unreachable links from
org-babel-jupyter-resource-directory. When replacing image link results of a src-block, e.g. by re-evaluation of the src-block, delete the corresponding image file if it exists inorg-babel-jupyter-resource-directory. Once again inspired byscimax. - Add the
jupyter-repl-tracebackface. This face is used to fontify the background of a traceback in the REPL buffer to distinguish it from other output. In addition to this face, there is alsojupyter-repl-input-promptandjupyter-repl-output-prompt.