about summary refs log tree commit diff
path: root/pkgs/development/python-modules/markdown-it-py/default.nix
blob: f64d415aa76b9840614523595143774ffdefa6e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
  lib,
  attrs,
  buildPythonPackage,
  commonmark,
  fetchFromGitHub,
  flit-core,
  linkify-it-py,
  markdown,
  mdit-py-plugins,
  mdurl,
  mistletoe,
  mistune,
  myst-parser,
  panflute,
  pyyaml,
  sphinx,
  sphinx-book-theme,
  sphinx-copybutton,
  sphinx-design,
  stdenv,
  pytest-regressions,
  pytestCheckHook,
  pythonRelaxDepsHook,
  pythonOlder,
}:

buildPythonPackage rec {
  pname = "markdown-it-py";
  version = "3.0.0";
  format = "pyproject";

  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = "executablebooks";
    repo = pname;
    rev = "refs/tags/v${version}";
    hash = "sha256-cmjLElJA61EysTUFMVY++Kw0pI4wOIXOyCY3To9fpQc=";
  };

  # fix downstrem usage of markdown-it-py[linkify]
  pythonRelaxDeps = [ "linkify-it-py" ];

  nativeBuildInputs = [
    pythonRelaxDepsHook
    flit-core
  ];

  propagatedBuildInputs = [ mdurl ];

  nativeCheckInputs = [
    pytest-regressions
    pytestCheckHook
  ] ++ passthru.optional-dependencies.linkify;

  # disable and remove benchmark tests
  preCheck = ''
    rm -r benchmarking
  '';
  doCheck = !stdenv.isi686;

  pythonImportsCheck = [ "markdown_it" ];

  passthru.optional-dependencies = {
    compare = [
      commonmark
      markdown
      mistletoe
      mistune
      panflute
    ];
    linkify = [ linkify-it-py ];
    plugins = [ mdit-py-plugins ];
    rtd = [
      attrs
      myst-parser
      pyyaml
      sphinx
      sphinx-copybutton
      sphinx-design
      sphinx-book-theme
    ];
  };

  meta = with lib; {
    description = "Markdown parser in Python";
    homepage = "https://markdown-it-py.readthedocs.io/";
    changelog = "https://github.com/executablebooks/markdown-it-py/blob/${src.rev}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ bhipple ];
    mainProgram = "markdown-it";
  };
}