1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, regex
6, pytestCheckHook
7, js2py
8, setuptools
9}:
10
11buildPythonPackage rec {
12 pname = "lark";
13 version = "1.1.7";
14 format = "pyproject";
15
16 src = fetchFromGitHub {
17 owner = "lark-parser";
18 repo = "lark";
19 rev = "refs/tags/${version}";
20 hash = "sha256-k74tozIgJuwtUqKKmYHlfLpCWyT2hdoygRJiIpw+GDE=";
21 };
22
23 patches = [
24 # include .lark files in package data
25 # https://github.com/lark-parser/lark/pull/1308
26 (fetchpatch {
27 url = "https://github.com/lark-parser/lark/commit/656334cb8793fd4e08a12843eaced5a7bb518be3.patch";
28 hash = "sha256-pYeNnFfXJ8xkR0KsU/KMWJ8nF+BhP9PXEANiVhT254s=";
29 })
30 ];
31
32 nativeBuildInputs = [
33 setuptools
34 ];
35
36 # Optional import, but fixes some re known bugs & allows advanced regex features
37 propagatedBuildInputs = [ regex ];
38
39 pythonImportsCheck = [
40 "lark"
41 "lark.parsers"
42 "lark.tools"
43 "lark.grammars"
44 ];
45
46 nativeCheckInputs = [
47 js2py
48 pytestCheckHook
49 ];
50
51 meta = with lib; {
52 description = "A modern parsing library for Python, implementing Earley & LALR(1) and an easy interface";
53 homepage = "https://lark-parser.readthedocs.io/";
54 changelog = "https://github.com/lark-parser/lark/releases/tag/${version}";
55 license = licenses.mit;
56 maintainers = with maintainers; [ fridh drewrisinger ];
57 };
58}