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

Begin loosening requirements #22

Merged
merged 13 commits into from
Oct 22, 2021
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand All @@ -27,7 +27,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e ".[sql]"
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

## **0.3.0**

> This version adds support for Gremlin-compatible graph databases, such as AWS Neptune, TinkerPop, Janus, etc, through the `GremlinBackend`.
> This version adds support for Gremlin-compatible graph databases, such as AWS Neptune, TinkerPop, Janus, etc, through the `GremlinBackend`, and loosens the requirements for the base installation of `grand-graph`. You can now install `grand-graph[sql]` or `grand-graph[dynamodb]` to get additional functionality (with additional dependencies).

- Improvements
- Backends
- Add `GremlinBackend` to the list of supported backends
- Housekeeping
- Removes sqlalchemy and boto3 from the list of requirements for the base install. You can now install these with `pip3 install grand-graph[sql]` or `[dyanmodb]`.

## **0.2.0**

Expand Down
2 changes: 1 addition & 1 deletion grand/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

_DEFAULT_BACKEND = NetworkXBackend

__version__ = "0.2.0"
__version__ = "0.2.1"


class Graph:
Expand Down
17 changes: 14 additions & 3 deletions grand/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
from .backend import Backend
from .dynamodb import DynamoDBBackend

try:
from .dynamodb import DynamoDBBackend
except ImportError:
pass
from .networkx import NetworkXBackend
from .sqlbackend import SQLBackend

# from .networkit import NetworkitBackend
try:
from .sqlbackend import SQLBackend
except ImportError:
pass

try:
from .networkit import NetworkitBackend
except ImportError:
pass
1 change: 0 additions & 1 deletion grand/backends/networkx.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Hashable, Generator, Iterable
import time

import boto3
import pandas as pd
import networkx as nx

Expand Down
57 changes: 41 additions & 16 deletions grand/backends/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@

import networkx as nx

from . import NetworkXBackend, SQLBackend, DynamoDBBackend
from . import NetworkXBackend

try:
from .dynamodb import DynamoDBBackend

_CAN_IMPORT_DYNAMODB = True
except ImportError:
_CAN_IMPORT_DYNAMODB = False

try:
from .sqlbackend import SQLBackend

_CAN_IMPORT_SQL = True
except ImportError:
_CAN_IMPORT_SQL = False

from .. import Graph


backend_test_params = [
pytest.param(
NetworkXBackend,
Expand All @@ -14,21 +30,30 @@
reason="NetworkX Backend skipped because $TEST_NETWORKXBACKEND != 0.",
),
),
pytest.param(
SQLBackend,
marks=pytest.mark.skipif(
os.environ.get("TEST_SQLBACKEND", default="1") != "1",
reason="SQL Backend skipped because $TEST_SQLBACKEND != 0.",
]

if _CAN_IMPORT_DYNAMODB:
backend_test_params.append(
pytest.param(
DynamoDBBackend,
marks=pytest.mark.skipif(
os.environ.get("TEST_DYNAMODB", default="1") != "1",
reason="DynamoDB Backend skipped because $TEST_DYNAMODB != 0 or boto3 is not installed",
),
),
),
pytest.param(
DynamoDBBackend,
marks=pytest.mark.skipif(
os.environ.get("TEST_DYNAMODBBACKEND") != "1",
reason="DynamoDB Backend skipped because $TEST_DYNAMODBBACKEND != 0.",
)

if _CAN_IMPORT_SQL:
backend_test_params.append(
pytest.param(
SQLBackend,
marks=pytest.mark.skipif(
os.environ.get("TEST_SQLBACKEND", default="1") != "1"
or not _CAN_IMPORT_SQL,
reason="SQL Backend skipped because $TEST_SQLBACKEND != 0 or sqlalchemy is not installed.",
),
),
),
]
)

if os.environ.get("TEST_NETWORKITBACKEND") == "1":
from .networkit import NetworkitBackend
Expand Down Expand Up @@ -93,7 +118,7 @@ def test_can_get_node(self, backend):
def test_can_get_edge(self, backend):
G = Graph(backend=backend())
nxG = nx.Graph()
md = {"k":"B"}
md = {"k": "B"}
G.nx.add_edge("A", "B", **md)
nxG.add_edge("A", "B", **md)
assert G.nx.get_edge_data("A", "B") == nxG.get_edge_data("A", "B")
Expand Down Expand Up @@ -130,7 +155,7 @@ def test_undirected_adj(self, backend):
assert G.nx._adj == nxG._adj

def test_directed_adj(self, backend):
G = Graph(backend=SQLBackend(directed=True))
G = Graph(backend=backend(directed=True))
nxG = nx.DiGraph()
assert G.nx._adj == nxG._adj
G.nx.add_edge("A", "B")
Expand Down
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

15 changes: 8 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
with open("README.md", "r") as fh:
long_description = fh.read()

["sqlalchemy"]

setuptools.setup(
name="grand-graph",
version="0.2.0",
version="0.2.1",
author="Jordan Matelsky",
author_email="[email protected]",
description="Graph database wrapper for non-graph datastores",
Expand All @@ -16,12 +15,14 @@
url="https://github.com/aplbrain/grand",
packages=setuptools.find_packages(),
install_requires=[
"boto3",
"networkx==2.4",
"numpy==1.19.1",
"pandas==1.1.0",
"SQLAlchemy==1.3.18",
"networkx>=2.4",
"numpy",
"pandas",
],
extra_requires={
"sql": ["SQLAlchemy>=1.3"],
"dynamodb": ["boto3"],
},
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
Expand Down