Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/render-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Install uv and set the Python version
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
python-version: "3.11"
python-version: "3.13"
enable-cache: true

- name: Build the JS applet
Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Breaking changes

* The `Layout`, `CaptionAlignment`, `Direction`, `Packing`, `Renderer`, `SelectionMode`,
`WidgetLayout`, and `ColorSpace` enums are now `StrEnum`s: `str()` of a member (and
f-string interpolation) returns the value (e.g. `"grid"`) instead of the member name
(e.g. `"Layout.GRID"`).

## New features

## Bug fixes
Expand All @@ -15,6 +20,9 @@

## Other changes

* Remove the `enum-tools` dependency: the `document_enum` decorator only did anything
in interactive sessions, and the enum member docstrings are picked up from the source
when the docs are built.
* Drop support for Python 3.10
* On Python 3.15, the `pandas` extra installs pandas 3 (pandas 2 has no 3.15 wheels)
* The `snowflake` extra is not available on Python 3.15 until `snowflake-connector-python` ships 3.15 wheels
2 changes: 1 addition & 1 deletion docs/source/api-reference/colors.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.. autoenum:: neo4j_viz.colors.ColorSpace
.. autoclass:: neo4j_viz.colors.ColorSpace
:members:
12 changes: 6 additions & 6 deletions docs/source/api-reference/render_options.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. autoenum:: neo4j_viz.CaptionAlignment
.. autoclass:: neo4j_viz.CaptionAlignment
:members:

.. autoenum:: neo4j_viz.Layout
.. autoclass:: neo4j_viz.Layout
:members:

.. autoclass:: neo4j_viz.ForceDirectedLayoutOptions
Expand All @@ -12,14 +12,14 @@
:members:
:exclude-members: model_config

.. autoenum:: neo4j_viz.Direction
.. autoclass:: neo4j_viz.Direction
:members:

.. autoenum:: neo4j_viz.Packing
.. autoclass:: neo4j_viz.Packing
:members:

.. autoenum:: neo4j_viz.Renderer
.. autoclass:: neo4j_viz.Renderer
:members:

.. autoenum:: neo4j_viz.SelectionMode
.. autoclass:: neo4j_viz.SelectionMode
:members:
1 change: 0 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

extensions = [
"sphinx.ext.autodoc", # include docs from docstrings
"enum_tools.autoenum", # specialised autoclass for enums
"sphinx.ext.napoleon", # Support for NumPy and Google style docstrings
"nbsphinx", # support for jupyter notebooks
"nbsphinx_link", # support for jupyter notebooks from other directories
Expand Down
12 changes: 5 additions & 7 deletions python-wrapper/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ dependencies = [
"ipython >=7, <10",
"pydantic >=2 , <3",
"pydantic-extra-types >=2, <3",
"enum-tools==0.13.0",
"anywidget >=0.9, <1",
"traitlets >=5, <6",
]
Expand Down Expand Up @@ -77,12 +76,11 @@ dev = [
"python-dotenv",
]
docs = [
# Sphinx is capped at 8.1.x: 8.2+ requires Python >=3.11 and Sphinx 9 requires >=3.12
# `enum_tools.autoenum` (removed `logger` from `sphinx.ext.autodoc`).
"sphinx==8.1.3",
"enum-tools[sphinx]",
"nbsphinx==0.9.8",
"nbsphinx-link==1.4.1",
# Docs are built on Python 3.13+ only (Sphinx 9.1+ requires it), so the whole
# group is gated on it rather than resolving an older Sphinx for 3.11/3.12.
"sphinx == 9.2.0; python_version >= '3.13'",
"nbsphinx==0.9.8; python_version >= '3.13'",
"nbsphinx-link==1.4.1; python_version >= '3.13'",
]
notebook = [
"ipykernel>=6.29.5",
Expand Down
6 changes: 2 additions & 4 deletions python-wrapper/src/neo4j_viz/colors.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from collections.abc import Iterable, Sequence
from enum import Enum
from enum import StrEnum
from math import floor
from typing import Any, Union

import enum_tools
from pydantic_extra_types.color import Color, ColorType

from .node_size import RealNumber
Expand Down Expand Up @@ -72,8 +71,7 @@ def interpolate_gradient(colors: Sequence[ColorType], t: RealNumber) -> Color:
)


@enum_tools.documentation.document_enum
class ColorSpace(str, Enum):
class ColorSpace(StrEnum):
"""
Describes the type of color space used by a color palette.
"""
Expand Down
24 changes: 8 additions & 16 deletions python-wrapper/src/neo4j_viz/options.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
from __future__ import annotations

import warnings
from enum import Enum
from enum import StrEnum
from typing import Any, Literal, Optional, Union

import enum_tools.documentation
from pydantic import BaseModel, Field, ValidationError, model_validator
from pydantic.alias_generators import to_camel

from .colors import ColorSpace


@enum_tools.documentation.document_enum
class CaptionAlignment(str, Enum):
class CaptionAlignment(StrEnum):
"""
The alignment of the caption text for nodes and relationships.
"""
Expand All @@ -22,8 +20,7 @@ class CaptionAlignment(str, Enum):
BOTTOM = "bottom"


@enum_tools.documentation.document_enum
class Layout(str, Enum):
class Layout(StrEnum):
FORCE_DIRECTED = "forcedirected"
"""
The force-directed layout uses a physics simulation to position the nodes.
Expand All @@ -43,8 +40,7 @@ class Layout(str, Enum):
CIRCULAR = "circular"


@enum_tools.documentation.document_enum
class Direction(str, Enum):
class Direction(StrEnum):
"""
The direction in which the layout should be oriented
"""
Expand All @@ -55,8 +51,7 @@ class Direction(str, Enum):
DOWN = "down"


@enum_tools.documentation.document_enum
class Packing(str, Enum):
class Packing(StrEnum):
"""
The packing method to be used
"""
Expand Down Expand Up @@ -106,8 +101,7 @@ def construct_layout_options(layout: Layout, options: dict[str, Any]) -> Optiona
)


@enum_tools.documentation.document_enum
class Renderer(str, Enum):
class Renderer(StrEnum):
"""
The renderer used to render the visualization.
"""
Expand Down Expand Up @@ -139,8 +133,7 @@ def check(self, renderer: Renderer, num_nodes: int) -> None:
)


@enum_tools.documentation.document_enum
class SelectionMode(str, Enum):
class SelectionMode(StrEnum):
"""
The selection mode (a.k.a. gesture) that determines how dragging on the canvas behaves.
"""
Expand All @@ -160,8 +153,7 @@ class SelectionMode(str, Enum):
"""


@enum_tools.documentation.document_enum
class WidgetLayout(str, Enum):
class WidgetLayout(StrEnum):
"""The layout values in the JS/NVL wire format, as stored in :class:`WidgetOptions`."""

D3_FORCE = "d3Force"
Expand Down
Loading
Loading