Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d02b2a9
first working react comp
OskarDamkjaer Jun 25, 2025
9d84f42
nvl demo works
OskarDamkjaer Jun 25, 2025
a13ba69
basics in place!
OskarDamkjaer Jun 25, 2025
d4914bb
basics in place2
OskarDamkjaer Jun 25, 2025
a712a2c
merge main
OskarDamkjaer Feb 11, 2026
e8b273b
re-fix dependencies
OskarDamkjaer Feb 11, 2026
fa15510
rebulds
OskarDamkjaer Feb 11, 2026
3a6fa1e
move to anywidget
OskarDamkjaer Feb 11, 2026
f1458e3
split builds
OskarDamkjaer Feb 11, 2026
36f4e02
fix ts errors
OskarDamkjaer Feb 11, 2026
13f5e9f
Move to single file HTML template
OskarDamkjaer Feb 11, 2026
be29e7b
cleanup
OskarDamkjaer Feb 11, 2026
06e8f2f
update options support
OskarDamkjaer Feb 11, 2026
7f32146
cleaning up project for publishing
OskarDamkjaer Feb 11, 2026
e013f39
cleanup changelog
OskarDamkjaer Feb 11, 2026
b5f746b
remove duplciate types
OskarDamkjaer Feb 11, 2026
9e14d8a
restore misleading deprecated notices
OskarDamkjaer Feb 11, 2026
5c7ccaf
move old to_html mention
OskarDamkjaer Feb 11, 2026
4998650
simplify applet
OskarDamkjaer Feb 12, 2026
cdbb482
cleanup widget
OskarDamkjaer Feb 12, 2026
0fd2f65
cleanup
OskarDamkjaer Feb 12, 2026
6d70499
with error boundary
OskarDamkjaer Feb 12, 2026
ab765f0
notes
OskarDamkjaer Feb 12, 2026
6905c40
Fix hot loading scripts
OskarDamkjaer Feb 12, 2026
7e6a8f1
self review
OskarDamkjaer Feb 12, 2026
66d9dea
self review
OskarDamkjaer Feb 12, 2026
bdce1bf
cleaup package.json
OskarDamkjaer Feb 12, 2026
6c52520
restore doc changes
OskarDamkjaer Feb 12, 2026
a210821
simplify paths
OskarDamkjaer Feb 12, 2026
03d81fd
ensure we run type checking as part of building
OskarDamkjaer Feb 12, 2026
31d11aa
self review
OskarDamkjaer Feb 12, 2026
7c6e6bb
limit changes
OskarDamkjaer Feb 12, 2026
4bb8934
restore changes
OskarDamkjaer Feb 12, 2026
76ee7b2
cleaup annotations
OskarDamkjaer Feb 12, 2026
269e3f9
cleanupdiff
OskarDamkjaer Feb 12, 2026
b37d057
restore tests
OskarDamkjaer Feb 12, 2026
a3183fa
cleanup
OskarDamkjaer Feb 12, 2026
7d7956c
cleanup entrypoints
OskarDamkjaer Feb 12, 2026
f701a66
update example with live binding
OskarDamkjaer Feb 12, 2026
90a230f
more tests
OskarDamkjaer Feb 12, 2026
2e832b3
restorepkgsjson
OskarDamkjaer Feb 12, 2026
2eb2edd
fix lint error
OskarDamkjaer Feb 12, 2026
3c7a0ef
formatting
OskarDamkjaer Feb 12, 2026
585b105
Update CONTRIBUTING.md
OskarDamkjaer Feb 16, 2026
4f6132e
Add just convenience targets
FlorentinD Feb 20, 2026
42ff701
Fix caption for gds
FlorentinD Feb 20, 2026
7fd14de
Add just targets to spin up neo4j setup for testing
FlorentinD Feb 20, 2026
5d1379e
fix hierarchical layout
OskarDamkjaer Feb 20, 2026
9dd7e4c
update data transformers to support caption and add test
OskarDamkjaer Feb 20, 2026
c4e45a5
Side panel closed by default
OskarDamkjaer Feb 20, 2026
ae342e0
fix dark mode
OskarDamkjaer Feb 20, 2026
990058e
Apply last review updates
FlorentinD Feb 20, 2026
11bc330
Update node version in CI
FlorentinD Feb 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
python-version: "3.11"
enable-cache: true
- run: uv venv
- run: uv sync --group dev --extra pandas --extra gds --extra snowflake
- run: uv sync --group dev --extra pandas --extra neo4j --extra gds --extra snowflake

- name: Check code style
run: source .venv/bin/activate && cd ${GITHUB_WORKSPACE} && ./scripts/checkstyle.sh
14 changes: 4 additions & 10 deletions .github/workflows/nvl-entrypoint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,18 @@ name: Build JS Applet and check for changes
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
paths:
- "js-applet/src/nvl_entrypoint/**" # JS sources
- "js-applet/webpack.config.js"
- "js-applet/babel.config.js"
- "js-applet/package.json"
- "js-applet/tsconfig.json"
branches: [ "main" ]
- "js-applet/**"
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

tests:

# The type of runner that the job will run on
runs-on: "ubuntu-latest"

Expand All @@ -34,7 +28,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '23.x'
node-version: "24.x"
- name: Setup
run: yarn
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snowflake-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
SNOWFLAKE_ROLE: ACCOUNTADMIN
SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }}
run: pytest tests/ --include-snowflake
run: uv run pytest tests/ --include-snowflake
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ out/*
.idea

.dmypy.json
python-wrapper/uv.lock
.virtual_documents
# ignore top-level yarn files, the js-applet files are relevant
yarn.lock
82 changes: 32 additions & 50 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ If you're not already a member, sign up!

We love our community and wouldn't be where we are without you.


## Need to raise an issue?

Where you raise an issue depends largely on the nature of the problem.
Expand All @@ -34,7 +33,6 @@ Include as much information as you can in any request you make:
- What errors are you seeing?
- What solutions have you tried already?


## Want to contribute?

If you want to contribute a pull request, we have a little bit of process you'll need to follow:
Expand All @@ -50,102 +48,87 @@ We can't guarantee that we'll accept pull requests and may ask you to make some
Occasionally, we might also have logistical, commercial, or legal reasons why we can't accept your work but we'll try to find an alternative way for you to contribute in that case.
Remember that many community members have become regular contributors and some are now even Neo employees!


## Building the project locally

To build the Python packages, run inside the `python-wrapper` folder:
## Quick start

```sh
pip install . # run with --editable for development mode
just js-dev
```

To rebuild the JavaScript applet, run inside the `js-applet` folder:
This starts Vite watch builds and Jupyter Lab with hot module reloading. Changes to `js-applet/src/` will auto-reload in active widget cells.

If you want to modify the python code, run:

```sh
yarn # Install JavaScript dependencies
yarn build # Build JavaScript resources to be used by Python code
just py-sync
```

This will build the app and copy the relevant files to the python wrapper
This will install all required dev dependencies and install the package in editable mode.


## Specifically for this project

In this section, we will provide some more specific information about how to work with this particular project.


### Python development environment

* Install Python 3.9+
* [Install pip](https://pip.pypa.io/en/stable/installation/)
* Install the project's Python dependencies:
```bash
pip install -e .
pip install ".[dev]"
```
- Install Python 3.10+
- We recommend installing [just](https://github.com/casey/just) for running commands

Install the project's Python dependencies:
```bash
just py-sync
```

Apply and check python styling:
```sh
just py-style
```


### Testing

To run unit tests, execute:

```sh
pytest python-wrapper/tests
just py-test
```

Additionally, there are integration tests that require an external data source.
These require additional setup and configuration, such as environment variables specifying connection details.


For a local Neo4j instance with GDS installed, execute:
To test the Neo4j and GDS related tests, execute:
```sh
cd test-envs/neo4j-gds
docker compose up -d
```

To run tests requiring a Neo4j DB instance with GDS installed, execute:
```sh
export NEO4J_URI=localhost:7687 # or credentials for Aura API
cd python-wrapper/
pytest tests --include-neo4j-and-gds
just py-test-gds
```
This will spinup a Neo4j container with the GDS plugin installed.

To run tests requiring a Snowflake connection, execute:

```sh
cd python-wrapper/
pytest tests/ --include-snowflake
```


### Project structure

The project contains of three parts:

- a JavaScript applet whith a basic NVL implementation under the `js-applect` folder
- a JavaScript applet under the `js-applet` folder
- a Python package which loads the applet and offers convenience functions to pass data to the applet
- Jupyter notebooks to test the NVL Python wrapper

- Jupyter notebooks to test the Python wrapper

### JavaScipts configs

* `babel.config.js` - Config for the JavaScript compiler
* `tsconfig.json` - Configuration for TypeScript code
* `package.json` - For yarn, define dependencies and `build` target
* `webpack.config.js` - Config for bundling JS parts
### JavaScript configs

- `vite.config.ts` - Vite config for the lib build (widget.js + style.css for anywidget)
- `vite.config.html.ts` - Vite config for the HTML singlefile build (self-contained index.html)
- `tsconfig.json` - Configuration for TypeScript code
- `package.json` - For yarn, define dependencies and `build` target

### Python

Everything is configured inside `pyproject.toml`

To keep a consistent code-style, we use `ruff` and `mypy`.
For convenience there are a couple of scripts:

```sh
./scripts/makestyle.sh # try to fix linting violations and format code
./scripts/checkstyle.sh # check for linting, format or typing issues

```
For convenience there are a couple of just targets under `justfile`:


## Got an idea for a new project?
Expand All @@ -155,7 +138,6 @@ Chances are that someone has a similar idea or may have already started working
The best software comes from getting like minds together to solve a problem.
And we'll do our best to help you promote and co-ordinate your Neo4j ecosystem projects.


## Further reading

If you want to find out more about how you can contribute, head over to our website for [more information](http://neo4j.com/developer/contributing-code/).
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include examples/example_cora_graph.png
include examples/example_graph.png
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

`neo4j-viz` is a Python package for creating interactive graph visualizations.

The output is of type `IPython.display.HTML` and can be viewed directly in a Jupyter Notebook or Streamlit application.
The `render` method returns an `IPython.display.HTML` object that can be viewed directly in a Jupyter Notebook or Streamlit application.
For an interactive widget experience, use `render_widget()` which returns an anywidget-based `GraphWidget` with two-way data sync.
Alternatively, you can export the output to a file and view it in a web browser.

The package wraps the [Neo4j Visualization JavaScript library (NVL)](https://neo4j.com/docs/nvl/current/).

![Example Graph](examples/example_cora_graph.png)
![Example Graph](examples/example_graph.png)

## Some notable features

Expand Down Expand Up @@ -102,7 +103,8 @@ VG = VisualizationGraph(nodes=nodes, relationships=relationships)
VG.render()
```

This will return a `IPython.display.HTML` object that can be rendered in a Jupyter Notebook or streamlit application.
This will return an `IPython.display.HTML` object that can be rendered in a Jupyter Notebook or Streamlit application.
For an interactive Jupyter widget, use `VG.render_widget()` instead.

Please refer to the [documentation](https://neo4j.com/docs/nvl-python/preview/) for more details on the API and usage.

Expand Down
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

## Breaking changes

- Removed the `show_hover_tooltip` parameter from `render()`. The visualization now shows a detail side panel for selected nodes and relationships, replacing the previous hover tooltip.
- Nodes are colored by default by their caption. Use `VG.color_nodes(field="caption", colors=[neo4j_viz.colors.NEO4J_COLORS_DISCRETE[0]])` to apply the previous coloring.


## New features

- Nodes are now automatically colored by their caption (label) in the JavaScript visualization. This works out of the box without needing to call `color_nodes()`, and applies regardless of how the graph was created. Explicit colors set via `color_nodes()` or directly on nodes take precedence. There is no longer a limit on the number of unique labels for auto-coloring.
- New `Zoom to fit` button in the visualization.
- New `render_widget()` method on `VisualizationGraph` returns a `GraphWidget` (anywidget) for interactive two-way data sync in Jupyter environments (JupyterLab, Notebook 7, VS Code, Colab).

## Bug fixes

## Improvements

- Migrated JavaScript visualization from `@neo4j-nvl/base` to `@neo4j-ndl/react-graph` React component.
- Migrated build system from Webpack to Vite.
- Added anywidget integration as the primary rendering path for Jupyter environments.

## Other changes
4 changes: 3 additions & 1 deletion docs/antora/modules/ROOT/pages/customizing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Nodes and relationships can be colored directly by providing them with a color f
This can be done by passing a color as a string to the `color` parameter of the
link:{api-docs-uri}/node[Node] or link:{api-docs-uri}/relationship[Relationship] object.

By default, the nodes will be colored based on their caption. The colors are the same as in other Neo4j tools, such as Neo4j Console and Neo4j Browser.

Alternatively, you can color nodes or relationships based on a field or property after a `VisualizationGraph` object has been
created.

Expand Down Expand Up @@ -258,4 +260,4 @@ for relationship in VG.relationships:
relationship.caption_size = 15
----

Any changes made to the nodes and relationships will be reflected in the next rendering of the graph.
Any changes made to the nodes and relationships will be reflected in the next rendering of the graph.
Binary file added docs/source/tutorials/example_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/source/tutorials/gds-example.nblink
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"path": "../../../examples/gds-example.ipynb",
"extra-media": [
"../../../examples/example_cora_graph.png"
"../../../examples/example_graph.png"
]
}
Binary file added examples/example_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading