Skip to main content

Git-like tool backed by Neo4j

Project description

neogit

A Git-like tool for filesystems, backed by a Neo4j graph and pluggable object storage.

Neogit takes content-addressed Merkle-tree snapshots of a directory tree and stores them in two places:

  • Neo4j — the graph: commits, branches, trees, blobs, and their relationships
  • Object storage — the bytes: file contents addressed by their SHA-1 (local filesystem, MinIO, or S3 via Apache Libcloud)

This split makes filesystem state queryable as a graph (Cypher over commits, diff trees, walk history) while keeping file contents in cheap blob storage.

Where it's used

  • CLI tool — capture and diff filesystem snapshots from the command line
  • Python library — embed the Merkle model and Neo4j layer in your own pipeline. For example, OSWatcher uses neogit as the storage foundation, and downstream projects build analysis plugins (filetype detection, symbol extraction, syscall tracing, …) on top of the Commit / PluginRun graph

Quickstart

Requirements: Python 3.11+, Poetry, Docker.

git clone https://github.com/OSWatcher/neogit.git
cd neogit
poetry install
poetry run poe create_dbs        # spins up Neo4j + MinIO test containers
poetry run neogit init           # creates Neo4j constraints
poetry run neogit commit hello -r .

Open the Neo4j browser at http://localhost:7474 and run:

MATCH (c:Commit)-[r]->(t:Tree) RETURN c, r, t LIMIT 25

CLI overview

neogit init                                    # initialize database constraints
neogit commit <name> -r <path>                 # snapshot a directory on the default branch
neogit branch <name> <commit_hash>             # create a branch pointing at a commit hash

Note: the diff subcommand is present in the docopt usage but not yet wired through to the service layer — see docs/reference/cli.md for the current status.

See docs/reference/cli.md for the full reference.

Use as a library

from pathlib import Path
from neogit.service import Neogit

git = Neogit()
git.init()
commit_hash = git.commit("snapshot-1", Path("/path/to/capture"))

The graph model (Commit, Branch, Tree, Blob, PluginRun) is exposed under neogit.model for downstream tools that want to attach their own nodes — see docs/explanation/data-model.md.

Documentation

Full documentation lives under docs/ and follows the Divio framework:

  • Tutorial — your first snapshot in 5 minutes
  • How-to guides — recipes for specific tasks (MinIO, S3, diffs, embedding the library)
  • Reference — CLI flags, config keys, data model
  • Explanation — design rationale, Merkle layout, why Neo4j

To preview the docs locally:

poetry install --with docs       # one-time, installs mkdocs into the venv
poetry run poe docs_serve        # equivalent to: poetry run mkdocs serve

Development

poetry install
poetry run poe ccode      # fmt + lint + type-check
poetry run poe test       # full test suite

See docs/how-to/contributing.md for the full dev workflow.

License

Licensed under the Apache License 2.0. You're free to use, modify, and distribute neogit, including commercially, provided you preserve the copyright and license notices (see NOTICE).

Project details


Download files

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

Source Distribution

neogit-0.14.0.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

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

neogit-0.14.0-py3-none-any.whl (53.3 kB view details)

Uploaded Python 3

File details

Details for the file neogit-0.14.0.tar.gz.

File metadata

  • Download URL: neogit-0.14.0.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.15 Linux/6.17.0-1015-azure

File hashes

Hashes for neogit-0.14.0.tar.gz
Algorithm Hash digest
SHA256 a19b5b3d4ad11b25b99c2f57078f1764924772bb50b0899bff67167458618e38
MD5 5fe849c981461efc937a9a80cb3c69d0
BLAKE2b-256 daa2e3e9e6578f28e75989f9cffedee2e04d4ae0e23f41c624b0be31a76bed56

See more details on using hashes here.

File details

Details for the file neogit-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: neogit-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 53.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.15 Linux/6.17.0-1015-azure

File hashes

Hashes for neogit-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa11914dfb80fee94d802ca799af56931dbe6c8b899c9477eead46386607fa00
MD5 71dd4776b251c379b92fe08ce24f8849
BLAKE2b-256 9fc0925bd56a27a311b5c12271d0b38acd1ba524dc9121d39c84cad5811c8c5e

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