summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pegen/default.nix
blob: f32f2d9c4ec79fd4066577a4605e299a0746d596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pytestCheckHook,
  pythonAtLeast,
  setuptools,
  setuptools-scm,
}:

buildPythonPackage rec {
  pname = "pegen";
  version = "0.3.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "we-like-parsers";
    repo = "pegen";
    tag = "v${version}";
    hash = "sha256-P4zX8za9lBlXhNPkQe9p136ggZEJh6fHfBr+DQKvtTg=";
  };

  build-system = [
    setuptools
    setuptools-scm
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "pegen" ];

  disabledTests = [
    # ValueError: Expected locations of (1, 3) and...
    "test_invalid_call_arguments"
  ]
  ++ lib.optionals (pythonAtLeast "3.11") [
    # https://github.com/we-like-parsers/pegen/issues/89
    "test_invalid_def_stmt"
  ];

  disabledTestPaths = lib.optionals (pythonAtLeast "3.13") [
    "tests/python_parser/test_ast_parsing.py"
    "tests/python_parser/test_syntax_error_handling.py"
    "tests/python_parser/test_unsupported_syntax.py"
  ];

  meta = {
    description = "Library to generate PEG parsers";
    homepage = "https://github.com/we-like-parsers/pegen";
    changelog = "https://github.com/we-like-parsers/pegen/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
}