2021-02-14 03:08:58 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonOlder
|
|
|
|
, hypothesis
|
|
|
|
, dataclasses
|
|
|
|
, hypothesmith
|
|
|
|
, pytestCheckHook
|
|
|
|
, pyyaml
|
|
|
|
, typing-extensions
|
|
|
|
, typing-inspect
|
|
|
|
, black
|
|
|
|
, isort
|
|
|
|
}:
|
2020-10-10 10:33:57 +01:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "libcst";
|
2021-02-14 03:08:58 +00:00
|
|
|
version = "0.3.17";
|
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}";
|
2021-02-14 03:08:58 +00:00
|
|
|
sha256 = "sha256-mlSeB9OjCiUVYwcPYNrQdlfcj9DV/+wqVWt91uFsQsU=";
|
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-03-08 20:35:54 +00:00
|
|
|
propagatedBuildInputs = [ hypothesis typing-extensions typing-inspect pyyaml ]
|
2021-01-04 17:03:58 +00:00
|
|
|
++ lib.optional (pythonOlder "3.7") dataclasses;
|
2020-10-13 04:59:45 +01:00
|
|
|
|
2021-02-14 03:08:58 +00:00
|
|
|
checkInputs = [ black hypothesmith isort pytestCheckHook ];
|
|
|
|
|
2021-03-08 20:35:54 +00:00
|
|
|
# can't run tests due to circular dependency on hypothesmith -> licst
|
|
|
|
doCheck = false;
|
2020-10-13 04:59:45 +01:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
python -m libcst.codegen.generate visitors
|
|
|
|
python -m libcst.codegen.generate return_types
|
|
|
|
'';
|
2020-10-10 10:33:57 +01:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "libcst" ];
|
|
|
|
|
2020-10-13 04:59:45 +01:00
|
|
|
meta = with lib; {
|
2021-03-08 20:35:54 +00:00
|
|
|
description = "A Concrete Syntax Tree (CST) parser and serializer library for Python.";
|
2020-10-13 04:59:45 +01:00
|
|
|
homepage = "https://github.com/Instagram/libcst";
|
|
|
|
license = with licenses; [ mit asl20 psfl ];
|
2021-02-14 03:08:58 +00:00
|
|
|
maintainers = with maintainers; [ ruuda SuperSandro2000 ];
|
2020-10-10 10:33:57 +01:00
|
|
|
};
|
|
|
|
}
|