Skip to main content

GraphIO

Tests PyPI License Neo4j Python Downloads

OGM and data loader for Neo4j with two main approaches:

  • OGM (Object Graph Mapper): Pydantic-based models with Neo4j integration for complex data models and applications
  • Datasets (NodeSet/RelationshipSet): Bulk data containers optimized for fast data loading and testing
  • Multi-Database Support: Full support for Neo4j Enterprise Edition multi-database feature

Documentation

Docs available at: https://graphio.readthedocs.io

Quick Start

Installation

Install graphio from PyPI:

pip install graphio

Install the latest version from GitHub:

pip install git+https://github.com/kaiserpreusse/graphio.git

Example

from graphio import NodeModel, Base
from neo4j import GraphDatabase

# Set up connection
driver = GraphDatabase.driver('neo4j://localhost:7687', auth=('neo4j', 'password'))
Base.set_driver(driver)
# Optional: Set target database (Enterprise Edition)
# Base.set_database('production')

# Define OGM model for structure and validation
class Person(NodeModel):
    _labels = ['Person']
    _merge_keys = ['email']
    name: str
    email: str

# Get bulk container directly from OGM model
people = Person.dataset()  # Automatically uses Person's labels and merge_keys

for person_data in large_dataset:
    # Create validated OGM instance and add directly
    person = Person(**person_data)  # Pydantic validation happens here
    people.add(person)  # Add validated instance to bulk dataset

people.create(driver)  # Bulk create with validation benefits

# Use OGM for application logic
alice = Person.match(Person.email == 'alice@example.com').first()

Development

Prerequisites

  • Python 3.10+
  • uv (recommended) or pip
  • Docker for running test databases

Setup

# Clone the repository
git clone https://github.com/kaiserpreusse/graphio.git
cd graphio

# Install dependencies
uv sync --extra dev

# Start Neo4j test databases
make localdb

Common Commands

# Run tests
make test

# Check code style  
make lint

# Format code
make format

# Fix linting issues and format
make fix

# Run all checks (lint + test)
make check

# Serve documentation locally
make docs

# See all available commands
make help

Testing

The test suite requires Docker containers running Neo4j. Start them with:

make localdb

Then run tests with:

make test
# or directly:
uv run pytest

All tests using the graph fixture will run against both Neo4j Community and Enterprise editions.

To run the suite against other servers, set GRAPHIO_TEST_TARGETS to a JSON array of targets. It replaces the default targets; name is used as the pytest parameter id. The suite wipes each target database before every test.

GRAPHIO_TEST_TARGETS='[
  {"name": "lts", "uri": "bolt://127.0.0.1:17687", "user": "neo4j", "password": "kwela-harness"},
  {"name": "cal", "uri": "bolt://127.0.0.1:27687", "user": "neo4j", "password": "kwela-harness"}
]' uv run pytest

Feedback

Please provide feedback, ideas and bug reports through GitHub issues.

Metadata

Release files for graphio 0.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphio 0.23
File Size Uploaded
graphio-0.23.tar.gz 99.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for graphio 0.23
File Interpreter ABI Platform
graphio-0.23-py3-none-any.whl Python 3 none any Details

Total release size: 126.9 kB

Release files / graphio-0.23.tar.gz

Download URL graphio-0.23.tar.gz
Size 99.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ef2ddceddb2dba4816fabe0701f18f2e7a8b688678bbe045d3456365ed529007
BLAKE2b-256 checksum
How to use checksums
917d41ee0759ef2c472f1c3167725331f23ef68b12c47b95961b478b576fcee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / graphio-0.23-py3-none-any.whl

Download URL graphio-0.23-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa72445df71c0b7cc828d7dd7e6e3d659c7104f274cd7f3236f3a573187343f2
BLAKE2b-256 checksum
How to use checksums
30267a8ae42e06a738ceef799d44e87253e4417d0750004002b1fe98b306bf6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release history Release notifications | RSS feed

This release

0.23 This release

2 release files

0.22

2 release files

0.21

2 release files

0.20

2 release files

0.19

2 release files

0.18

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page