Metadata-Version: 2.4
Name: pydantic-graph-neo4j-persistence
Version: 0.1.2
Summary: Neo4j persistence adapter for Pydantic Graph
Project-URL: Homepage, https://github.com/Goduu/pydantic_graph.neo4j_persistence
Project-URL: Source, https://github.com/Goduu/pydantic_graph.neo4j_persistence
Author-email: Goduu <idcangussu@hotmail.com>
License: MIT
License-File: LICENSE
Classifier: Environment :: Console
Classifier: Environment :: MacOS X
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: pydantic-ai>=0.0.42
Requires-Dist: pydantic-graph>=0.0.42
Requires-Dist: pydantic>=2.0
Description-Content-Type: text/markdown

# pydantic_graph.neo4j_persistence


[![PyPI Version](https://badge.fury.io/py/pydantic-graph-neo4j-persistence.svg)](https://pypi.org/project/pydantic-graph-neo4j-persistence/)
[![Build Status](https://travis-ci.org/yourusername/pydantic_graph.neo4j_persistence.svg?branch=main)](https://travis-ci.org/yourusername/pydantic_graph.neo4j_persistence)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

## Overview

`pydantic_graph.neo4j_persistence` is a persistence adapter for Neo4j that seamlessly integrates with Pydantic models. It enables saving node snapshots directly into a Neo4j database, facilitating efficient graph data management within Python applications.

## Features

- **Seamless Integration**: Effortlessly combine Pydantic's data validation with Neo4j's graph database capabilities.
- **Automatic Snapshotting**: Automatically persist node states to Neo4j, ensuring data consistency.
- **Flexible Configuration**: Tailor the persistence layer to fit various application architectures.

## Installation

To install `pydantic_graph_neo4j_persistence`, use pip:

```bash
pip install pydantic_graph_neo4j_persistence
```
# Quick Start

Here is a basic example demonstrating how to use pydantic_graph.neo4j_persistence:

```python

async def run_as_cli(answer: str | None):
    persistence = Neo4jStatePersistence(
        uri="your_uri",
        username="your_username",
        password="your_password",
        execution_id="execution_id",
        verbose=False
    )

    persistence.set_graph_types(my_pydantic_graph)

    ...
    


if __name__ == '__main__':
    import asyncio
    import sys
    
    a = sys.argv[2] if len(sys.argv) > 2 else None
    asyncio.run(run_as_cli(a))
```

You can see a full example on the oficial pydantic [documentation](https://ai.pydantic.dev/examples/question-graph/). From there just change the persistence variable to use the `Neo4jStatePersistence`

# Contributing
We welcome contributions to enhance the functionality and usability of 
pydantic_graph.neo4j_persistence. To contribute:

    Fork the repository.

    Create a new branch for your feature or bug fix.

    Ensure existing tests pass and add new tests for your changes.

    Submit a pull request detailing your changes and the problem they address.

# License

pydantic_graph.neo4j_persistence is licensed under the MIT License. See the LICENSE file for details.
