Skip to main content

A high-performance graph database library with Python bindings written in Rust

Project description

KGLite

PyPI version Python versions License: MIT

A knowledge graph that runs inside your Python process. Load data, query with Cypher, do semantic search — no server, no setup, no infrastructure.

Two APIs: Use Cypher for querying, mutations, and semantic search. Use the fluent API (add_nodes / add_connections) for bulk-loading DataFrames. Most agent and application code only needs cypher().

Embedded, in-process No server, no network; import and go
In-memory Persistence via save()/load() snapshots
Cypher subset Querying + mutations + text_score() for semantic search
Single-label nodes Each node has exactly one type
Fluent bulk loading Import DataFrames with add_nodes() / add_connections()

Requirements: Python 3.10+ (CPython) | macOS (ARM/Intel), Linux (x86_64/aarch64), Windows (x86_64) | pandas >= 1.5

pip install kglite

Quick Start

import kglite

graph = kglite.KnowledgeGraph()

# Create nodes and relationships
graph.cypher("CREATE (:Person {name: 'Alice', age: 28, city: 'Oslo'})")
graph.cypher("CREATE (:Person {name: 'Bob', age: 35, city: 'Bergen'})")
graph.cypher("""
    MATCH (a:Person {name: 'Alice'}), (b:Person {name: 'Bob'})
    CREATE (a)-[:KNOWS]->(b)
""")

# Query — returns a ResultView (lazy; data stays in Rust until accessed)
result = graph.cypher("""
    MATCH (p:Person) WHERE p.age > 30
    RETURN p.name AS name, p.city AS city
    ORDER BY p.age DESC
""")
for row in result:
    print(row['name'], row['city'])

# Or get a pandas DataFrame
df = graph.cypher("MATCH (p:Person) RETURN p.name, p.age ORDER BY p.age", to_df=True)

# Persist to disk and reload
graph.save("my_graph.kgl")
loaded = kglite.load("my_graph.kgl")

Bulk Loading from DataFrames

import pandas as pd

users_df = pd.DataFrame({
    'user_id': [1001, 1002, 1003],
    'name': ['Alice', 'Bob', 'Charlie'],
    'age': [28, 35, 42]
})
graph.add_nodes(data=users_df, node_type='User', unique_id_field='user_id', node_title_field='name')

AI Agent Integration

xml = graph.describe()  # progressive-disclosure schema for agents
prompt = f"You have a knowledge graph:\n{xml}\nAnswer using graph.cypher()."

Documentation

Full documentation is available at kglite.readthedocs.io.

Topic Description
Getting Started Installation, quick start, DataFrame loading
Core Concepts Nodes, relationships, selections, return types
Cypher Guide Queries, mutations, transactions, parameters
Cypher Reference Full reference for every clause and function
Data Loading Fluent API, blueprints, conflict handling
Querying Filtering, traversal, schema introspection
Fluent API Reference Full reference for every fluent method
Semantic Search Embeddings, vector search, text_score()
AI Agents MCP server, describe(), agent prompts
Spatial Coordinates, geometry, distance, containment
Timeseries Time-indexed data, ts_*() Cypher functions
Graph Algorithms Shortest path, centrality, community detection, clustering
Import & Export Save/load, GraphML, CSV, indexes, performance
Code Tree Parse codebases into knowledge graphs
API Reference Auto-generated from type stubs

License

MIT — see LICENSE for details.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kglite-0.5.72-cp313-cp313-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.13Windows x86-64

kglite-0.5.72-cp313-cp313-manylinux_2_35_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ x86-64

kglite-0.5.72-cp313-cp313-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

kglite-0.5.72-cp313-cp313-macosx_10_12_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

kglite-0.5.72-cp312-cp312-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.12Windows x86-64

kglite-0.5.72-cp312-cp312-manylinux_2_35_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

kglite-0.5.72-cp312-cp312-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

kglite-0.5.72-cp312-cp312-macosx_10_12_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

kglite-0.5.72-cp311-cp311-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.11Windows x86-64

kglite-0.5.72-cp311-cp311-manylinux_2_35_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

kglite-0.5.72-cp311-cp311-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

kglite-0.5.72-cp311-cp311-macosx_10_12_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

kglite-0.5.72-cp310-cp310-win_amd64.whl (2.7 MB view details)

Uploaded CPython 3.10Windows x86-64

kglite-0.5.72-cp310-cp310-manylinux_2_35_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

kglite-0.5.72-cp310-cp310-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

kglite-0.5.72-cp310-cp310-macosx_10_12_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file kglite-0.5.72-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: kglite-0.5.72-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kglite-0.5.72-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 98f0e3e7b0b4142cd123e45d632d2ec7ee323f37247d5558eb77beb20e80fe2c
MD5 53e46e287095a5f57a7f8608fd576b73
BLAKE2b-256 c1e8fe4a2ebcdba3de2b3e83fe335d862b9721f374d184eb25308ce269c697d3

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp313-cp313-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 b1f0f9544cc4cb394da227953dec78a01bc17aa6f7718b197b2aa88acdd10a1f
MD5 49c178064dbdaa5912731ef97b91ba77
BLAKE2b-256 caed6de8831437374cc8eff7f517cbb69660800585bf7c738c817725a837e914

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb1900fdcb0c1118586bb74f8e827e3347f9e3dda67b17c56f37e92f7b354c67
MD5 2a5e17b9a34f1e815f35a62ba0803175
BLAKE2b-256 9635e60da93cf472c842d29e984a9c6f7b91ea20f034adc30bd7ed864644e9c2

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6ccc0085e5b4295a94c1673fcfe693eaf663d4d905f6a5d7e53a6992d0543f2d
MD5 f07a4a159bec76a0a2fccfa3cc6b4da4
BLAKE2b-256 fa3bddef602fa3844c0b058eaffad4900293dff354819b69b6712d143284c5e9

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: kglite-0.5.72-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kglite-0.5.72-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fc4f8b16fa48eaf970483e358355e525af13aae8cbb879fa752b0b834306b7a6
MD5 92226b8c0e72833f900ab662928f5630
BLAKE2b-256 119ef9410f4447cc30cd7d7f44282d4ef89a42e555d0457b56fd5a3fd595e8fa

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 7b95bc6c734842e24ce06833be7215c7a34e25b467ef747e659f442dc61f51ae
MD5 a1b0e642a8c2a80ee02190867146b3b7
BLAKE2b-256 f913a9166411fc7ec3530a385c1f1c884020dc6aeb872d2925355f6d0edb2bdd

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b2cf60ce2d20d39b1e071fd21bc7ea787278cc8cef6adc5b0335616d5d13cdb6
MD5 cbd95a21d0ca0b442ccc91652f2299e1
BLAKE2b-256 64f1a8f64bb30b671ea00ed3d1ac344bcf5e0cf16649455815cf09884a5bac1c

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7819a2e9ad6775b8e284482f5bae9581f04324c409ddd07c49c425760f8b6007
MD5 3ae8c3ed581ab700e2e34dde77b4ed71
BLAKE2b-256 eb674cb9798ad7755e206d89c596c1b5e9c544a52d7bcfea49f2f45a5e9af136

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: kglite-0.5.72-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kglite-0.5.72-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 eeb51698281595b8103ff59c538fc97777a352bfd12c567986b298791f2f5af5
MD5 118b515eee738f9acf616c24970931f7
BLAKE2b-256 2640287a95a87436cf5ad37f0df1dfa32fcef4d8922f01534e773056312d3102

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 4088f230360e2ebffb2017d7705b0fd93009edddcf18dc8297d03e3b9ff6029a
MD5 787585d70cd3e12c3340e62dc2acbf30
BLAKE2b-256 19d7b40dee48b4fbde941580db7fdc4f835b7e002cf0c0e13ce6c3b48dc2fa81

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 14f0afa05be1fa69c7438e51aa21cf1a0458c1a1b47ee30e25725711dfe5e60d
MD5 955b1a399826292ae1e66b380ecd2e82
BLAKE2b-256 53dae1aba6c49b04dcbb4cbdef8e287d58ede383e8ad9d6ce1c13ecd13a554bf

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1a20e518a62d74e3f7509d97b31015c2c541f8712b5e23535e649a7f26ef6b51
MD5 eefe7a700e5a819149d64c36b890553a
BLAKE2b-256 4885221ee3dc824eee4943811ac22288a718e7982feee0c919ce8a7493218dac

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: kglite-0.5.72-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kglite-0.5.72-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 323ee7018217be25aa1a6b8b88fde1527d0b02ad9e842fcf2b48979c452f950b
MD5 9a97b8853f7e1261687adf3ddfe217ef
BLAKE2b-256 8ae87aa79d92d6ae393400196d28ec852659d18e0bc2142d3ce0938b8a9f3262

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 3511e8ee928f773542a9367027ce4c9eb664a86b63ab0e6d73e865106a46a581
MD5 3da86a6b5a640ebe10e5c4d5f837e406
BLAKE2b-256 1547d8848461d3f427eb85d06896201da4489638677831720c1b10cf16d42072

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 28167a9860d372df7fd88132f17d0c304052a9d2b21bb38d0bb5280bcc0403c5
MD5 0a3aebd50e983e83d3c0274b59a7cb1e
BLAKE2b-256 6c31ddeb61d3bfae2524c19a349a80445e96f0edd6a2969ffc258778fd5be180

See more details on using hashes here.

File details

Details for the file kglite-0.5.72-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kglite-0.5.72-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 43466c562521eea2656876f639662c186f3a3c878b59d65779ac643288f0eeb8
MD5 d17c8826e1d4a2461dcabf77eb74df49
BLAKE2b-256 89c3298ba505d1843281c6ab8e4bda6d7f7cb13a9a7e8d7cd3be976141abd125

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page