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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
callPackage,
cargo,
hypothesmith,
libcst,
libiconv,
pytestCheckHook,
python,
pythonOlder,
pyyaml,
rustPlatform,
rustc,
setuptools-rust,
setuptools-scm,
typing-extensions,
typing-inspect,
ufmt,
}:
buildPythonPackage rec {
pname = "libcst";
version = "1.4.0";
pyproject = true;
disabled = pythonOlder "3.9";
src = fetchFromGitHub {
owner = "instagram";
repo = "libcst";
rev = "refs/tags/v${version}";
hash = "sha256-H0YO8ILWOyhYdosNRWQQ9wziFk0syKSG3vF2zuYkL2k=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
sourceRoot = "${src.name}/${cargoRoot}";
name = "${pname}-${version}";
hash = "sha256-AcqHn3A7WCVyVnOBD96k4pxokhzgmCWOipK/DrIAQkU=";
};
cargoRoot = "native";
build-system = [
setuptools-rust
setuptools-scm
];
nativeBuildInputs = [
rustPlatform.cargoSetupHook
cargo
rustc
];
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
dependencies = [
typing-extensions
typing-inspect
pyyaml
];
nativeCheckInputs = [
hypothesmith
pytestCheckHook
ufmt
];
preCheck = ''
# import from $out instead
rm libcst/__init__.py
'';
disabledTests = [
# FIXME package pyre-test
"TypeInferenceProviderTest"
# we'd need to run `python -m libcst.codegen.generate all` but shouldn't modify $out
"test_codegen_clean_visitor_functions"
];
# circular dependency on hypothesmith and ufmt
doCheck = false;
passthru.tests = {
pytest = libcst.overridePythonAttrs { doCheck = true; };
};
pythonImportsCheck = [ "libcst" ];
meta = {
description = "Concrete Syntax Tree (CST) parser and serializer library for Python";
homepage = "https://github.com/Instagram/libcst";
changelog = "https://github.com/Instagram/LibCST/blob/v${version}/CHANGELOG.md";
license = with lib.licenses; [
mit
asl20
psfl
];
maintainers = with lib.maintainers; [ dotlambda ];
};
}
|