Skip to content

Commit 9e859ab

Browse files
NetworkX and Pandas are optional dependencies for experimental tools
1 parent 86efc22 commit 9e859ab

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ Currently, it provides numerous methods for retrieving nodes, and a few for retr
1616

1717
[Quickstart example](https://django-postgresql-dag.readthedocs.io/en/latest/quickstart.html)
1818

19+
## Install
20+
21+
pip install django-postgresql-dag
22+
23+
With optional dependencies for using transformations:
24+
25+
pip install django-postgresql-dag[transforms]
26+
1927

2028
## ToDo
2129

@@ -29,4 +37,3 @@ Currently, it provides numerous methods for retrieving nodes, and a few for retr
2937
2. [django-dag](https://pypi.org/project/django-dag/)
3038
3. [django-dag-postgresql](https://github.com/worsht/django-dag-postgresql)
3139
4. [django-treebeard-dag](https://pypi.org/project/django-treebeard-dag/)
32-

django_postgresql_dag/transformations.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
django-postgresql-dag to alternate formats.
44
"""
55

6+
from itertools import chain
7+
8+
import networkx as nx
9+
import pandas as pd
610
from django.core.exceptions import FieldDoesNotExist
711
from django.db.models import Case, When
812
from django.db.models.fields import DateTimeField, UUIDField
9-
from django.db.models.fields.files import ImageField, FileField
13+
from django.db.models.fields.files import FileField, ImageField
1014
from django.db.models.fields.related import ManyToManyField
1115

12-
from .exceptions import GraphModelsCannotBeParsedException, IncorrectUsageException
13-
14-
from itertools import chain
15-
import networkx as nx
16+
from .exceptions import (GraphModelsCannotBeParsedException,
17+
IncorrectUsageException)
1618

1719

1820
def _ordered_filter(queryset, field_names, values):
@@ -203,6 +205,8 @@ def nx_from_queryset(
203205
graph_attributes_dict: A dictionary of attributes to add to the graph itself
204206
node_attribute_fields_list: a list of strings of field names to be added to nodes
205207
edge_attribute_fields_list: a list of strings of field names to be added to edges
208+
date_strf: if any provided fields are date-like, how should they be formatted?
209+
digraph: bool to determine whether to output a directed or undirected graph
206210
"""
207211
_NodeModel, _EdgeModel, queryset_type = get_queryset_characteristics(queryset)
208212

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,7 @@
4545
classifiers=classifiers,
4646
long_description_content_type="text/markdown",
4747
long_description=long_desc,
48+
extras_require = {
49+
'transforms': ['networkx>=2.5', 'pandas>=1.2']
50+
}
4851
)

0 commit comments

Comments
 (0)