1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pythonAtLeast,
7 pythonOlder,
8 setuptools,
9 setuptools-scm,
10}:
11
12buildPythonPackage rec {
13 pname = "pegen";
14 version = "0.3.0";
15 pyproject = true;
16
17 disabled = pythonOlder "3.8";
18
19 src = fetchFromGitHub {
20 owner = "we-like-parsers";
21 repo = "pegen";
22 tag = "v${version}";
23 hash = "sha256-P4zX8za9lBlXhNPkQe9p136ggZEJh6fHfBr+DQKvtTg=";
24 };
25
26 build-system = [
27 setuptools
28 setuptools-scm
29 ];
30
31 nativeCheckInputs = [ pytestCheckHook ];
32
33 pythonImportsCheck = [ "pegen" ];
34
35 disabledTests = [
36 # ValueError: Expected locations of (1, 3) and...
37 "test_invalid_call_arguments"
38 ]
39 ++ lib.optionals (pythonAtLeast "3.11") [
40 # https://github.com/we-like-parsers/pegen/issues/89
41 "test_invalid_def_stmt"
42 ];
43
44 disabledTestPaths = lib.optionals (pythonAtLeast "3.13") [
45 "tests/python_parser/test_ast_parsing.py"
46 "tests/python_parser/test_syntax_error_handling.py"
47 "tests/python_parser/test_unsupported_syntax.py"
48 ];
49
50 meta = with lib; {
51 description = "Library to generate PEG parsers";
52 homepage = "https://github.com/we-like-parsers/pegen";
53 changelog = "https://github.com/we-like-parsers/pegen/releases/tag/v${version}";
54 license = licenses.mit;
55 maintainers = with maintainers; [ fab ];
56 };
57}