2020-10-13 04:59:45 +01:00
|
|
|
{ lib, buildPythonPackage, fetchFromGitHub, pythonOlder, black, isort
|
2021-01-04 17:03:58 +00:00
|
|
|
, pytestCheckHook, pyyaml, typing-extensions, typing-inspect, dataclasses }:
|
2020-10-10 10:33:57 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "libcst";
|
2020-10-13 04:59:45 +01:00
|
|
|
version = "0.3.13";
|
2020-10-10 10:33:57 +01:00
|
|
|
|
2020-10-13 04:59:45 +01:00
|
|
|
# Some files for tests missing from PyPi
|
|
|
|
# https://github.com/Instagram/LibCST/issues/331
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "instagram";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0pbddjrsqj641mr6zijk2phfn15dampbx268zcws4bhhhnrxlj65";
|
2020-10-10 10:33:57 +01:00
|
|
|
};
|
|
|
|
|
2020-10-13 04:59:45 +01:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-10-10 10:33:57 +01:00
|
|
|
|
2021-01-04 17:03:58 +00:00
|
|
|
propagatedBuildInputs = [ pyyaml typing-inspect ]
|
|
|
|
++ lib.optional (pythonOlder "3.7") dataclasses;
|
2020-10-13 04:59:45 +01:00
|
|
|
|
|
|
|
checkInputs = [ black isort pytestCheckHook ];
|
|
|
|
|
|
|
|
# https://github.com/Instagram/LibCST/issues/346
|
|
|
|
# https://github.com/Instagram/LibCST/issues/347
|
|
|
|
preCheck = ''
|
|
|
|
python -m libcst.codegen.generate visitors
|
|
|
|
python -m libcst.codegen.generate return_types
|
|
|
|
rm libcst/tests/test_fuzz.py
|
|
|
|
rm libcst/tests/test_pyre_integration.py
|
|
|
|
rm libcst/metadata/tests/test_full_repo_manager.py
|
|
|
|
rm libcst/metadata/tests/test_type_inference_provider.py
|
|
|
|
'';
|
2020-10-10 10:33:57 +01:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "libcst" ];
|
|
|
|
|
2020-10-13 04:59:45 +01:00
|
|
|
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; [ maintainers.ruuda ];
|
2020-10-10 10:33:57 +01:00
|
|
|
};
|
|
|
|
}
|