Skip to content

Commit 7c6662a

Browse files
Merge pull request #805 from neo4j-contrib/rc/5.3.1
Rc/5.3.1
2 parents b32e169 + bf955df commit 7c6662a

33 files changed

+1196
-92
lines changed

.github/workflows/integration-tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ jobs:
4343
pytest --cov=neomodel --cov-report=html:coverage_report
4444
- name: Upload coverage reports to Codecov
4545
uses: codecov/codecov-action@v3
46+
with:
47+
token: ${{ secrets.CODECOV_TOKEN }} # Ensure the token is used here
48+
fail_ci_if_error: true # Optional: specify if CI should fail when codecov fails

Changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Version 5.3.1 2024-05
2+
* Add neomodel_generate_diagram script, which generates a graph model diagram based on your neomodel class definitions. Arrows and PlantUML dot options
3+
* Fix bug in async iterator async for MyClass.nodes
4+
* Fix bugs in database inspection script (multiple rels per label, missing DateProperty type)
5+
16
Version 5.3.0 2024-04
27
* Add async support
38
* Breaking change : config.AUTO_INSTALL_LABELS has been removed. Please use the neomodel_install_labels script instead

doc/requirements.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
sphinx_copybutton
2-
neo4j==5.10.0
3-
pytz>=2021.1
4-
neobolt==1.7.17
5-
six==1.16.0
2+
neo4j~=5.19.0
63

doc/source/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Adjust driver configuration - these options are only available for this connecti
3232
config.MAX_TRANSACTION_RETRY_TIME = 30.0 # default
3333
config.RESOLVER = None # default
3434
config.TRUST = neo4j.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES # default
35-
config.USER_AGENT = neomodel/v5.3.0 # default
35+
config.USER_AGENT = neomodel/v5.3.1 # default
3636

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

doc/source/getting_started.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,24 @@ After executing, it will print all indexes and constraints it has removed.
134134
Ommitting the ``--db`` argument will default to the ``NEO4J_BOLT_URL`` environment variable. This is useful for masking
135135
your credentials.
136136

137+
Generate class diagram
138+
======================
139+
You can generate a class diagram of your models using the ``neomodel_generate_diagram`` command::
140+
141+
$ neomodel_generate_diagram models/my_models.py --file-type arrows --write-to-dir img
142+
143+
You must specify a directory in which to lookup neomodel classes (nodes and rels). Typing '.' will search in your whole directory.
144+
145+
You have the option to generate the diagram in different file types using ``--file-type`` : ``arrows``, ``puml`` (which uses the dot notation).
146+
147+
Ommitting the ``--write-to-dir`` option will default to the current directory.
148+
149+
.. note::
150+
151+
Property types and the presence of indexes, constraints and required rules will be displayed on the nodes.
152+
153+
Relationship properties are not supported in the diagram generation.
154+
137155
Create, Update, Delete operations
138156
=================================
139157

doc/source/module_documentation.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ Scripts
3232
:undoc-members:
3333
:show-inheritance:
3434

35+
.. automodule:: neomodel.scripts.neomodel_generate_diagram
36+
:members:
37+
:undoc-members:
38+
:show-inheritance:
39+
3540
.. automodule:: neomodel.scripts.neomodel_install_labels
3641
:members:
3742
:undoc-members:

model_diagram.json

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
{
2+
"style": {
3+
"node-color": "#ffffff",
4+
"border-color": "#000000",
5+
"caption-color": "#000000",
6+
"arrow-color": "#000000",
7+
"label-background-color": "#ffffff",
8+
"directionality": "directed",
9+
"arrow-width": 5
10+
},
11+
"nodes": [
12+
{
13+
"id": "n0",
14+
"position": {
15+
"x": 0,
16+
"y": 0
17+
},
18+
"caption": "",
19+
"style": {},
20+
"labels": [
21+
"Claim"
22+
],
23+
"properties": {
24+
"uid": "str - unique",
25+
"content": "str",
26+
"claim_number": "int",
27+
"embedding": "list[float]"
28+
}
29+
},
30+
{
31+
"id": "n1",
32+
"position": {
33+
"x": 346.4101615137755,
34+
"y": 199.99999999999997
35+
},
36+
"caption": "",
37+
"style": {},
38+
"labels": [
39+
"Inventor"
40+
],
41+
"properties": {
42+
"name": "str - index"
43+
}
44+
},
45+
{
46+
"id": "n2",
47+
"position": {
48+
"x": 2.4492935982947064e-14,
49+
"y": 400.0
50+
},
51+
"caption": "",
52+
"style": {},
53+
"labels": [
54+
"Applicant"
55+
],
56+
"properties": {
57+
"name": "str - index"
58+
}
59+
},
60+
{
61+
"id": "n3",
62+
"position": {
63+
"x": -346.4101615137754,
64+
"y": 200.00000000000014
65+
},
66+
"caption": "",
67+
"style": {},
68+
"labels": [
69+
"Owner"
70+
],
71+
"properties": {
72+
"name": "str - index"
73+
}
74+
},
75+
{
76+
"id": "n4",
77+
"position": {
78+
"x": -346.4101615137755,
79+
"y": -199.99999999999991
80+
},
81+
"caption": "",
82+
"style": {},
83+
"labels": [
84+
"CPC"
85+
],
86+
"properties": {
87+
"symbol": "str - unique"
88+
}
89+
},
90+
{
91+
"id": "n5",
92+
"position": {
93+
"x": -7.347880794884119e-14,
94+
"y": -400.0
95+
},
96+
"caption": "",
97+
"style": {},
98+
"labels": [
99+
"IPCR"
100+
],
101+
"properties": {
102+
"symbol": "str - unique"
103+
}
104+
},
105+
{
106+
"id": "n6",
107+
"position": {
108+
"x": 346.41016151377534,
109+
"y": -200.00000000000017
110+
},
111+
"caption": "",
112+
"style": {},
113+
"labels": [
114+
"Description"
115+
],
116+
"properties": {
117+
"uid": "str - unique",
118+
"content": "str"
119+
}
120+
},
121+
{
122+
"id": "n7",
123+
"position": {
124+
"x": 1146.4101615137754,
125+
"y": 0
126+
},
127+
"caption": "",
128+
"style": {},
129+
"labels": [
130+
"Abstract"
131+
],
132+
"properties": {
133+
"uid": "str - unique",
134+
"content": "str"
135+
}
136+
},
137+
{
138+
"id": "n8",
139+
"position": {
140+
"x": -399.99999999999983,
141+
"y": 692.820323027551
142+
},
143+
"caption": "",
144+
"style": {},
145+
"labels": [
146+
"Patent"
147+
],
148+
"properties": {
149+
"uid": "str - unique",
150+
"docdb_id": "str",
151+
"earliest_claim_date": "date",
152+
"status": "str",
153+
"application_date": "date",
154+
"granted": "str",
155+
"discontinuation_date": "date",
156+
"kind": "str",
157+
"doc_number": "str",
158+
"title": "str",
159+
"grant_date": "date",
160+
"language": "str",
161+
"publication_date": "date",
162+
"doc_key": "str",
163+
"application_number": "str"
164+
}
165+
}
166+
],
167+
"relationships": [
168+
{
169+
"id": "e0",
170+
"type": "HAS_INVENTOR",
171+
"style": {},
172+
"properties": {},
173+
"fromId": "n8",
174+
"toId": "n2"
175+
},
176+
{
177+
"id": "e1",
178+
"type": "HAS_APPLICANT",
179+
"style": {},
180+
"properties": {},
181+
"fromId": "n8",
182+
"toId": "n3"
183+
},
184+
{
185+
"id": "e2",
186+
"type": "HAS_CPC",
187+
"style": {},
188+
"properties": {},
189+
"fromId": "n8",
190+
"toId": "n5"
191+
},
192+
{
193+
"id": "e3",
194+
"type": "HAS_DESCRIPTION",
195+
"style": {},
196+
"properties": {},
197+
"fromId": "n8",
198+
"toId": "n7"
199+
},
200+
{
201+
"id": "e4",
202+
"type": "HAS_ABSTRACT",
203+
"style": {},
204+
"properties": {},
205+
"fromId": "n8",
206+
"toId": "n8"
207+
},
208+
{
209+
"id": "e5",
210+
"type": "SIMPLE_FAMILY",
211+
"style": {},
212+
"properties": {},
213+
"fromId": "n8",
214+
"toId": "n0"
215+
},
216+
{
217+
"id": "e6",
218+
"type": "EXTENDED_FAMILY",
219+
"style": {},
220+
"properties": {},
221+
"fromId": "n8",
222+
"toId": "n0"
223+
},
224+
{
225+
"id": "e7",
226+
"type": "HAS_OWNER",
227+
"style": {},
228+
"properties": {},
229+
"fromId": "n8",
230+
"toId": "n4"
231+
},
232+
{
233+
"id": "e8",
234+
"type": "HAS_CLAIM",
235+
"style": {},
236+
"properties": {},
237+
"fromId": "n8",
238+
"toId": "n1"
239+
}
240+
]
241+
}

model_diagram.puml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@startuml
2+
digraph G {
3+
node [shape=record];
4+
Patent [label="Patent|{}}"];
5+
Patent -> Inventor [label="has_inventor: RelationshipTo"];
6+
Patent -> Applicant [label="has_applicant: RelationshipTo"];
7+
Patent -> CPC [label="has_cpc: RelationshipTo"];
8+
Patent -> Description [label="has_description: RelationshipTo"];
9+
Patent -> Abstract [label="has_abstract: RelationshipTo"];
10+
Patent -> Patent [label="simple_family: RelationshipTo"];
11+
Patent -> Patent [label="extended_family: RelationshipTo"];
12+
Patent -> Owner [label="has_owner: RelationshipTo"];
13+
Patent -> Claim [label="has_claim: RelationshipTo"];
14+
Claim [label="Claim|{}}"];
15+
Inventor [label="Inventor|{}}"];
16+
Applicant [label="Applicant|{}}"];
17+
Owner [label="Owner|{}}"];
18+
CPC [label="CPC|{}}"];
19+
IPCR [label="IPCR|{}}"];
20+
Description [label="Description|{}}"];
21+
Abstract [label="Abstract|{}}"];
22+
}@enduml

neomodel/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "5.3.0"
1+
__version__ = "5.3.1"

neomodel/async_/core.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,13 +936,11 @@ def __init__(self, db: AsyncDatabase, access_mode=None):
936936

937937
@ensure_connection
938938
async def __aenter__(self):
939-
print("aenter called")
940939
await self.db.begin(access_mode=self.access_mode, bookmarks=self.bookmarks)
941940
self.bookmarks = None
942941
return self
943942

944943
async def __aexit__(self, exc_type, exc_value, traceback):
945-
print("aexit called")
946944
if exc_value:
947945
await self.db.rollback()
948946

@@ -962,7 +960,6 @@ def __call__(self, func):
962960
@wraps(func)
963961
async def wrapper(*args, **kwargs):
964962
async with self:
965-
print("call called")
966963
return await func(*args, **kwargs)
967964

968965
return wrapper

0 commit comments

Comments
 (0)