depot/third_party/nixpkgs/pkgs/development/python-modules/libcst/default.nix
Default email ce641f4048 Project import generated by Copybara.
GitOrigin-RevId: bc5d68306b40b8522ffb69ba6cff91898c2fbbff
2021-12-06 17:07:01 +01:00

67 lines
1.4 KiB
Nix

{ lib
, black
, buildPythonPackage
, dataclasses
, fetchFromGitHub
, hypothesis
, isort
, pytest
, python
, pythonOlder
, pyyaml
, typing-extensions
, typing-inspect
}:
buildPythonPackage rec {
pname = "libcst";
version = "0.3.21";
format = "setuptools";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "instagram";
repo = pname;
rev = "v${version}";
sha256 = "063bl21gyyd25i2v0j6kz29cxxdfhng2nins4i2qblmac90f2nqy";
};
propagatedBuildInputs = [
hypothesis
typing-extensions
typing-inspect
pyyaml
] ++ lib.optional (pythonOlder "3.7") [
dataclasses
];
checkInputs = [
black
isort
pytest
];
preCheck = ''
${python.interpreter} -m libcst.codegen.generate visitors
${python.interpreter} -m libcst.codegen.generate return_types
# Can't run all tests due to circular dependency on hypothesmith -> libcst
rm -r {libcst/tests,libcst/codegen/tests,libcst/m*/tests}
'';
disabledTests = [
# No files are generated
"test_codemod_formatter_error_input"
];
pythonImportsCheck = [
"libcst"
];
meta = with lib; {
description = "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 ];
};
}