Skip to content

Commit

Permalink
prepare for 0.1.0 public release (#3)
Browse files Browse the repository at this point in the history
v0.1.0 release
  • Loading branch information
ikappaki authored Nov 17, 2024
1 parent 0250866 commit f061547
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ jobs:
run: gh release upload ${{ github.event.release.tag_name }} dist/*.{tar.gz,whl}
env:
GH_TOKEN: ${{ github.token }}
# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
15 changes: 8 additions & 7 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


The logger for this namespace.
<p><sub><a href="/blob/main/src/basilisp_nrepl_async/nrepl_server.lpy#L19-L21">Source</a></sub></p>
<p><sub><a href="https://github.com/ikappaki/basilisp-nrepl-async/blob/master/src/basilisp_nrepl_async/nrepl_server.lpy#L19-L21">Source</a></sub></p>

## <a name="basilisp-nrepl-async.nrepl-server/ops">`ops`</a><a name="basilisp-nrepl-async.nrepl-server/ops"></a>

Expand All @@ -32,7 +32,7 @@ The logger for this namespace.

A map of operations supported by the nREPL server (as keywords) to function
handlers for those operations.
<p><sub><a href="/blob/main/src/basilisp_nrepl_async/nrepl_server.lpy#L332-L345">Source</a></sub></p>
<p><sub><a href="https://github.com/ikappaki/basilisp-nrepl-async/blob/master/src/basilisp_nrepl_async/nrepl_server.lpy#L332-L345">Source</a></sub></p>

## <a name="basilisp-nrepl-async.nrepl-server/server-start!">`server-start!`</a><a name="basilisp-nrepl-async.nrepl-server/server-start!"></a>
``` clojure
Expand Down Expand Up @@ -72,6 +72,7 @@ Creates an `socketserver/ThreadingTCPServer` nREPL server with
detect.

`:port` The port number to listen to, defaults to 0 which means to
pickup a random available port.

`:server*` An optional promise delivering a map on server upbringing
with the following keys
Expand All @@ -81,7 +82,7 @@ Creates an `socketserver/ThreadingTCPServer` nREPL server with
:port The local port the server is listening on.

:shutdown-fn The function to shutdown the server.
<p><sub><a href="/blob/main/src/basilisp_nrepl_async/nrepl_server.lpy#L568-L659">Source</a></sub></p>
<p><sub><a href="https://github.com/ikappaki/basilisp-nrepl-async/blob/master/src/basilisp_nrepl_async/nrepl_server.lpy#L568-L660">Source</a></sub></p>

-----
# <a name="basilisp-nrepl-async.utils">basilisp-nrepl-async.utils</a>
Expand All @@ -100,7 +101,7 @@ Macro.

Converts the `ERROR` list to a human-readable string and returns
it. Includes stack traces for any embedded exceptions.
<p><sub><a href="/blob/main/src/basilisp_nrepl_async/utils.lpy#L19-L29">Source</a></sub></p>
<p><sub><a href="https://github.com/ikappaki/basilisp-nrepl-async/blob/master/src/basilisp_nrepl_async/utils.lpy#L19-L29">Source</a></sub></p>

## <a name="basilisp-nrepl-async.utils/error-add">`error-add`</a><a name="basilisp-nrepl-async.utils/error-add"></a>
``` clojure
Expand All @@ -111,7 +112,7 @@ Macro.

Adds additional `DETAILS` to the existing `ERROR` list and returns
it.
<p><sub><a href="/blob/main/src/basilisp_nrepl_async/utils.lpy#L12-L17">Source</a></sub></p>
<p><sub><a href="https://github.com/ikappaki/basilisp-nrepl-async/blob/master/src/basilisp_nrepl_async/utils.lpy#L12-L17">Source</a></sub></p>

## <a name="basilisp-nrepl-async.utils/error-make">`error-make`</a><a name="basilisp-nrepl-async.utils/error-make"></a>
``` clojure
Expand All @@ -122,7 +123,7 @@ Macro.

Returns a list from the provided error `DETAILS` to represent an
error.
<p><sub><a href="/blob/main/src/basilisp_nrepl_async/utils.lpy#L6-L10">Source</a></sub></p>
<p><sub><a href="https://github.com/ikappaki/basilisp-nrepl-async/blob/master/src/basilisp_nrepl_async/utils.lpy#L6-L10">Source</a></sub></p>

## <a name="basilisp-nrepl-async.utils/with-eprotect">`with-eprotect`</a><a name="basilisp-nrepl-async.utils/with-eprotect"></a>
``` clojure
Expand All @@ -141,4 +142,4 @@ Creates a try/catch wrapper around `BODY` that returns any exception

`:on-err-str` [opt] A function to call if an exception is caught,
which accepts the formated error message as only argument.
<p><sub><a href="/blob/main/src/basilisp_nrepl_async/utils.lpy#L31-L61">Source</a></sub></p>
<p><sub><a href="https://github.com/ikappaki/basilisp-nrepl-async/blob/master/src/basilisp_nrepl_async/utils.lpy#L31-L61">Source</a></sub></p>
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

## Overview

This package provides an nREPL server implementation for Basilisp, evolved from the `basilisp.contrib.nrepl-server` namespace in Basilisp, addressing issues that arise from serving nREPL request in parallel with the main event loop.
An nREPL server is a networked REPL for Clojure that facilitates remote code evaluation, code completion, and debugging within Clojure-enabled editors like Emacs (via [CIDER](https://docs.cider.mx/cider/index.html)) and VS Code (via [Calva](https://calva.io/)), among others.

This package provides an nREPL server implementation for Basilisp Clojure, evolved from the [basilisp.contrib.nrepl-server](https://basilisp.readthedocs.io/en/latest/api/contrib/nrepl-server.html) namespace in Basilisp, addressing issues that arise from serving nREPL request in parallel with the main event loop.

Serving an nREPL client connection on a parallel thread in Python may conflict with the Global Interpreter Lock (GIL) and single-threaded libraries, potentially causing errors or crashes.

Expand All @@ -17,16 +19,27 @@ To mitigate this, the library includes an asynchronous mode where client request
To install `basilisp-nrepl-async`, run:

```shell
pip install https://github.com/ikappaki/basilisp-nrepl-async/releases/download/v0.1.0b3/basilisp_nrepl_async-0.1.0b3-py3-none-any.whl
pip install basilisp-nrepl-async
```

## Usage

See [API.md](API.md).

### Synchronous mode

To start in synchronous mode, call [server-start!](API.md#basilisp-nrepl-async.nrepl-server/server-start!) with the optional `:host`, `:port` and `:nrepl-port-file` keys. The server will block and handle client requests as they arrive.

```clojure
(require '[basilisp-nrepl-async.nrepl-server :as nr])

(def server-async (nr/server-start! {:port 9999}))
; nREPL server started on port 9999 on host 127.0.0.1 - nrepl://127.0.0.1:9999
```

### Asynchronous mode

To start the nREPL server on a random port bound to the local interface in asynchronous mode, call [server-start!](API.md#basilisp-nrepl-async.nrepl-server/server-start!) with the `async?` option set to `true`. Periodically invoke the returned `work-fn` within your program's main loop to handle client requests.
To start the nREPL server on a random port bound to the local interface in asynchronous mode, call [server-start!](API.md#basilisp-nrepl-async.nrepl-server/server-start!) with the `async?` option set to `true`. Periodically invoke the returned `work-fn` within your program's main loop to handle client requests. Use the `shutdown-fn` to stop the server.

```clojure
(require '[basilisp-nrepl-async.nrepl-server :as nr])
Expand All @@ -53,17 +66,6 @@ The server will create an `.nrepl-port` file in the current working directory wi

You can also pass additional options to the [server-start!](API.md#basilisp-nrepl-async.nrepl-server/server-start!) function, such as `:host`, `:port` and `:nrepl-port-file`, to explicitly configure the server's listening interface, port, and the file where the port number is written (typically `<your-basilisp-lib>/.nrepl-port` for integration with your editor).

### Synchronous mode

To start in synchronous mode, call [server-start!](API.md#basilisp-nrepl-async.nrepl-server/server-start!) with the optional `:host`, `:port` and `:nrepl-port-file` keys. The server will block and handle client requests as they arrive.

```clojure
(require '[basilisp-nrepl-async.nrepl-server :as nr])

(def server-async (nr/server-start! {:port 9999}))
; nREPL server started on port 9999 on host 127.0.0.1 - nrepl://127.0.0.1:9999
```

## Development and Testing

To run the test suite, use the following command:
Expand Down
4 changes: 3 additions & 1 deletion bb.edn
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
{quickdoc {:doc "Invoke quickdoc"
:extra-deps {io.github.borkdude/quickdoc {:git/sha "7e41f33d98e2ef697dd9ecdff8e84b779141c7a6"}}
:task (exec 'quickdoc.api/quickdoc)
:exec-args {:source-paths ["src/basilisp_nrepl_async/nrepl_server.lpy"
:exec-args {:git/branch "master"
:github/repo "https://github.com/ikappaki/basilisp-nrepl-async"
:source-paths ["src/basilisp_nrepl_async/nrepl_server.lpy"
"src/basilisp_nrepl_async/utils.lpy"]}}}}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "basilisp-nrepl-async"
version = "0.1.0b3"
version = "0.1.0"
description = ""
authors = ["ikappaki <[email protected]>"]
readme = "README.md"
Expand Down
1 change: 1 addition & 0 deletions src/basilisp_nrepl_async/nrepl_server.lpy
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@
detect.
`:port` The port number to listen to, defaults to 0 which means to
pickup a random available port.
`:server*` An optional promise delivering a map on server upbringing
with the following keys
Expand Down

0 comments on commit f061547

Please sign in to comment.