-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added nrepl-server support
- Loading branch information
Showing
15 changed files
with
752 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ data_kernelspec | |
/notebooks/new | ||
/notebooks/no2_concentrations.png | ||
|
||
.nrepl-port | ||
.calva/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Table of contents | ||
- [`basilisp-kernel.nrepl-server`](#basilisp-kernel.nrepl-server) | ||
- [`server-shut`](#basilisp-kernel.nrepl-server/server-shut) - Convenience function to shutdown the <code>SERVER</code>. | ||
- [`server-start`](#basilisp-kernel.nrepl-server/server-start) - Starts the nrepl-server in async mode according to <code>OPTS</code>, using a asyncio task to schedule any pending client work every 100ms. | ||
|
||
----- | ||
# <a name="basilisp-kernel.nrepl-server">basilisp-kernel.nrepl-server</a> | ||
|
||
|
||
|
||
|
||
|
||
|
||
## <a name="basilisp-kernel.nrepl-server/server-shut">`server-shut`</a><a name="basilisp-kernel.nrepl-server/server-shut"></a> | ||
``` clojure | ||
|
||
(server-shut server) | ||
``` | ||
Function. | ||
|
||
Convenience function to shutdown the `SERVER`. | ||
<p><sub><a href="https://github.com/ikappaki/basilisp-kernel/blob/master/basilisp_kernel/nrepl_server.lpy#L87-L90">Source</a></sub></p> | ||
|
||
## <a name="basilisp-kernel.nrepl-server/server-start">`server-start`</a><a name="basilisp-kernel.nrepl-server/server-start"></a> | ||
``` clojure | ||
|
||
(server-start) | ||
(server-start {:keys [host port dir interval-sec], :as opts, :or {port 0, interval-sec 0.1}}) | ||
``` | ||
Function. | ||
|
||
Starts the nrepl-server in async mode according to `OPTS`, using a | ||
asyncio task to schedule any pending client work every 100ms. | ||
|
||
`OPTS` is a map that can have the following keys. It defaults to {}. | ||
|
||
`:dir` The directory where the `.nrepl-port` file should be created | ||
at. It defaults to the current working directory if not given or | ||
empty. | ||
|
||
`:host` The interface address the server should be bound to. It | ||
defaults to 127.0.0.1 if not given or empty. | ||
|
||
`:port` The port number the server should listen to. It defaults to | ||
0, which indicates a random available port number. | ||
|
||
It return the `server`, which is a map with the following keys | ||
|
||
`:host` The host interface to which the server is bound. | ||
|
||
`:nrepl-port-file` The path to the `.nrepl-port` file created by the | ||
server. | ||
|
||
`:port` The port on the host interface the server listens for client | ||
connections. | ||
|
||
`:shutdown!` A function to shutdown the server. | ||
<p><sub><a href="https://github.com/ikappaki/basilisp-kernel/blob/master/basilisp_kernel/nrepl_server.lpy#L25-L85">Source</a></sub></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
(import [IPython.display :as id] | ||
[ipywidgets :as iw]) | ||
|
||
|
||
|
||
(def v ) | ||
|
||
(def ) | ||
|
||
(comment | ||
(import | ||
[matplotlib.pyplot :as plt]) | ||
|
||
(type (iw/Output)) | ||
;; | ||
) | ||
|
||
(defn abc [] | ||
(let [v (iw.widgets/IntSlider ** :value 0 :min 0 :max 100 :description "hey there") | ||
output (iw/Output)] | ||
(id/display v output) | ||
)) | ||
|
||
(def xyz (abc)) | ||
|
||
(def code-js " | ||
const notebook = document.querySelector('#notebook-container') || document.querySelector('.jp-NotebookPanel-notebook'); | ||
if (notebook) { | ||
// For both Classic Notebook and JupyterLab | ||
IPython.notebook.insert_cell_below(); | ||
IPython.notebook.select_next(); | ||
IPython.notebook.get_selected_cell().set_text("print('This content was injected!')"); | ||
IPython.notebook.get_selected_cell().execute(); | ||
} | ||
") | ||
|
||
(def code-js2 | ||
"var cell = IPython.notebook.insert_cell_below('code'); | ||
cell.set_text(\"128\"); | ||
cell.execute()" | ||
) | ||
|
||
(id/display (id/Javascript | ||
code-js2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"""The Basilisp Jupyter kernel""" | ||
|
||
__version__ = '1.1.0' | ||
__version__ = '1.2.0b1' | ||
|
||
from .kernel import BasilispKernel |
Oops, something went wrong.