Skip to main content

sPyCy

TCK CI status

sPyCy is a python implementation of openCypher. Try it out in your browser here: https://aneeshdurg.me/spycy

The goal of sPyCy is to enable using openCypher as a frontend, or to embed openCypher in other projects. To this end, sPyCy is quite modular and several components such as the underlying graph implementation, the subgraph pattern matcher, and the expression evaluator can all be substituted with a custom implementation. See examples/ for some sample usage, and for some examples where the graph implementation is satisfied by third-party objects (e.g. HTML DOM, LLVM IR, etc)

The long-term goals of this project include fully passing all openCypher TCK tests. Currently a majority of TCK tests are expected to pass. The failing tests are documented.

Some major unimplemented features are MERGE, temporal values, WHERE predicates involving patterns, existential subqueries, and CALL.

Installation

You can either install from PyPI or build sPyCy yourself. To install the pre-built wheel, run:

pip install spycy_aneeshdurg

To build it yourself, from the root of this repo, run:

# Optional - create and enter a venv
# python3 -m venv venv
# source ./venv/bin/activate # this command varies from shell to shell
pip install .

Usage:

# Example usage:
python3 -m spycy --query "CREATE (a {id: 'node0'})-[:X]->(b) return a"

# Or interactive mode:
python3 -m spycy --interactive
> CREATE (a {id: 'node0'})-[:X]->(b {id: 'node1'})
> MATCH (a)--(b) RETURN a.id, b.id
    a.id   b.id
0  node0  node1

sPcY can also be used via python:

from spycy import spycy
exe = spycy.CypherExecutor()
ids = list(range(100))
exe.exec(f"UNWIND {ids} as x CREATE ({{id: x}})")
num_nodes_gt_10 = exe.exec("MATCH (a) WHERE a.id > 10 RETURN count(a) as output")["output"]
print(f"There are {num_nodes_gt_10} node(s) with an id greater than 10")

Metadata

Release files for spycy-aneeshdurg 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spycy-aneeshdurg 0.1.0
File Size Uploaded
spycy_aneeshdurg-0.1.0.tar.gz 6.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for spycy-aneeshdurg 0.1.0
File Interpreter ABI Platform
spycy_aneeshdurg-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 MB

Release files / spycy_aneeshdurg-0.1.0.tar.gz

Download URL spycy_aneeshdurg-0.1.0.tar.gz
Size 6.9 MB
Tags Source
SHA-256 checksum
How to use checksums
57fc8319ec2cde92b903ca0aa229643f0e58ee9f5745528dad00679e2c88d0c3
BLAKE2b-256 checksum
How to use checksums
de00767cb9a9d6d046892d061eadf517a038c79e88dc35a5b40ea20adb842072
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release files / spycy_aneeshdurg-0.1.0-py3-none-any.whl

Download URL spycy_aneeshdurg-0.1.0-py3-none-any.whl
Size 138.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
281c2859769100db326a08d24f33c6b75497d751280183abd312f46a01c33e72
BLAKE2b-256 checksum
How to use checksums
460a7c6a70a9c0b1a617e6c3d1b6d36b0784cdd51cf53b70f9ff0692c26ef2bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page