about summary refs log tree commit diff
path: root/pkgs/development/python-modules/libcst/default.nix
blob: ed6e7755bf150bc6e52cf34183633bfb30f2edab (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, hypothesis
, dataclasses
, hypothesmith
, pytestCheckHook
, pyyaml
, typing-extensions
, typing-inspect
, black
, isort
}:

buildPythonPackage rec {
  pname = "libcst";
  version = "0.3.18";

  # Some files for tests missing from PyPi
  # https://github.com/Instagram/LibCST/issues/331
  src = fetchFromGitHub {
    owner = "instagram";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-19yGaKBLpGASSPv/aSX0kx9lh2JxKExHJDKKtuBbuqI=";
  };

  disabled = pythonOlder "3.6";

  propagatedBuildInputs = [ hypothesis typing-extensions typing-inspect pyyaml ]
    ++ lib.optional (pythonOlder "3.7") dataclasses;

  checkInputs = [ black hypothesmith isort pytestCheckHook ];

  # can't run tests due to circular dependency on hypothesmith -> licst
  doCheck = false;

  preCheck = ''
    python -m libcst.codegen.generate visitors
    python -m libcst.codegen.generate return_types
  '';

  pythonImportsCheck = [ "libcst" ];

  meta = with lib; {
    description = "A Concrete Syntax Tree (CST) parser and serializer library for Python.";
    homepage = "https://github.com/Instagram/libcst";
    license = with licenses; [ mit asl20 psfl ];
    maintainers = with maintainers; [ ruuda SuperSandro2000 ];
  };
}