1{ stdenv 2, lib 3, buildPythonPackage 4, docutils 5, fetchFromGitHub 6, importlib-metadata 7, poetry-core 8, pydantic 9, pytestCheckHook 10, pythonOlder 11, pythonRelaxDepsHook 12, rstcheck-core 13, typer 14, types-docutils 15, typing-extensions 16}: 17 18buildPythonPackage rec { 19 pname = "rstcheck"; 20 version = "6.1.2"; 21 format = "pyproject"; 22 23 disabled = pythonOlder "3.7"; 24 25 src = fetchFromGitHub { 26 owner = "rstcheck"; 27 repo = pname; 28 rev = "refs/tags/v${version}"; 29 hash = "sha256-UMByfnnP1va3v1IgyQL0f3kC+W6HoiWScb7U2FAvWkU="; 30 }; 31 32 pythonRelaxDeps = [ 33 "typer" 34 ]; 35 36 nativeBuildInputs = [ 37 poetry-core 38 pythonRelaxDepsHook 39 ]; 40 41 propagatedBuildInputs = [ 42 docutils 43 rstcheck-core 44 types-docutils 45 typing-extensions 46 pydantic 47 typer 48 ] ++ lib.optionals (pythonOlder "3.8") [ 49 typing-extensions 50 importlib-metadata 51 ] ++ typer.optional-dependencies.all; 52 53 nativeCheckInputs = [ 54 pytestCheckHook 55 ]; 56 57 disabledTests = lib.optionals stdenv.isDarwin [ 58 # Disabled until https://github.com/rstcheck/rstcheck-core/issues/19 is resolved. 59 "test_error_without_config_file_macos" 60 "test_file_1_is_bad_without_config_macos" 61 ]; 62 63 pythonImportsCheck = [ 64 "rstcheck" 65 ]; 66 67 preCheck = '' 68 # The tests need to find and call the rstcheck executable 69 export PATH="$PATH:$out/bin"; 70 ''; 71 72 meta = with lib; { 73 description = "Checks syntax of reStructuredText and code blocks nested within it"; 74 homepage = "https://github.com/myint/rstcheck"; 75 changelog = "https://github.com/rstcheck/rstcheck/blob/v${version}/CHANGELOG.md"; 76 license = licenses.mit; 77 maintainers = with maintainers; [ staccato ]; 78 }; 79}