Skip to content

Commit

Permalink
Merge pull request #805 from neo4j-contrib/rc/5.3.1
Browse files Browse the repository at this point in the history
Rc/5.3.1
  • Loading branch information
mariusconjeaud authored May 29, 2024
2 parents b32e169 + bf955df commit 7c6662a
Show file tree
Hide file tree
Showing 33 changed files with 1,196 additions and 92 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ jobs:
pytest --cov=neomodel --cov-report=html:coverage_report
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # Ensure the token is used here
fail_ci_if_error: true # Optional: specify if CI should fail when codecov fails
5 changes: 5 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 5.3.1 2024-05
* Add neomodel_generate_diagram script, which generates a graph model diagram based on your neomodel class definitions. Arrows and PlantUML dot options
* Fix bug in async iterator async for MyClass.nodes
* Fix bugs in database inspection script (multiple rels per label, missing DateProperty type)

Version 5.3.0 2024-04
* Add async support
* Breaking change : config.AUTO_INSTALL_LABELS has been removed. Please use the neomodel_install_labels script instead
Expand Down
5 changes: 1 addition & 4 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
sphinx_copybutton
neo4j==5.10.0
pytz>=2021.1
neobolt==1.7.17
six==1.16.0
neo4j~=5.19.0

2 changes: 1 addition & 1 deletion doc/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Adjust driver configuration - these options are only available for this connecti
config.MAX_TRANSACTION_RETRY_TIME = 30.0 # default
config.RESOLVER = None # default
config.TRUST = neo4j.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES # default
config.USER_AGENT = neomodel/v5.3.0 # default
config.USER_AGENT = neomodel/v5.3.1 # default

Setting the database name, if different from the default one::

Expand Down
18 changes: 18 additions & 0 deletions doc/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ After executing, it will print all indexes and constraints it has removed.
Ommitting the ``--db`` argument will default to the ``NEO4J_BOLT_URL`` environment variable. This is useful for masking
your credentials.

Generate class diagram
======================
You can generate a class diagram of your models using the ``neomodel_generate_diagram`` command::

$ neomodel_generate_diagram models/my_models.py --file-type arrows --write-to-dir img

You must specify a directory in which to lookup neomodel classes (nodes and rels). Typing '.' will search in your whole directory.

You have the option to generate the diagram in different file types using ``--file-type`` : ``arrows``, ``puml`` (which uses the dot notation).

Ommitting the ``--write-to-dir`` option will default to the current directory.

.. note::

Property types and the presence of indexes, constraints and required rules will be displayed on the nodes.

Relationship properties are not supported in the diagram generation.

Create, Update, Delete operations
=================================

Expand Down
5 changes: 5 additions & 0 deletions doc/source/module_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ Scripts
:undoc-members:
:show-inheritance:

.. automodule:: neomodel.scripts.neomodel_generate_diagram
:members:
:undoc-members:
:show-inheritance:

.. automodule:: neomodel.scripts.neomodel_install_labels
:members:
:undoc-members:
Expand Down
241 changes: 241 additions & 0 deletions model_diagram.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
{
"style": {
"node-color": "#ffffff",
"border-color": "#000000",
"caption-color": "#000000",
"arrow-color": "#000000",
"label-background-color": "#ffffff",
"directionality": "directed",
"arrow-width": 5
},
"nodes": [
{
"id": "n0",
"position": {
"x": 0,
"y": 0
},
"caption": "",
"style": {},
"labels": [
"Claim"
],
"properties": {
"uid": "str - unique",
"content": "str",
"claim_number": "int",
"embedding": "list[float]"
}
},
{
"id": "n1",
"position": {
"x": 346.4101615137755,
"y": 199.99999999999997
},
"caption": "",
"style": {},
"labels": [
"Inventor"
],
"properties": {
"name": "str - index"
}
},
{
"id": "n2",
"position": {
"x": 2.4492935982947064e-14,
"y": 400.0
},
"caption": "",
"style": {},
"labels": [
"Applicant"
],
"properties": {
"name": "str - index"
}
},
{
"id": "n3",
"position": {
"x": -346.4101615137754,
"y": 200.00000000000014
},
"caption": "",
"style": {},
"labels": [
"Owner"
],
"properties": {
"name": "str - index"
}
},
{
"id": "n4",
"position": {
"x": -346.4101615137755,
"y": -199.99999999999991
},
"caption": "",
"style": {},
"labels": [
"CPC"
],
"properties": {
"symbol": "str - unique"
}
},
{
"id": "n5",
"position": {
"x": -7.347880794884119e-14,
"y": -400.0
},
"caption": "",
"style": {},
"labels": [
"IPCR"
],
"properties": {
"symbol": "str - unique"
}
},
{
"id": "n6",
"position": {
"x": 346.41016151377534,
"y": -200.00000000000017
},
"caption": "",
"style": {},
"labels": [
"Description"
],
"properties": {
"uid": "str - unique",
"content": "str"
}
},
{
"id": "n7",
"position": {
"x": 1146.4101615137754,
"y": 0
},
"caption": "",
"style": {},
"labels": [
"Abstract"
],
"properties": {
"uid": "str - unique",
"content": "str"
}
},
{
"id": "n8",
"position": {
"x": -399.99999999999983,
"y": 692.820323027551
},
"caption": "",
"style": {},
"labels": [
"Patent"
],
"properties": {
"uid": "str - unique",
"docdb_id": "str",
"earliest_claim_date": "date",
"status": "str",
"application_date": "date",
"granted": "str",
"discontinuation_date": "date",
"kind": "str",
"doc_number": "str",
"title": "str",
"grant_date": "date",
"language": "str",
"publication_date": "date",
"doc_key": "str",
"application_number": "str"
}
}
],
"relationships": [
{
"id": "e0",
"type": "HAS_INVENTOR",
"style": {},
"properties": {},
"fromId": "n8",
"toId": "n2"
},
{
"id": "e1",
"type": "HAS_APPLICANT",
"style": {},
"properties": {},
"fromId": "n8",
"toId": "n3"
},
{
"id": "e2",
"type": "HAS_CPC",
"style": {},
"properties": {},
"fromId": "n8",
"toId": "n5"
},
{
"id": "e3",
"type": "HAS_DESCRIPTION",
"style": {},
"properties": {},
"fromId": "n8",
"toId": "n7"
},
{
"id": "e4",
"type": "HAS_ABSTRACT",
"style": {},
"properties": {},
"fromId": "n8",
"toId": "n8"
},
{
"id": "e5",
"type": "SIMPLE_FAMILY",
"style": {},
"properties": {},
"fromId": "n8",
"toId": "n0"
},
{
"id": "e6",
"type": "EXTENDED_FAMILY",
"style": {},
"properties": {},
"fromId": "n8",
"toId": "n0"
},
{
"id": "e7",
"type": "HAS_OWNER",
"style": {},
"properties": {},
"fromId": "n8",
"toId": "n4"
},
{
"id": "e8",
"type": "HAS_CLAIM",
"style": {},
"properties": {},
"fromId": "n8",
"toId": "n1"
}
]
}
22 changes: 22 additions & 0 deletions model_diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@startuml
digraph G {
node [shape=record];
Patent [label="Patent|{}}"];
Patent -> Inventor [label="has_inventor: RelationshipTo"];
Patent -> Applicant [label="has_applicant: RelationshipTo"];
Patent -> CPC [label="has_cpc: RelationshipTo"];
Patent -> Description [label="has_description: RelationshipTo"];
Patent -> Abstract [label="has_abstract: RelationshipTo"];
Patent -> Patent [label="simple_family: RelationshipTo"];
Patent -> Patent [label="extended_family: RelationshipTo"];
Patent -> Owner [label="has_owner: RelationshipTo"];
Patent -> Claim [label="has_claim: RelationshipTo"];
Claim [label="Claim|{}}"];
Inventor [label="Inventor|{}}"];
Applicant [label="Applicant|{}}"];
Owner [label="Owner|{}}"];
CPC [label="CPC|{}}"];
IPCR [label="IPCR|{}}"];
Description [label="Description|{}}"];
Abstract [label="Abstract|{}}"];
}@enduml
2 changes: 1 addition & 1 deletion neomodel/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.3.0"
__version__ = "5.3.1"
3 changes: 0 additions & 3 deletions neomodel/async_/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,13 +936,11 @@ def __init__(self, db: AsyncDatabase, access_mode=None):

@ensure_connection
async def __aenter__(self):
print("aenter called")
await self.db.begin(access_mode=self.access_mode, bookmarks=self.bookmarks)
self.bookmarks = None
return self

async def __aexit__(self, exc_type, exc_value, traceback):
print("aexit called")
if exc_value:
await self.db.rollback()

Expand All @@ -962,7 +960,6 @@ def __call__(self, func):
@wraps(func)
async def wrapper(*args, **kwargs):
async with self:
print("call called")
return await func(*args, **kwargs)

return wrapper
Expand Down
Loading

0 comments on commit 7c6662a

Please sign in to comment.