1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 flit-core,
7 pythonOlder,
8 defusedxml,
9 docutils,
10 jinja2,
11 markdown-it-py,
12 mdit-py-plugins,
13 pyyaml,
14 sphinx,
15 typing-extensions,
16 beautifulsoup4,
17 pytest-param-files,
18 pytest-regressions,
19 sphinx-pytest,
20 pytestCheckHook,
21 pythonRelaxDepsHook,
22}:
23
24buildPythonPackage rec {
25 pname = "myst-parser";
26 version = "2.0.0";
27 format = "pyproject";
28
29 disabled = pythonOlder "3.7";
30
31 src = fetchFromGitHub {
32 owner = "executablebooks";
33 repo = pname;
34 rev = "refs/tags/v${version}";
35 hash = "sha256-1BW7Z+0rs5Up+VZ3vDygnhLzE9Y2BqEMnTnflboweu0=";
36 };
37
38 patches = [
39 (fetchpatch {
40 name = "myst-parser-sphinx7.2-compat.patch";
41 url = "https://github.com/executablebooks/MyST-Parser/commit/4f670fc04c438b57a9d4014be74e9a62cc0deba4.patch";
42 hash = "sha256-FCvFSsD7qQwqWjSW7R4Gx+E2jaGkifSZqaRbAglt9Yw=";
43 })
44 ];
45
46 nativeBuildInputs = [
47 flit-core
48 pythonRelaxDepsHook
49 ];
50
51 propagatedBuildInputs = [
52 docutils
53 jinja2
54 mdit-py-plugins
55 markdown-it-py
56 pyyaml
57 sphinx
58 typing-extensions
59 ];
60
61 nativeCheckInputs = [
62 beautifulsoup4
63 defusedxml
64 pytest-param-files
65 pytest-regressions
66 sphinx-pytest
67 pytestCheckHook
68 ] ++ markdown-it-py.optional-dependencies.linkify;
69
70 pythonImportsCheck = [ "myst_parser" ];
71
72 pythonRelaxDeps = [ "docutils" ];
73
74 disabledTests = [
75 # AssertionError due to different files
76 "test_basic"
77 "test_footnotes"
78 "test_gettext_html"
79 "test_fieldlist_extension"
80 # docutils 0.19 expectation mismatches
81 "test_docutils_roles"
82 # sphinx 7.0 expectation mismatches
83 "test_heading_slug_func"
84 "test_references_singlehtml"
85 # sphinx 6.0 expectation mismatches
86 "test_sphinx_directives"
87 # sphinx 5.3 expectation mismatches
88 "test_render"
89 "test_includes"
90 ];
91
92 meta = with lib; {
93 description = "Sphinx and Docutils extension to parse MyST";
94 homepage = "https://myst-parser.readthedocs.io/";
95 changelog = "https://raw.githubusercontent.com/executablebooks/MyST-Parser/v${version}/CHANGELOG.md";
96 license = licenses.mit;
97 maintainers = with maintainers; [ loicreynier ];
98 };
99}