{ lib, python3Packages, fetchFromGitHub, }: python3Packages.buildPythonApplication rec { pname = "graphify"; version = "0.9.77"; pyproject = true; # Do not bump to the v1.0.0 tag: it is a stale branch 2126 commits behind # v0.9.77 (tagged 2026-04-05, pyproject still says graphifyy 0.1.10) and was # never published to PyPI, where 0.9.77 is the latest release. nix-update # picks v1.0.0 as the highest tag, so check PyPI before taking its result. src = fetchFromGitHub { owner = "Graphify-Labs"; repo = "graphify"; rev = "v${version}"; hash = "sha256-CvJ6GoV1nSzFGfLQbzKSHDUNOuOPQZaYOf/idcSHkPw="; }; build-system = with python3Packages; [ setuptools ]; # Only tree-sitter grammars available in nixpkgs are included. # Missing grammars will be downloaded by tree-sitter at runtime on demand. dependencies = with python3Packages; [ networkx numpy rapidfuzz tree-sitter tree-sitter-python tree-sitter-javascript tree-sitter-rust tree-sitter-c-sharp tree-sitter-sql ]; # Remove unavailable tree-sitter grammars from pyproject.toml. # Since 0.9.35 upstream pins versions ("tree-sitter-X>=v,` (versioned) or `"` (bare) via alternation. This also avoids # prefix collisions (e.g. tree-sitter-c vs tree-sitter-c-sharp). postPatch = '' # relax the build-backend pin: nixpkgs' setuptools is older than 83, but # the PEP 639 license metadata graphify relies on needs only >=77. sed -i 's/setuptools>=83\.[0-9.]*/setuptools/' pyproject.toml sed -i \ -e '/tree-sitter-typescript>\|tree-sitter-typescript"/d' \ -e '/tree-sitter-go>\|tree-sitter-go"/d' \ -e '/tree-sitter-java>\|tree-sitter-java"/d' \ -e '/tree-sitter-groovy>\|tree-sitter-groovy"/d' \ -e '/tree-sitter-c>\|tree-sitter-c"/d' \ -e '/tree-sitter-cpp>\|tree-sitter-cpp"/d' \ -e '/tree-sitter-ruby>\|tree-sitter-ruby"/d' \ -e '/tree-sitter-kotlin>\|tree-sitter-kotlin"/d' \ -e '/tree-sitter-scala>\|tree-sitter-scala"/d' \ -e '/tree-sitter-php>\|tree-sitter-php"/d' \ -e '/tree-sitter-swift>\|tree-sitter-swift"/d' \ -e '/tree-sitter-lua>\|tree-sitter-lua"/d' \ -e '/tree-sitter-zig>\|tree-sitter-zig"/d' \ -e '/tree-sitter-powershell>\|tree-sitter-powershell"/d' \ -e '/tree-sitter-elixir>\|tree-sitter-elixir"/d' \ -e '/tree-sitter-objc>\|tree-sitter-objc"/d' \ -e '/tree-sitter-julia>\|tree-sitter-julia"/d' \ -e '/tree-sitter-verilog>\|tree-sitter-verilog"/d' \ -e '/tree-sitter-fortran>\|tree-sitter-fortran"/d' \ -e '/tree-sitter-bash>\|tree-sitter-bash"/d' \ -e '/tree-sitter-json>\|tree-sitter-json"/d' \ pyproject.toml ''; doCheck = false; pythonImportsCheck = [ "graphify" ]; passthru = { category = "AI Coding Agents"; updateScript = [ "nix-update" "--flake" ".#graphify" ]; }; meta = { description = "AI coding assistant skill - turn any folder of code, docs, papers, images, or videos into a queryable knowledge graph"; homepage = "https://github.com/Graphify-Labs/graphify"; changelog = "https://github.com/Graphify-Labs/graphify/releases/tag/v${version}"; license = lib.licenses.asl20; mainProgram = "graphify"; platforms = lib.platforms.all; }; }