Skip to content

Commit e3ce68e

Browse files
Merge pull request #101 from neo4j-contrib/rc/0.2.0
Version 0.2.0 2024-05 * Bump neomodel to 5.3.0 * Bump Django to 4.2.8 LTS
2 parents 1cd1bcc + 2cfdcd4 commit e3ce68e

File tree

12 files changed

+94
-109
lines changed

12 files changed

+94
-109
lines changed

.github/workflows/integration-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Integration tests
55

66
on:
77
push:
8-
branches: [ "master", "rc/**" ]
8+
branches: [ "rc/**" ]
99
pull_request:
1010
branches: [ "master", "rc/**" ]
1111

@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: ["3.11", "3.10", "3.9", "3.8", "3.7"]
18+
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"]
1919
neo4j-version: ["community", "4.4-community"]
2020

2121
steps:

Changelog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Version 0.2.0 2024-05
2+
* Bump neomodel to 5.3.0
3+
* Bump Django to 4.2.8 LTS
4+
15
Version 0.1.1 2023-08
26
* Bump neomodel to 5.1.0 - full support of Neo4j version 5.x (and 4.4 LTS)
37
* Support higher versions of Django (> 2.2)

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include README.rst
1+
include README.md
22
include AUTHORS.txt
33
include Changelog
44
include LICENSE

README.rst renamed to README.md

Lines changed: 33 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
1-
Django Neomodel (beta!)
2-
=======================
1+
# Django Neomodel (beta!)
32

4-
.. image:: https://raw.githubusercontent.com/robinedwards/neomodel/master/doc/source/_static/neomodel-300.png
5-
:alt: neomodel
3+
![neomodel](https://raw.githubusercontent.com/neo4j-contrib/neomodel/master/doc/source/_static/neomodel-300.png)
64

7-
This module allows you to use the neo4j_ graph database with Django using neomodel_
5+
This module allows you to use the [neo4j](https://www.neo4j.org) graph database with Django using [neomodel](http://neomodel.readthedocs.org)
86

9-
.. _neo4j: https://www.neo4j.org
10-
.. _neomodel: http://neomodel.readthedocs.org
117

12-
Warnings
13-
=======================
8+
## Warnings
149

15-
* Admin functionality is very experimental. `Please see todos / issues here <https://github.com/neo4j-contrib/django-neomodel/projects/1>`_
10+
* Admin functionality is very experimental. [Please see todos / issues here](https://github.com/neo4j-contrib/django-neomodel/projects/1)
1611

17-
Live Examples (add yours here)
18-
===============================
12+
## Live Examples (add yours here)
1913

20-
* `ResoTrack <https://resotrack.herokuapp.com/>`_
14+
* [Syracuse](https://syracuse.1145.am>): a database of company linkages created from unstructured text. Repo at [syracuse-neo](https://github.com/alanbuxton/syracuse-neo.git)
2115

22-
Getting started
23-
===============
16+
# Getting started
2417

25-
Install the module::
18+
Install the module:
2619

2720
$ pip install django_neomodel
2821

29-
Add the following settings to your `settings.py`::
22+
Add the following settings to your `settings.py`:
3023

3124
NEOMODEL_NEO4J_BOLT_URL = os.environ.get('NEO4J_BOLT_URL', 'bolt://neo4j:foobarbaz@localhost:7687')
3225

@@ -37,7 +30,7 @@ Add the following settings to your `settings.py`::
3730
'yourapp'
3831
)
3932

40-
Write your first node definition in `yourapp/models.py`::
33+
Write your first node definition in `yourapp/models.py`:
4134

4235
from neomodel import StructuredNode, StringProperty, DateProperty
4336

@@ -46,18 +39,18 @@ Write your first node definition in `yourapp/models.py`::
4639
published = DateProperty()
4740

4841
Create any constraints or indexes for your labels. This needs to be done after you change your node definitions
49-
much like `manage.py migrate`::
42+
much like `manage.py migrate`:
5043

5144
$ python manage.py install_labels
5245

53-
Now in a view `yourapp/views.py`::
46+
Now in a view `yourapp/views.py`:
5447

5548
from .models import Book
5649

5750
def get_books(request):
5851
return render('yourapp/books.html', request, {'books': Book.nodes.all()})
5952

60-
In your `yourapp/admin.py`::
53+
In your `yourapp/admin.py`:
6154

6255
from django_neomodel import admin as neo_admin
6356
from .models import Book
@@ -68,10 +61,9 @@ In your `yourapp/admin.py`::
6861

6962
And you're ready to go. Don't forget to check the neomodel_ documentation.
7063

71-
Model forms
72-
===========
64+
## Model forms
7365

74-
Switch the base class from `StructuredNode` to `DjangoNode` and add a 'Meta' class::
66+
Switch the base class from `StructuredNode` to `DjangoNode` and add a 'Meta' class:
7567

7668
from datetime import datetime
7769
from django_neomodel import DjangoNode
@@ -90,7 +82,7 @@ Switch the base class from `StructuredNode` to `DjangoNode` and add a 'Meta' cla
9082
class Meta:
9183
app_label = 'library'
9284

93-
Create a model form class for your `DjangoNode`::
85+
Create a model form class for your `DjangoNode`:
9486

9587
class BookForm(ModelForm):
9688
class Meta:
@@ -99,19 +91,17 @@ Create a model form class for your `DjangoNode`::
9991

10092
This class may now be used just like any other Django form.
10193

102-
Settings
103-
========
94+
## Settings
10495
The following config options are available in django settings (default values shown).
105-
These are mapped to neomodel.config as django is started::
96+
These are mapped to neomodel.config as django is started:
10697

10798
NEOMODEL_NEO4J_BOLT_URL = 'bolt://neo4j:neo4j@localhost:7687'
10899
NEOMODEL_SIGNALS = True
109100
NEOMODEL_FORCE_TIMEZONE = False
110101
NEOMODEL_MAX_CONNECTION_POOL_SIZE = 50
111102

112-
Signals
113-
=======
114-
Signals work with `DjangoNode` sub-classes::
103+
## Signals
104+
Signals work with `DjangoNode` sub-classes:
115105

116106
from django.db.models import signals
117107
from django_neomodel import DjangoNode
@@ -128,10 +118,9 @@ Signals work with `DjangoNode` sub-classes::
128118
The following are supported: `pre_save`, `post_save`, `pre_delete`, `post_delete`.
129119
On freshly created nodes `created=True` in the `post_save` signal argument.
130120

131-
Testing
132-
=======
121+
## Testing
133122

134-
You can create a setup method which clears the database before executing each test::
123+
You can create a setup method which clears the database before executing each test:
135124

136125
from neomodel import db, clear_neo4j_database
137126

@@ -142,14 +131,12 @@ You can create a setup method which clears the database before executing each te
142131
def test_something(self):
143132
pass
144133

145-
Management Commands
146-
===================
134+
## Management Commands
147135

148136
The following django management commands have been included.
149137

150-
install_labels
151-
--------------
152-
Setup constraints and indexes on labels for your node definitions. This should be executed after any schema changes::
138+
### install_labels
139+
Setup constraints and indexes on labels for your node definitions. This should be executed after any schema changes:
153140

154141
$ python manage.py install_labels
155142
Setting up labels and constraints...
@@ -158,27 +145,19 @@ Setup constraints and indexes on labels for your node definitions. This should b
158145
+ Creating unique constraint for title on label Book for class tests.someapp.models.Book
159146
Finished 1 class(es).
160147

161-
clear_neo4j
162-
-----------
148+
### clear_neo4j
163149
Delete all nodes in your database, warning there is no confirmation!
164150

165-
Requirements
166-
============
151+
## Requirements
167152

168-
- Python 3.7+
153+
- Python 3.8+
169154
- neo4j 5.x, 4.4 (LTS)
170155

171-
.. image:: https://badges.gitter.im/Join%20Chat.svg
172-
:alt: Join the chat at https://gitter.im/robinedwards/neomodel
173-
:target: https://gitter.im/robinedwards/neomodel?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
174-
175-
Docker Example
176-
===================
177-
156+
## Docker Example
178157

179158
Using Docker Compose.
180159

181-
Commands to setup Docker Container docker-entrypoint.sh::
160+
Commands to setup Docker Container docker-entrypoint.sh:
182161

183162
# Go to tests
184163
$ cd tests/
@@ -191,12 +170,11 @@ Go to http://localhost:7474/browser/
191170
Go to http://localhost:8000/admin/
192171

193172

194-
Running Tests
195-
===================
173+
## Running Tests
196174

197175
Setup Neo4j Desktop with a local database with password 'foobarbaz' and version 5.x or 4.4.x (Neo4j LTS version).
198176

199-
Commands to run tests::
177+
Commands to run tests:
200178

201179
# create local venv and install dependencies.
202180
$ pip install -e '.[dev]'; export DJANGO_SETTINGS_MODULE=tests.settings;

django_neomodel/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
from django.core.exceptions import ValidationError
99

1010
from neomodel import RequiredProperty, DeflateError, StructuredNode, UniqueIdProperty
11-
from neomodel.core import NodeMeta
12-
from neomodel.match import NodeSet
11+
from neomodel.sync_.core import NodeMeta
12+
from neomodel.sync_.match import NodeSet
1313

1414

1515
__author__ = "Robin Edwards"
1616
__email__ = "[email protected]"
1717
__license__ = "MIT"
1818
__package__ = "django_neomodel"
19-
__version__ = "0.1.1"
19+
__version__ = "0.2.0"
2020

2121

2222
default_app_config = "django_neomodel.apps.NeomodelConfig"

django_neomodel/apps.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
from neomodel import config
44

55

6-
config.AUTO_INSTALL_LABELS = False
7-
8-
96
class NeomodelConfig(AppConfig):
10-
name = 'django_neomodel'
11-
verbose_name = 'Django neomodel'
7+
name = "django_neomodel"
8+
verbose_name = "Django neomodel"
129

1310
def read_settings(self):
14-
config.DATABASE_URL = getattr(settings, 'NEOMODEL_NEO4J_BOLT_URL', config.DATABASE_URL)
15-
config.FORCE_TIMEZONE = getattr(settings, 'NEOMODEL_FORCE_TIMEZONE', False)
16-
config.MAX_CONNECTION_POOL_SIZE = getattr(settings, 'NEOMODEL_MAX_CONNECTION_POOL_SIZE', config.MAX_CONNECTION_POOL_SIZE)
11+
config.DATABASE_URL = getattr(
12+
settings, "NEOMODEL_NEO4J_BOLT_URL", config.DATABASE_URL
13+
)
14+
config.FORCE_TIMEZONE = getattr(settings, "NEOMODEL_FORCE_TIMEZONE", False)
15+
config.MAX_CONNECTION_POOL_SIZE = getattr(
16+
settings,
17+
"NEOMODEL_MAX_CONNECTION_POOL_SIZE",
18+
config.MAX_CONNECTION_POOL_SIZE,
19+
)
1720

1821
def ready(self):
1922
self.read_settings()

pyproject.toml

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@ where = ["./"]
99

1010
[project]
1111
name = "django_neomodel"
12-
authors = [
13-
{name = "Robin Edwards", email = "[email protected]"},
14-
]
15-
maintainers = [
16-
{name = "Athanasios Anastasiou", email = "[email protected]"},
17-
{name = "Cristina Escalante"},
18-
{name = "Marius Conjeaud", email = "[email protected]"},
19-
]
12+
authors = [{name = "Robin Edwards", email = "[email protected]"}]
13+
maintainers = [{name = "Marius Conjeaud", email = "[email protected]"}]
2014
description = "Use Neo4j with Django!"
21-
readme = "README.rst"
22-
requires-python = ">=3.7"
15+
readme = "README.md"
16+
requires-python = ">=3.8"
2317
keywords = ["graph", "neo4j", "django", "plugin", "neomodel"]
24-
license = {text = "MIT"}
18+
license = { text = "MIT" }
2519
classifiers = [
2620
"Development Status :: 4 - Beta",
2721
'Intended Audience :: Developers',
@@ -33,18 +27,18 @@ classifiers = [
3327
"Topic :: Database",
3428
]
3529
dependencies = [
36-
"neomodel~=5.1.0",
37-
'django>=2.2'
30+
"neomodel~=5.3.0",
31+
'django>=4.2.8'
3832
]
39-
version='0.1.1'
33+
version='0.2.0'
4034

4135
[project.urls]
4236
repository = "http://github.com/robinedwards/django-neomodel"
4337

4438
[project.optional-dependencies]
4539
dev = [
4640
"pytest>=7.1",
47-
"pytest-django>=3.10.0",
41+
"pytest-django>=4.5.2",
4842
"pytest-cov>=4.0",
4943
]
5044

requirements-dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pytest>=7.1
2+
pytest-django>=4.5.2
3+
pytest-cov>=4.0

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
neomodel~=5.3.0
2+
django~=4.2.8

test.db

8 KB
Binary file not shown.

0 commit comments

Comments
 (0)