Awesome Open Source
Awesome Open Source


Boltkit is a package of utilities for Neo4j driver authors. The library exposes a set of command line tools as well as a full Python API for working with Neo4j-compatible clients and servers.


Installation is via github and can either run globally or within a virtualenv. Installation makes available a versatile command line tool, called bolt.

$ python3 -m pip install --user git+[email protected]#egg=boltkit

where x and y are replaced with major and minor versions respectively.

$ bolt --help
Usage: bolt [OPTIONS] COMMAND [ARGS]...

  --help  Show this message and exit.

  client  Run a Bolt client
  dist    List available Neo4j releases
  get     Download Neo4j
  proxy   Run a Bolt proxy server
  server  Run a Neo4j cluster or standalone server.
  stub    Run a Bolt stub server

Command Overview

bolt client

The bolt client command allows execution of a Cypher query against a Neo4j service.


$ bolt client --help
Usage: bolt client [OPTIONS] [CYPHER]...

  Run a Bolt client

  -a, --auth AUTH
  -b, --bolt-version INTEGER
  -s, --server-addr ADDR
  -t, --transaction
  -v, --verbose
  --help                      Show this message and exit.


$ bolt client "UNWIND range(1, 10) AS n RETURN n"

bolt dist


bolt get


bolt proxy


bolt server

Run a Neo4j cluster or standalone server in one or more local Docker containers.


$ bolt server --help
Usage: bolt server [OPTIONS] [COMMAND]...

  Run a Neo4j cluster or standalone server in one or more local Docker

  If an additional COMMAND is supplied, this will be executed after startup,
  with a shutdown occurring immediately afterwards. If no COMMAND is
  supplied, the service will remain available until manually shutdown by

  A couple of environment variables will also be made available to any
  COMMAND passed. These are:


  -a, --auth AUTH           Credentials with which to bootstrap the service.
                            These must be specified as a 'user:password' pair
                            and may alternatively be supplied via the
                            NEO4J_AUTH environment variable. These credentials
                            will also be exported to any COMMAND executed
                            during the service run.
  -B, --bolt-port INTEGER   A port number (standalone) or base port number
                            (cluster) for Bolt traffic.
  -c, --n-cores INTEGER     If specified, a cluster with this many cores will
                            be created. If omitted, a standalone service will
                            be created instead. See also -r for specifying the
                            number of read replicas.
  -H, --http-port INTEGER   A port number (standalone) or base port number
                            (cluster) for HTTP traffic.
  -i, --image TEXT          The Docker image tag to use for building
                            containers. The repository can also be included,
                            but will default to 'neo4j'. Note that a Neo4j
                            Enterprise Edition image is required for building
  -n, --name TEXT           A Docker network name to which all servers will be
                            attached. If omitted, an auto-generated name will
                            be used.
  -r, --n-replicas INTEGER  The number of read replicas to include within the
                            cluster. This option will only take effect if -c
                            is also used.
  -v, --verbose             Show more detail about the startup and shutdown
  --help                    Show this message and exit.

bolt stub

The stub Bolt server can be used as a testing resource for client software. Scripts can be created against which unit tests can be run without the need for a full Neo4j server.


$ bolt stub --help
Usage: bolt stub [OPTIONS] SCRIPT

  Run a Bolt stub server.

  The stub server process listens for an incoming client connection and will
  attempt to play through a pre-scripted exchange with that client. Any
  deviation from that script will result in a non-zero exit code. This
  utility is primarily useful for Bolt client integration testing.

  -l, --listen-addr ADDR  The address on which to listen for incoming
                          connections in INTERFACE:PORT format, where
                          INTERFACE may be omitted for 'localhost'. If
                          completely omitted, this defaults to ':17687'. The
                          BOLT_LISTEN_ADDR environment variable may be used as
                          an alternative to this option.
  -t, --timeout FLOAT     The number of seconds for which the stub server will
                          wait for an incoming connection before automatically
                          terminating. If unspecified, the server will wait
  -v, --verbose           Show more detail about the client-server exchange.
  --help                  Show this message and exit.

A server script describes a conversation between client and server in terms of the messages exchanged. An example can be seen in the test/scripts/count.bolt file.

When the server receives a client message, it will attempt to match that against the next client message in the script; if found, this line of the script will be consumed. Then, any server messages that follow will also be consumed and sent back. When the client closes its connection, the server will shut down. If any script lines remain, the server will exit with an error status; if none remain it will exit successfully. After 30 seconds of inactivity, the server will time out and shut down with an error status.


Scripts generally consist of alternating client (C:) and server (S:) messages. Each message line contains the message name followed by its fields, in JSON format.

Some messages, such as RESET, can be automatically (successfully) consumed if they are not relevant to the current test. For this use a script line such as !: AUTO RESET.

An example:

!: BOLT 3

C: RUN "RETURN {x}" {"x": 1} {}
S: SUCCESS {"fields": ["x"]}
   RECORD [1]

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Python (819,471
Server (66,126
Driver (18,426
Line (17,899
Neo4j (3,303