{ "info": { "author": "Troy Larson", "author_email": "troylar@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Graph Runner (ALPHA)\n## Overview\n`graph-runner` provides a way to add actual Python code to Graph DB nodes, which can be used to create real-time dynamically property values. Rather than only storing fixed values, you have the option to create rich property values that can be calculated on-the-fly with other vertex property values.\n\n> **IMPORTANT:** This codebase currently uses the `exec()` method to execute Python code. This was\n> used for sake of time since this was built for a specific trusted project. Ideally, a more secure\n> method should be used, but just be aware that arbitrary code can be executed.\n\n## Quick Start\nTo install `graph-runner`:\n\n pip install graph-runner\n\nWhile there's no full documentation yet, here's a code sample that walks you through the majority of the current features. Make sure that you export a CONN_STR environment variable that matches your connections string.\n\nThe only code this does not show is the [https://github.com/troylar/graph-runner/blob/master/entities/__init__.py](https://github.com/troylar/graph-runner/blob/master/entities/__init__.py \"custom entities\"). Each custom entity maps to a node type. You simply have to define the `exec_properties` in the class definition, which define which properties that contain executable code.\n\n```python\nfrom gremlin_python import statics\nfrom gremlin_python.structure.graph import Graph\nfrom gremlin_python.process.graph_traversal import __\nfrom gremlin_python.process.strategies import *\nfrom gremlin_python.driver.driver_remote_connection import DriverRemoteConnection\nfrom graph_entity import GraphEntity\nfrom entities import EventEntity, PersonEntity\nimport os\n\ngraph = Graph()\n\ng = graph.traversal().withRemote(DriverRemoteConnection(os.environ.get('CONN_STR'),'g'))\n\n# We're going to add an entity to the graph\nfirst_event = EventEntity(Traversal=g)\nprint('Adding node')\n\n# add_node() returns a traversal, so we have to next()\nfirst_event.add_node().next()\n\n# Now we're going to add a dynamic property called 'ignore_if' with a simple boolean piece of code\n# NOTE: exec_val is always required as the return value\nfirst_event.ignore_if = 'exec_val=1==1'\n\n# print the id\nprint('Node id = {}'.format(first_event.id))\n\n# print the node type, which maps to the EventEntity class and is saved as a property in the graph\nprint('Node type: {}'.format(first_event.full_self()))\n\n# this is where it gets cool . . . the ignore_if property method was dynamically added to the python object\n# and when you access the property, it executes the code and returns the value\nprint('ignore_if property: {}'.format(first_event.ignore_if()))\n\n# now let's create a GraphEntity object and from scratch, load the node we just created\nge = GraphEntity(Traversal=g)\nprint('Getting node')\nnode = ge.from_node(first_event.id)\nprint('Node id = {}'.format(node.id))\nprint('Node type: {}'.format(node.full_self()))\nprint('ignore_if property: {}'.format(node.ignore_if()))\n\n# let's create a person entity with an 'is_present' property\npe = PersonEntity(Traversal=g)\nprint('Adding person')\npe.add_node().next()\npe.is_present = 'True'\n\n# let's create a second event\nsecond_event = EventEntity(Traversal=g)\nprint('Adding another event')\nsecond_event.add_node().next()\n\n# let's add some more complex logic to a property\n# this property is saying that if the person is present, move to the next event\nnext_node_code = \"\"\"\nfrom graph_entity import GraphEntity\nge = GraphEntity(Traversal=g)\n\nif ge.from_node('{}').is_present()=='True':\n exec_val = g.V('{}')\nelse:\n exec_val = \"N/A\"\n\"\"\".format(pe.id, second_event.id)\n\n# because is_present is true, we get our next node\nfirst_event.next_node = next_node_code\nprint(first_event.next_node())\n\n# change is_present to false, and the next_node is N/A\npe.is_present = 'False'\nprint(first_event.next_node())\n\n# we can also use jinja2 templating, which allows us to pass in dynamic values at run-time\n# in this case, it's the same code, but we we're alloing the ids to be passed in at run-time\nnext_node_template = \"\"\"\nfrom graph_entity import GraphEntity\nge = GraphEntity(Traversal=g)\n\nif ge.from_node('{{ person_node_id }}').is_present()=='True':\n exec_val = g.V('{{ next_node_id }}')\nelse:\n exec_val = \"N/A\"\n\"\"\"\n\n # run the same code, but pass ids at run-time\nfirst_event.next_node = next_node_template\npe.is_present = 'True'\nprint(first_event.next_node(Data={'person_node_id': pe.id, 'next_node_id': second_event.id}))\n\npe.is_present = 'False'\nprint(first_event.next_node(Data={'person_node_id': pe.id, 'next_node_id': second_event.id}))\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/troylar/graph-runner", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "graph-runner", "package_url": "https://pypi.org/project/graph-runner/", "platform": "", "project_url": "https://pypi.org/project/graph-runner/", "project_urls": { "Homepage": "https://github.com/troylar/graph-runner" }, "release_url": "https://pypi.org/project/graph-runner/0.0.15/", "requires_dist": null, "requires_python": "", "summary": "Run your graphs in code", "version": "0.0.15" }, "last_serial": 4627023, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "19a50a7051897feea3aa8984f7cba4f7", "sha256": "a0d1fffb4313a01026cd4ad4b626c2ff6b5a11f6eca1b6ea4af8e7e9956d426b" }, "downloads": -1, "filename": "graph_runner-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "19a50a7051897feea3aa8984f7cba4f7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2256, "upload_time": "2018-09-28T21:18:38", "url": "https://files.pythonhosted.org/packages/ef/ec/f658abf63916152647842454733b9b231825c787c693e04fbcaf60cce7f5/graph_runner-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5c7a37120e568b0c7420724314fc597e", "sha256": "38eaab08e01a34760a879ec7765c87126fac39aac8061b14fcf67156e044fe63" }, "downloads": -1, "filename": "graph-runner-0.0.1.tar.gz", "has_sig": false, "md5_digest": "5c7a37120e568b0c7420724314fc597e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2945, "upload_time": "2018-09-28T21:18:40", "url": "https://files.pythonhosted.org/packages/4a/09/7d8182434845db4699ad38c399d1956b9163a571364b72aa86d128202a23/graph-runner-0.0.1.tar.gz" } ], "0.0.10": [ { "comment_text": "", "digests": { "md5": "37cc5fec3a2975f49cb7086655d505ec", "sha256": "35b6a12973a1972f3989a2633e7fa525dde9ce32f3a21bb2826a9dfe849f3e47" }, "downloads": -1, "filename": "graph-runner-0.0.10.tar.gz", "has_sig": false, "md5_digest": "37cc5fec3a2975f49cb7086655d505ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6733, "upload_time": "2018-10-01T11:44:56", "url": "https://files.pythonhosted.org/packages/dc/6d/98ec1d88338c164ae3308898d9aa4e940ca27c47eff11c6258056811f4aa/graph-runner-0.0.10.tar.gz" } ], "0.0.11": [ { "comment_text": "", "digests": { "md5": "5b6e41d4ae24413a2efedc25234dfc9a", "sha256": "1d4e63016a7779f6171d91ff6761b090c18ec7ec2a3a45d0acd0ac5d3094017a" }, "downloads": -1, "filename": "graph-runner-0.0.11.tar.gz", "has_sig": false, "md5_digest": "5b6e41d4ae24413a2efedc25234dfc9a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7685, "upload_time": "2018-10-01T20:20:09", "url": "https://files.pythonhosted.org/packages/dc/c3/f66baf0af3db5371f949207a7c7b57cb712fceb9b8c9f4f913dab7316659/graph-runner-0.0.11.tar.gz" } ], "0.0.12": [ { "comment_text": "", "digests": { "md5": "85fccac5ce26249eb4cc70347a26d7bb", "sha256": "93b10f32cb4d029b8fa15f9616ee9945f42afe320e326c7d4dc9e2fd65097a37" }, "downloads": -1, "filename": "graph-runner-0.0.12.tar.gz", "has_sig": false, "md5_digest": "85fccac5ce26249eb4cc70347a26d7bb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8019, "upload_time": "2018-10-04T13:57:06", "url": "https://files.pythonhosted.org/packages/ba/a9/6b921c0f05ab40f0a9f83f40752ba414f2002b1654833dd36b840f717cd3/graph-runner-0.0.12.tar.gz" } ], "0.0.13": [ { "comment_text": "", "digests": { "md5": "09358cd6388072ef65c0562997817b81", "sha256": "f0ce63ada80c4728997c96acec9e3a6272bda54074a4798b86fd205ebe1387f2" }, "downloads": -1, "filename": "graph-runner-0.0.13.tar.gz", "has_sig": false, "md5_digest": "09358cd6388072ef65c0562997817b81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8945, "upload_time": "2018-10-12T18:04:36", "url": "https://files.pythonhosted.org/packages/6b/4d/3ef5200f7bdad094c976821b70505afa0bf68991ac2dd382ddb76fda0a55/graph-runner-0.0.13.tar.gz" } ], "0.0.14": [ { "comment_text": "", "digests": { "md5": "24810dd9ebe9211ef74c4847699aaeb5", "sha256": "b19b204a90314902ec2895d9a47bdd294f674593d731fc7d377f29e83d072b88" }, "downloads": -1, "filename": "graph-runner-0.0.14.tar.gz", "has_sig": false, "md5_digest": "24810dd9ebe9211ef74c4847699aaeb5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9021, "upload_time": "2018-12-18T16:08:08", "url": "https://files.pythonhosted.org/packages/4f/c1/ed34e9b07a7c8e971926be2b1d67919fcf70c50a368983902be97e6658ab/graph-runner-0.0.14.tar.gz" } ], "0.0.15": [ { "comment_text": "", "digests": { "md5": "06c57e4a6a150b1a3066c4b310a09d33", "sha256": "450ef26c9f7d8ce1a58f5be553049d67fb3838d9cfaa746c585da9c6a7b72e47" }, "downloads": -1, "filename": "graph-runner-0.0.15.tar.gz", "has_sig": false, "md5_digest": "06c57e4a6a150b1a3066c4b310a09d33", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9036, "upload_time": "2018-12-22T02:12:01", "url": "https://files.pythonhosted.org/packages/74/de/b42a6e3c7232c3a84421ba21536000ff5103d296de0d040e417a6fddbead/graph-runner-0.0.15.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "422f25d6298bc1464a2102e4d563f9ce", "sha256": "70bcc6a8183f2d908a4005a41d1f635ff40b932abff0995bb56f38249081865f" }, "downloads": -1, "filename": "graph-runner-0.0.2.tar.gz", "has_sig": false, "md5_digest": "422f25d6298bc1464a2102e4d563f9ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4689, "upload_time": "2018-09-29T12:51:22", "url": "https://files.pythonhosted.org/packages/aa/7e/c8d767626021a584ad11becba2ff16d6edad9f6ac8da6b6f47cfd71db793/graph-runner-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4f6195b5a45b6edb112e990ea4a1cb36", "sha256": "bfa283d3e6df61053d1997943abd91c13f1b31e1ce1c45770d15ada0f7f4d72b" }, "downloads": -1, "filename": "graph-runner-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4f6195b5a45b6edb112e990ea4a1cb36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5717, "upload_time": "2018-09-29T15:37:02", "url": "https://files.pythonhosted.org/packages/94/6f/35261691923380e4c2c274c36831e77144d9f3f419793d78b2dd29285968/graph-runner-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "23c6d15f9cf4d0bef5d3fee76ea1502e", "sha256": "74f19e2e0f8bc6c9841abb00fecb4687521bc4f41cdf56e44247d2ad051fc9bf" }, "downloads": -1, "filename": "graph-runner-0.0.4.tar.gz", "has_sig": false, "md5_digest": "23c6d15f9cf4d0bef5d3fee76ea1502e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5865, "upload_time": "2018-09-30T13:23:52", "url": "https://files.pythonhosted.org/packages/81/f8/927c6ed64cd54c8457470e5eb7b5e804ed3da94b28b12e83d475443d3ad7/graph-runner-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "17996b47f2d7e9443afc8736ac77bd6f", "sha256": "3cac51ed5152f4498470b63d68f1bd5ceca7151843bff2ac4232a71b36424c76" }, "downloads": -1, "filename": "graph-runner-0.0.5.tar.gz", "has_sig": false, "md5_digest": "17996b47f2d7e9443afc8736ac77bd6f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6319, "upload_time": "2018-09-30T15:05:17", "url": "https://files.pythonhosted.org/packages/d1/b2/b746838fe7ebbe6b113df788d7a8d9cfde9e853d46cf300e1b0ac4ad27a7/graph-runner-0.0.5.tar.gz" } ], "0.0.5.dev0": [ { "comment_text": "", "digests": { "md5": "7aaaaf8fe720b46d769ea28062a3962b", "sha256": "f83d475299eb6d95ab453b618fbbcbe39362af43eb41bbeb1c738b290b0a017d" }, "downloads": -1, "filename": "graph-runner-0.0.5.dev0.tar.gz", "has_sig": false, "md5_digest": "7aaaaf8fe720b46d769ea28062a3962b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6328, "upload_time": "2018-09-30T15:05:02", "url": "https://files.pythonhosted.org/packages/4a/0e/a17016e94fd03474f97fe126f3a70188197172203efc1ba96b2eabc5cde7/graph-runner-0.0.5.dev0.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "5100662898ebf220a10a3a3aa78fbbf1", "sha256": "c00a8096e36a0c4408997fbdfbc27abe7023cea1f49b677ea735f40b55ffb4c7" }, "downloads": -1, "filename": "graph-runner-0.0.6.tar.gz", "has_sig": false, "md5_digest": "5100662898ebf220a10a3a3aa78fbbf1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6502, "upload_time": "2018-09-30T15:12:50", "url": "https://files.pythonhosted.org/packages/4a/8a/737bc069b06c2903eb4f94d4e96a60954d547117e9d05cf084059801670c/graph-runner-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "217ef8a95d576c44edfa63827fdc16ed", "sha256": "c148c5887964379f2f143f9327ddf0dfab3cd40785a9c66a3c71670d2cc27662" }, "downloads": -1, "filename": "graph-runner-0.0.7.tar.gz", "has_sig": false, "md5_digest": "217ef8a95d576c44edfa63827fdc16ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6554, "upload_time": "2018-09-30T15:41:38", "url": "https://files.pythonhosted.org/packages/81/86/c87f785aa7f6e2d661358a1d6da8c1e615c13637cdf5f3ca5ce34db1c0c5/graph-runner-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "c368cfa845fb53dbf14c54963b8a63ae", "sha256": "ee11a131c43f46ec2aec9c637d3e1c8d8918704c92a64633f791e0df5c892f6d" }, "downloads": -1, "filename": "graph-runner-0.0.8.tar.gz", "has_sig": false, "md5_digest": "c368cfa845fb53dbf14c54963b8a63ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6553, "upload_time": "2018-09-30T17:40:04", "url": "https://files.pythonhosted.org/packages/59/e4/a315575c96465a122ec425523d3eb234e327df1ba5ddbce806344a7ff4c3/graph-runner-0.0.8.tar.gz" } ], "0.0.9": [ { "comment_text": "", "digests": { "md5": "80bff45a617ec2cc802af936aaebc130", "sha256": "5feaf557571c583cbcca98d3ad2f9321dc5364f2eadc95da2d3b47b27e7e5d06" }, "downloads": -1, "filename": "graph-runner-0.0.9.tar.gz", "has_sig": false, "md5_digest": "80bff45a617ec2cc802af936aaebc130", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6543, "upload_time": "2018-09-30T18:05:29", "url": "https://files.pythonhosted.org/packages/3b/e6/aa24fa8f93778e1f40c43672b8055417a742966e6a5723f0ba2d9d929390/graph-runner-0.0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "06c57e4a6a150b1a3066c4b310a09d33", "sha256": "450ef26c9f7d8ce1a58f5be553049d67fb3838d9cfaa746c585da9c6a7b72e47" }, "downloads": -1, "filename": "graph-runner-0.0.15.tar.gz", "has_sig": false, "md5_digest": "06c57e4a6a150b1a3066c4b310a09d33", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9036, "upload_time": "2018-12-22T02:12:01", "url": "https://files.pythonhosted.org/packages/74/de/b42a6e3c7232c3a84421ba21536000ff5103d296de0d040e417a6fddbead/graph-runner-0.0.15.tar.gz" } ] }