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