at 22.05-pre 1.4 kB view raw
1{ lib 2, black 3, buildPythonPackage 4, dataclasses 5, fetchFromGitHub 6, hypothesis 7, isort 8, pytest 9, python 10, pythonOlder 11, pyyaml 12, typing-extensions 13, typing-inspect 14}: 15 16buildPythonPackage rec { 17 pname = "libcst"; 18 version = "0.3.21"; 19 format = "setuptools"; 20 21 disabled = pythonOlder "3.6"; 22 23 src = fetchFromGitHub { 24 owner = "instagram"; 25 repo = pname; 26 rev = "v${version}"; 27 sha256 = "063bl21gyyd25i2v0j6kz29cxxdfhng2nins4i2qblmac90f2nqy"; 28 }; 29 30 propagatedBuildInputs = [ 31 hypothesis 32 typing-extensions 33 typing-inspect 34 pyyaml 35 ] ++ lib.optional (pythonOlder "3.7") [ 36 dataclasses 37 ]; 38 39 checkInputs = [ 40 black 41 isort 42 pytest 43 ]; 44 45 preCheck = '' 46 ${python.interpreter} -m libcst.codegen.generate visitors 47 ${python.interpreter} -m libcst.codegen.generate return_types 48 # Can't run all tests due to circular dependency on hypothesmith -> libcst 49 rm -r {libcst/tests,libcst/codegen/tests,libcst/m*/tests} 50 ''; 51 52 disabledTests = [ 53 # No files are generated 54 "test_codemod_formatter_error_input" 55 ]; 56 57 pythonImportsCheck = [ 58 "libcst" 59 ]; 60 61 meta = with lib; { 62 description = "Concrete Syntax Tree (CST) parser and serializer library for Python"; 63 homepage = "https://github.com/Instagram/libcst"; 64 license = with licenses; [ mit asl20 psfl ]; 65 maintainers = with maintainers; [ ruuda SuperSandro2000 ]; 66 }; 67}