- Enhancement: Upgrade to nREPL v0.6 - eliminate uncaught stacktrace error
- Introduce modular message handling incl new tests
- Add retrievable version including timestamp, printed at startup (banner)
- Add config file to control features such as log level
- Address (some) reported issues
#83: Hanging after evaluating cell with syntax error
#84: Kernel dies on empty code string
#30: Dead kernel on startup (comm_info_request)
(don't terminate on unknown messages)#69: FileNotFoundException Could not locate... on classpath.
#76: add-javascript broken?
#58: AOT+old tools.reader causing problems using latest ClojureScript
#85: Consider the silent and store_history keys of an execute request
- Improve basic install
- Eliminate shell script in
clojupyter
install artifact (call java directly) - Add clojupyter icons (in Jupyter Lab Launcher, top right corner in Jupyter Notebook)
- Add version numbered icons
- Replace shell scripts with lein functions for basic build operations
clojupyter-install
check-os-support
check-install-dir
update-version-edn
- Add version-specific kernel install directory
- Make default kernel install directory
clojupyter
(instead ofclojure
) - Add
make
targetsupdate-version-edn
install-version
(install plain icon)install-version-tag-icons
(install version-tagged icon, depends onconvert
fromimagemagick
package)
- Eliminate shell script in
- Create updated Docker image for current version
- Update TODO in
README.md
: add tentative near-term roadmap - Clean out obsolete issues on github
- Delete unused branches on github
- Establish numbered releases
- Update example notebooks
- Change code structure towards having an open, extensible architecture (more work is needed to make it
extensible)
-
Introduce handler-based middleware structure similar to nREPL and Ring
-
Enable higher degree of separation of concerns, thus enabling adding features in a modular fashion
-
Introduce layered message handling: Incoming messages pass through a define sequence of middleware handlers with outbound message passing through the same set of handlers in reverse order, yielding a layered message-processing architecture
-
Introduce
handler
,middleware
, andtransport
abstractions similar to those of employed in nREPL, but adapted to fit into the multichannel context of Jupyter (cf.send-stdin
,send-iopub
, andsend-req
inclojupyter.transport
) -
Convert existing functionality to middleware-based structure, messaging-handling is now defined by core message handler (in
clojupyter.middleware
):(def wrap-base-handlers (comp wrap-execute-request wrap-comm-msg wrap-comm-info wrap-comm-open wrap-is-complete-request wrap-complete-request wrap-kernel-info-request wrap-inspect-request wrap-history-request wrap-shutdown-request)) (def wrap-jupyter-messaging (comp wrapout-encode-jupyter-message wrapout-construct-jupyter-message)) (def default-wrapper (comp wrapin-verify-request-bindings wrapin-bind-msgtype wrap-print-messages wrap-jupyter-messaging wrap-busy-idle wrap-base-handlers)) (def default-handler (default-wrapper not-implemented-handler))
The modular structure will make it much easier to add functionality going forward.
-
Reorganize code structure:
src ├── clojupyter │ ├── display.clj │ ├── javascript │ │ └── alpha.clj │ ├── kernel │ │ ├── cljsrv │ │ │ ├── nrepl_comm.clj │ │ │ ├── nrepl_middleware.clj │ │ │ └── nrepl_server.clj │ │ ├── config.clj │ │ ├── core.clj │ │ ├── history.clj │ │ ├── init.clj │ │ ├── jupyter.clj │ │ ├── logo.clj │ │ ├── middleware │ │ │ ├── base.clj │ │ │ ├── comm.clj │ │ │ ├── complete.clj │ │ │ ├── execute.clj │ │ │ ├── history.clj │ │ │ ├── inspect.clj │ │ │ └── log_traffic.clj │ │ ├── middleware.clj │ │ ├── spec.clj │ │ ├── stacktrace.clj │ │ ├── state.clj │ │ ├── transport │ │ │ └── zmq.clj │ │ ├── transport.clj │ │ ├── util.clj │ │ └── version.clj │ ├── misc │ │ ├── display.clj │ │ ├── helper.clj │ │ ├── leiningen.clj │ │ └── mime_convertible.clj │ └── protocol │ └── mime_convertible.clj └── clojupyter.clj 8 directories, 32 files
-
- Add support for configuration file, loaded at startup
- Read from
~/Library/Preferences/clojupyter.edn
on MacOS and~/.config/clojupyter.edn
on Linux (per XDG Base Directory specification) - Move location history file to
~/Library/Caches
on MacOS and~/.local/share
(per XDG Base Directory specification) - Control printing of stacktraces (workaround, base issue addressed by upgrade to nREPL 0.6) in configuration file
- Control log level in configuration file
- Control ZMQ traffic logging in configuration file
- Read from
- Improve tests
- Convert existing tests to work with new structure
- Add tests for middleware providing checks for basic message responses
- Miscellaneous
- Upgrade Jupyter messing protocol to v5.3 (from v5.0) - no apparent impact
- Replace
clj-time
withclojure.java-time
- Rename
idents
in ZMQ messages toenvelope
- Define names for Jupyter message identifiers (in
clojupyter.misc.jupyter
) - Eliminate
zmq-comm
protocol - not needed - Use
:aot
only inuberajr
profile inproject.clj
- Improve code structure / organization
- Use a single atom for all global state. Provide abstraction for manipulating
global state. Eliminate
states
. - Use accessor functions for socket access. Avoids storing sockets in
Zmq_Comm
. Accessor functions forstdin-socket
andiopub-socket
in passed-around mapS
. - Eliminate atoms containing sockets - not necessary since they are used, not updated.
- Remove depencency on
async.core
- not used.
- Use a single atom for all global state. Provide abstraction for manipulating
global state. Eliminate
-
core.clj
- Replace
configure-shell-handler
andconfigure-control-handler
withmake-handler
. Their role is the same, the main difference thatexecution-counter
is incremented on the shell socket. Why not simply use the same handler? - Integrate creation of signer and checker functions.
- Simplify
run-kernel
based on above. - Separate code related to
nrepl-server
and Clojupyter middlerware into separate namespace:clojupyter.misc.nrepl-server
.
- Replace
-
messages.clj
- Considerably simplify
make-shell-handler
andmake-control-handler
: Unify into one. - Use consolidation of global state to turn
handle-execute-request
into regular responding function defined withdefresponse
. - Add
with-debug-logging
- Add accessor functions for socket access.
- Integrate creation of signer and checker.
- Integrate
status-content
andpyin-content
into point-of-use. - Use abstractions to access global state.
- Considerably simplify
-
nrepl_comm.clj
- Refactor giant
defrecord
into smaller functions, no change in logic.
- Refactor giant
-
history.clj
- Move determination of max history length here.
-
nrepl_server.clj
(added)-
nrepl
-related code fromcore.clj
.
-
-
state.clj
- Rename from
states.clj
- add single atom for all of global state. - Add functions to manipulate global state.
- Rename from
-
zmq_comm.clj
- Use accessor functions instead of access-by-socket-name.
-
util.clj
- Add
with-debug-logging
macro. - Add
reformat-form
. Very early experiment with auto-indent / auto-reformat of cells based on Code Prettify / Autopep8. Very primitive / early cell reformatting prototype appears to work (cf../nbextensions/code_prettify/autopep8.yaml
). More work needed (quite a bit), but it looks like there's a fairly straightforward solution.
- Add
-
user.clj
- Added to support experiments with
reformat-form
.
- Added to support experiments with
Changes at revision 2913dc17
relative to Clojupyter master
latest commit per 15 February 2019 (994f680c
):
- Ensure compatibility with Clojure v1.9 and Clojure v1.10
- Enable
nrepl
-based access from interactive development environments such as CIDER/Cursive: Leave:value
unchanged, add:mime-tagged-value
instead - Update dependencies, not least move to
nrepl
v0.5.3 andcider-nrepl
v0.20.0 - Improve code structure / organization
- Use a map for passing largely unchanging values around
- Abstract message content access: Use
message-*
functions - Make functions used only locally
:private
-
core.clj
- Refactor
configure-{shell,control}-handler
to use multi-method instead (respond-to-message
) - Use macro
catching-exceptions
to improve code readability - Refactor
process-heartbeat
away - Shorten arglists using a map instead of individual args
- Add
nrepl-server-addr
to retrievenrepl
server port to enable connection from interactive development environment
- Refactor
-
messages.clj
- Use multi-method
respond-to-message
dispatching on request type to eliminate individually named response functions such asinput-request
,comm-open-reply
,kernel-info-reply
, etc. - Use macro
defresponse
to further reduce code size - Refactor
shutdown-reply
separating shutdown actions and responding to shutdown request - Refactor away content-calculating functions to get better locality permitted by much smaller response generating functions
- Refactor
send-message
andsend-router-message
to reduce code redundancy and make code easier to follow - Refactor
execute-request-handler
a bit, add comments - Rename
get-message-{signer,checker}
tomake-message-{signer,checker}
- Move some generic helper functions to
util.clj
- Use multi-method
-
middleware/mime_values.clj
- Assoc
:mime-tagged-value
to result ofto-mime
(instead of mime-tagging:value
directly): Enables using thenrepl
server using regular clients
- Assoc
-
protocol/mime_convertible.clj
- Print
nil
asnil
(instead of not printing anything)
- Print
-
stacktrace.clj
- Add mechanism to control whether stacktraces are printed or not as it appears
that
cider-nrepl
occasionally triggers uncaught exceptions. Most likely linked to upgrade ofnrepl
and/orcider-nrepl
; the cause of the problem not understood as yet.
- Add mechanism to control whether stacktraces are printed or not as it appears
that
-
core_test.clj
- Update tests
- Miscellaneous code cleanup
- Send error messages to Jupyter stream
stderr
instead ofstdout
- Use
->Class
-forms, e.g.->HiccupHTML
instead ofHiccupHTML.
, to allow interactive class updates - Extra
log/debug
here and there - Various reformatting here and there
- Send error messages to Jupyter stream
- Examples
-
html-demo.ipynb
- Update to use Vega Lite instead of Highcharts (which seems to be broken in both updated version
and current
HEAD
ofmaster
using Clojure 1.8)
- Update to use Vega Lite instead of Highcharts (which seems to be broken in both updated version
and current
-
incanter-demo.ipynb
- Update to print Clojure version
-