Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rc/5.3.1 #805

Merged
merged 30 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
90fc60d
Init rc 5.3.1
Apr 26, 2024
9d2d993
Merge remote-tracking branch 'origin/master' into rc/5.3.1
Apr 26, 2024
95de7f2
Remove testing prints
May 2, 2024
0af5be9
Fix doc version
May 3, 2024
cf2c22a
Fix test collection - missing scripts
May 6, 2024
a12def2
Fix bug where inspect database script only returns one rel for each l…
May 6, 2024
982114b
Fix test collection - was skipping test_contrib
May 6, 2024
47f1665
Merge pull request #794 from neo4j-contrib/bug/781-inspect-multiple-rels
mariusconjeaud May 13, 2024
01c5b95
Add specs to codecov GH Action
May 22, 2024
834da62
Fix typo
May 22, 2024
35c35e6
Remove file spec
May 22, 2024
a37d127
Fix DateProperty but in inspection script
May 22, 2024
937ed29
Fix test data files
May 22, 2024
9304000
Merge pull request #797 from neo4j-contrib/796-neomodel_inspect_datab…
mariusconjeaud May 22, 2024
20f8d60
First stab at generating model diagrams
May 27, 2024
aaf6e52
Fix async node iterator
May 27, 2024
93e9c87
Housekeeping
May 27, 2024
a803874
Remove python2 print leftover
May 27, 2024
cf5deb4
Generate arrows and puml diagrams ; test for arrows
May 27, 2024
7ae255b
Merge pull request #802 from neo4j-contrib/task/clean-python2
mariusconjeaud May 27, 2024
98c5659
Fix diagram test
May 28, 2024
eb45ac1
Add properties to puml ; puml to tests
May 28, 2024
380bc1b
Update docs
May 28, 2024
f7dcdb5
Merge pull request #803 from neo4j-contrib/feature/diagram-script
mariusconjeaud May 28, 2024
fb1b72a
Improve test
May 28, 2024
5546640
Fix test
May 28, 2024
4db58a0
Fix test
May 28, 2024
5f58cc4
Merge pull request #800 from neo4j-contrib/798-async-iterating-over-n…
mariusconjeaud May 28, 2024
2d9f5e1
Improve test coverage
May 28, 2024
bf955df
Update Changelog
May 28, 2024
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
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
Loading