markdown-exec 1.11.0__tar.gz → 1.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/CHANGELOG.md +8 -0
  2. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/PKG-INFO +16 -7
  3. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/README.md +14 -4
  4. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/config/pytest.ini +2 -0
  5. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/.overrides/main.html +5 -7
  6. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/argparse.py +1 -1
  7. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/argparse_format.py +1 -1
  8. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/d2.py +0 -4
  9. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/runpy.py +4 -4
  10. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/usage/index.md +8 -0
  11. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/usage/pyodide.md +0 -2
  12. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/usage/tree.md +53 -1
  13. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/duties.py +21 -64
  14. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/mkdocs.yml +1 -11
  15. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/pyproject.toml +2 -3
  16. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/scripts/get_version.py +6 -1
  17. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/scripts/make.py +48 -13
  18. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/debug.py +1 -1
  19. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/sh.py +1 -0
  20. markdown_exec-1.12.0/src/markdown_exec/_internal/formatters/tree.py +163 -0
  21. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/main.py +8 -3
  22. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/test_api.py +4 -2
  23. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/test_base_formatter.py +2 -2
  24. markdown_exec-1.11.0/docs/css/insiders.css +0 -124
  25. markdown_exec-1.11.0/docs/insiders/changelog.md +0 -12
  26. markdown_exec-1.11.0/docs/insiders/goals.yml +0 -16
  27. markdown_exec-1.11.0/docs/insiders/index.md +0 -157
  28. markdown_exec-1.11.0/docs/insiders/installation.md +0 -67
  29. markdown_exec-1.11.0/docs/js/insiders.js +0 -74
  30. markdown_exec-1.11.0/scripts/insiders.py +0 -173
  31. markdown_exec-1.11.0/src/markdown_exec/_internal/formatters/tree.py +0 -60
  32. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/CODE_OF_CONDUCT.md +0 -0
  33. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/CONTRIBUTING.md +0 -0
  34. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/LICENSE +0 -0
  35. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/config/coverage.ini +0 -0
  36. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/config/git-changelog.toml +0 -0
  37. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/config/mypy.ini +0 -0
  38. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/config/ruff.toml +0 -0
  39. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/config/vscode/launch.json +0 -0
  40. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/config/vscode/settings.json +0 -0
  41. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/config/vscode/tasks.json +0 -0
  42. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/.overrides/partials/comments.html +0 -0
  43. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/.overrides/partials/path-item.html +0 -0
  44. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/changelog.md +0 -0
  45. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/code_of_conduct.md +0 -0
  46. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/contributing.md +0 -0
  47. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/credits.md +0 -0
  48. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/css/material.css +0 -0
  49. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/css/mkdocstrings.css +0 -0
  50. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/gallery.md +0 -0
  51. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/index.md +0 -0
  52. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/js/feedback.js +0 -0
  53. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/license.md +0 -0
  54. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/reference/api.md +0 -0
  55. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/schema.json +0 -0
  56. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/ansi.sh +0 -0
  57. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/chalk.py +0 -0
  58. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/diagrams.py +0 -0
  59. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/drawsvg.py +0 -0
  60. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/expandable_filetree.py +0 -0
  61. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/hyperbolic.py +0 -0
  62. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/matplotlib.py +0 -0
  63. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/plotly.py +0 -0
  64. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/pydeps.py +0 -0
  65. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/qrcode.py +0 -0
  66. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/rich.py +0 -0
  67. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/rich_terminal.py +0 -0
  68. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/gallery/textual.py +0 -0
  69. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/usage/boolean_matrix.py +0 -0
  70. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/usage/hide.py +0 -0
  71. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/usage/multiple.pycon +0 -0
  72. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/usage/platform_html.py +0 -0
  73. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/usage/platform_md.py +0 -0
  74. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/usage/source.py +0 -0
  75. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/snippets/usage/source.pycon +0 -0
  76. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/usage/python.md +0 -0
  77. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/docs/usage/shell.md +0 -0
  78. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/scripts/gen_credits.py +0 -0
  79. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/scripts/make +0 -0
  80. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/__init__.py +0 -0
  81. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/__init__.py +0 -0
  82. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/__init__.py +0 -0
  83. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/_exec_python.py +0 -0
  84. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/base.py +0 -0
  85. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/bash.py +0 -0
  86. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/console.py +0 -0
  87. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/markdown.py +0 -0
  88. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/pycon.py +0 -0
  89. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/pyodide.py +0 -0
  90. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/formatters/python.py +0 -0
  91. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/logger.py +0 -0
  92. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/mkdocs_plugin.py +0 -0
  93. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/processors.py +0 -0
  94. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/_internal/rendering.py +0 -0
  95. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/assets/ansi.css +0 -0
  96. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/assets/pyodide.css +0 -0
  97. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/assets/pyodide.js +0 -0
  98. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/__init__.py +0 -0
  99. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/base.py +0 -0
  100. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/bash.py +0 -0
  101. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/console.py +0 -0
  102. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/markdown.py +0 -0
  103. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/pycon.py +0 -0
  104. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/pyodide.py +0 -0
  105. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/python.py +0 -0
  106. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/sh.py +0 -0
  107. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/formatters/tree.py +0 -0
  108. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/logger.py +0 -0
  109. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/mkdocs_plugin.py +0 -0
  110. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/processors.py +0 -0
  111. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/py.typed +0 -0
  112. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/src/markdown_exec/rendering.py +0 -0
  113. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/__init__.py +0 -0
  114. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/conftest.py +0 -0
  115. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/test_converter.py +0 -0
  116. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/test_headings.py +0 -0
  117. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/test_python.py +0 -0
  118. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/test_shell.py +0 -0
  119. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/test_toc.py +0 -0
  120. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/test_tree.py +0 -0
  121. {markdown_exec-1.11.0 → markdown_exec-1.12.0}/tests/test_validator.py +0 -0
@@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  <!-- insertion marker -->
8
+ ## [1.12.0](https://github.com/pawamoy/markdown-exec/releases/tag/1.12.0) - 2025-11-10
9
+
10
+ <small>[Compare with 1.11.0](https://github.com/pawamoy/markdown-exec/compare/1.11.0...1.12.0)</small>
11
+
12
+ ### Features
13
+
14
+ - Support per-file-extension icons ([e6e0d59](https://github.com/pawamoy/markdown-exec/commit/e6e0d59904dff70920e72290ce19adacb720b0c6) by Timothée Mazzucotelli).
15
+
8
16
  ## [1.11.0](https://github.com/pawamoy/markdown-exec/releases/tag/1.11.0) - 2025-06-28
9
17
 
10
18
  <small>[Compare with 1.10.4](https://github.com/pawamoy/markdown-exec/compare/1.10.4...1.11.0)</small>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: markdown-exec
3
- Version: 1.11.0
3
+ Version: 1.12.0
4
4
  Summary: Utilities to execute code blocks in Markdown files.
5
5
  Keywords: markdown,python,exec,shell,bash,mkdocs
6
6
  Author-Email: =?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>
@@ -11,7 +11,6 @@ Classifier: Intended Audience :: Developers
11
11
  Classifier: Programming Language :: Python
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3.9
15
14
  Classifier: Programming Language :: Python :: 3.10
16
15
  Classifier: Programming Language :: Python :: 3.11
17
16
  Classifier: Programming Language :: Python :: 3.12
@@ -29,7 +28,7 @@ Project-URL: Issues, https://github.com/pawamoy/markdown-exec/issues
29
28
  Project-URL: Discussions, https://github.com/pawamoy/markdown-exec/discussions
30
29
  Project-URL: Gitter, https://gitter.im/markdown-exec/community
31
30
  Project-URL: Funding, https://github.com/sponsors/pawamoy
32
- Requires-Python: >=3.9
31
+ Requires-Python: >=3.10
33
32
  Requires-Dist: pymdown-extensions>=9
34
33
  Provides-Extra: ansi
35
34
  Requires-Dist: pygments-ansi-color>=0.3; extra == "ansi"
@@ -40,7 +39,8 @@ Description-Content-Type: text/markdown
40
39
  [![ci](https://github.com/pawamoy/markdown-exec/workflows/ci/badge.svg)](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
41
40
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/markdown-exec/)
42
41
  [![pypi version](https://img.shields.io/pypi/v/markdown-exec.svg)](https://pypi.org/project/markdown-exec/)
43
- [![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
42
+ [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
43
+ [![radicle](https://img.shields.io/badge/rad-clone-6666FF.svg?style=flat)](https://app.radicle.at/nodes/seed.radicle.at/rad:z77aiLJkzYXtuNpZuvizfGkDuZbQ)
44
44
 
45
45
  Utilities to execute code blocks in Markdown files.
46
46
 
@@ -83,7 +83,7 @@ Markdown(
83
83
  "format": formatter,
84
84
  }
85
85
  # ...one fence for each language we support:
86
- # bash, console, md, markdown, py, python, pycon, sh, tree
86
+ # bash, console, md, markdown, py, python, pycon, pyodide, sh, tree, etc.
87
87
  ]
88
88
  }
89
89
  }
@@ -118,9 +118,13 @@ markdown_extensions:
118
118
  - pymdownx.superfences
119
119
  ```
120
120
 
121
- We do recommend enabling Markdown Exec with the MkDocs plugin
121
+ TIP: We recommend enabling Markdown Exec with the MkDocs plugin
122
122
  if you are using MkDocs: it will take care of adding relevant
123
- assets (CSS/JS) to the final site when needed.
123
+ assets (CSS/JS) to the final site when needed.
124
+
125
+ WARNING: **Limitation of configuration through Markdown/PyMDown.**
126
+ Configuration through `pymdownx.superfences` directly is not well supported for fences that require assets inclusion, like `pyodide`.
127
+ For these you will have to include the assets manually. In the future we will provide ways to include them automatically.
124
128
 
125
129
  ## Usage
126
130
 
@@ -145,3 +149,8 @@ grep extra_css README.md && exit 2
145
149
 
146
150
  See [usage](https://pawamoy.github.io/markdown-exec/usage/) for more details,
147
151
  and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more examples!
152
+
153
+ ## Sponsors
154
+
155
+ <!-- sponsors-start -->
156
+ <!-- sponsors-end -->
@@ -3,7 +3,8 @@
3
3
  [![ci](https://github.com/pawamoy/markdown-exec/workflows/ci/badge.svg)](https://github.com/pawamoy/markdown-exec/actions?query=workflow%3Aci)
4
4
  [![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/markdown-exec/)
5
5
  [![pypi version](https://img.shields.io/pypi/v/markdown-exec.svg)](https://pypi.org/project/markdown-exec/)
6
- [![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
6
+ [![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#markdown-exec:gitter.im)
7
+ [![radicle](https://img.shields.io/badge/rad-clone-6666FF.svg?style=flat)](https://app.radicle.at/nodes/seed.radicle.at/rad:z77aiLJkzYXtuNpZuvizfGkDuZbQ)
7
8
 
8
9
  Utilities to execute code blocks in Markdown files.
9
10
 
@@ -46,7 +47,7 @@ Markdown(
46
47
  "format": formatter,
47
48
  }
48
49
  # ...one fence for each language we support:
49
- # bash, console, md, markdown, py, python, pycon, sh, tree
50
+ # bash, console, md, markdown, py, python, pycon, pyodide, sh, tree, etc.
50
51
  ]
51
52
  }
52
53
  }
@@ -81,9 +82,13 @@ markdown_extensions:
81
82
  - pymdownx.superfences
82
83
  ```
83
84
 
84
- We do recommend enabling Markdown Exec with the MkDocs plugin
85
+ TIP: We recommend enabling Markdown Exec with the MkDocs plugin
85
86
  if you are using MkDocs: it will take care of adding relevant
86
- assets (CSS/JS) to the final site when needed.
87
+ assets (CSS/JS) to the final site when needed.
88
+
89
+ WARNING: **Limitation of configuration through Markdown/PyMDown.**
90
+ Configuration through `pymdownx.superfences` directly is not well supported for fences that require assets inclusion, like `pyodide`.
91
+ For these you will have to include the assets manually. In the future we will provide ways to include them automatically.
87
92
 
88
93
  ## Usage
89
94
 
@@ -108,3 +113,8 @@ grep extra_css README.md && exit 2
108
113
 
109
114
  See [usage](https://pawamoy.github.io/markdown-exec/usage/) for more details,
110
115
  and the [gallery](https://pawamoy.github.io/markdown-exec/gallery/) for more examples!
116
+
117
+ ## Sponsors
118
+
119
+ <!-- sponsors-start -->
120
+ <!-- sponsors-end -->
@@ -10,5 +10,7 @@ testpaths =
10
10
  # action:message_regex:warning_class:module_regex:line
11
11
  filterwarnings =
12
12
  error
13
+ default::EncodingWarning
14
+ error::EncodingWarning:markdown_exec
13
15
  # TODO: remove once pytest-xdist 4 is released
14
16
  ignore:.*rsyncdir:DeprecationWarning:xdist
@@ -1,13 +1,11 @@
1
1
  {% extends "base.html" %}
2
2
 
3
3
  {% block announce %}
4
-
5
- <strong>Fund this project</strong> through
6
- <a href="{{ 'insiders/#how-to-become-a-sponsor' | url }}"><strong>sponsorship</strong></a>
7
- <span class="twemoji heart pulse">
8
- {% include ".icons/octicons/heart-fill-16.svg" %}
9
- </span> &mdash;
10
-
4
+ <strong>Fund this project</strong> through
5
+ <a href="https://github.com/sponsors/pawamoy"><strong>sponsorship</strong></a>
6
+ <span class="twemoji heart pulse">
7
+ {% include ".icons/octicons/heart-fill-16.svg" %}
8
+ </span> &mdash;
11
9
  Follow
12
10
  <strong>@pawamoy</strong> on
13
11
  <a rel="me" href="https://fosstodon.org/@pawamoy">
@@ -1,6 +1,6 @@
1
1
  import argparse
2
2
 
3
- from duty.cli import get_parser
3
+ from duty import get_parser
4
4
 
5
5
  parser = get_parser()
6
6
  lines = []
@@ -1,4 +1,4 @@
1
- from duty.cli import get_parser
1
+ from duty import get_parser
2
2
 
3
3
  parser = get_parser()
4
4
  print(f"```\n{parser.format_help()}\n```")
@@ -1,7 +1,3 @@
1
- import os # markdown-exec: hide
2
- if "CI" in os.environ: # markdown-exec: hide
3
- print("D2 is not installed in CI, skipping this gallery example.") # markdown-exec: hide
4
- raise SystemExit(0) # markdown-exec: hide
5
1
  import subprocess
6
2
 
7
3
  diagram = """
@@ -6,13 +6,13 @@ from runpy import run_module
6
6
 
7
7
  old_argv = list(sys.argv)
8
8
  sys.argv = ["mkdocs"]
9
- old_stdout = sys.stdout
10
- sys.stdout = StringIO()
9
+ old_stderr = sys.stderr
10
+ sys.stderr = StringIO()
11
11
  warnings.filterwarnings("ignore", category=RuntimeWarning)
12
12
  with suppress(SystemExit):
13
13
  run_module("mkdocs", run_name="__main__")
14
- output = sys.stdout.getvalue()
15
- sys.stdout = old_stdout
14
+ output = sys.stderr.getvalue()
15
+ sys.stderr = old_stderr
16
16
  sys.argv = old_argv
17
17
 
18
18
  print(f"```\n{output}\n```")
@@ -271,6 +271,14 @@ $ cat .git/config
271
271
  ```
272
272
  ````
273
273
 
274
+ If you just want a basic code block without any syntax highlighting, use the `text` language:
275
+
276
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
277
+ ```console exec="1" result="text"
278
+ $ echo 'print("some python code that is not highlighted")'
279
+ ```
280
+ ````
281
+
274
282
  WARNING: **Limitation:**
275
283
  Wrapping the result is not possible when HTML output is enabled.
276
284
 
@@ -1,7 +1,5 @@
1
1
  # Pyodide
2
2
 
3
- [:octicons-tag-24: Insiders 1.0.0](../insiders/changelog.md#1.0.0)
4
-
5
3
  This special `pyodide` fence uses [Pyodide](https://pyodide.org), [Ace](https://ace.c9.io/)
6
4
  and [Highlight.js](https://highlightjs.org/) to render an interactive Python editor.
7
5
  Everything runs on the client side. The first time Pyodide is loaded by the browser
@@ -19,6 +19,8 @@ root2
19
19
  ```
20
20
  ````
21
21
 
22
+ ## Syntax highlight
23
+
22
24
  By default, the language used for syntax highlight is `bash`.
23
25
  It means you can add comments with `#`:
24
26
 
@@ -56,6 +58,8 @@ root2
56
58
  ```
57
59
  ````
58
60
 
61
+ ## Leaf directories
62
+
59
63
  You can force an entry to be displayed as a directory instead of a regular file
60
64
  by appending a trailing slash to the name:
61
65
 
@@ -68,7 +72,55 @@ root1
68
72
  ```
69
73
  ````
70
74
 
71
- It is recommended to always append trailing slashes to directory anyway.
75
+ It is recommended to always append trailing slashes to directories anyway.
72
76
 
73
77
  WARNING: **Limitation:**
74
78
  Spaces in file names are not supported when searching for a trailing slash.
79
+
80
+ ## Custom icons
81
+
82
+ Custom icons based on the file name and extension can be used in tree fences.
83
+ This feature requires that the [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) theme is used.
84
+ By default, if Material for MkDocs is used, custom icons will be rendered.
85
+ You can opt-out with `icons="basic"` to use the basic folder and file emojis,
86
+ or even remove all icons/emojis with `icons="none"`.
87
+
88
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
89
+ ```tree icons="none"
90
+ folder/
91
+ file
92
+ file.py
93
+ file.rb
94
+ file.js
95
+ ```
96
+ ````
97
+
98
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
99
+ ```tree icons="basic"
100
+ folder/
101
+ file
102
+ file.py
103
+ file.rb
104
+ file.rs
105
+ ```
106
+ ````
107
+
108
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
109
+ ```tree icons="material"
110
+ folder/
111
+ file
112
+ file.py
113
+ file.rb
114
+ file.rs
115
+ ```
116
+ ````
117
+
118
+ ````md exec="1" source="tabbed-left" tabs="Markdown|Rendered"
119
+ ```tree icons="auto"
120
+ folder/
121
+ file
122
+ file.py
123
+ file.rb
124
+ file.rs
125
+ ```
126
+ ````
@@ -6,17 +6,16 @@ import os
6
6
  import re
7
7
  import sys
8
8
  from contextlib import contextmanager
9
- from functools import wraps
10
9
  from importlib.metadata import version as pkgversion
11
10
  from pathlib import Path
12
- from typing import TYPE_CHECKING, Any, Callable
11
+ from typing import TYPE_CHECKING
13
12
 
14
13
  from duty import duty, tools
15
14
 
16
15
  if TYPE_CHECKING:
17
16
  from collections.abc import Iterator
18
17
 
19
- from duty.context import Context
18
+ from duty import Context
20
19
 
21
20
 
22
21
  PY_SRC_PATHS = (Path(_) for _ in ("src", "tests", "duties.py", "scripts"))
@@ -26,6 +25,8 @@ CI = os.environ.get("CI", "0") in {"1", "true", "yes", ""}
26
25
  WINDOWS = os.name == "nt"
27
26
  PTY = not WINDOWS and not CI
28
27
  MULTIRUN = os.environ.get("MULTIRUN", "0") == "1"
28
+ PY_VERSION = f"{sys.version_info.major}{sys.version_info.minor}"
29
+ PY_DEV = "314"
29
30
 
30
31
 
31
32
  def pyprefix(title: str) -> str:
@@ -35,21 +36,6 @@ def pyprefix(title: str) -> str:
35
36
  return title
36
37
 
37
38
 
38
- def not_from_insiders(func: Callable) -> Callable:
39
- @wraps(func)
40
- def wrapper(ctx: Context, *args: Any, **kwargs: Any) -> None:
41
- origin = ctx.run("git config --get remote.origin.url", silent=True)
42
- if "pawamoy-insiders/griffe" in origin:
43
- ctx.run(
44
- lambda: False,
45
- title="Not running this task from insiders repository (do that from public repo instead!)",
46
- )
47
- return
48
- func(ctx, *args, **kwargs)
49
-
50
- return wrapper
51
-
52
-
53
39
  @contextmanager
54
40
  def material_insiders() -> Iterator[bool]:
55
41
  if "+insiders" in pkgversion("mkdocs-material"):
@@ -84,7 +70,7 @@ def check(ctx: Context) -> None:
84
70
  """Check it all!"""
85
71
 
86
72
 
87
- @duty
73
+ @duty(nofail=PY_VERSION == PY_DEV)
88
74
  def check_quality(ctx: Context) -> None:
89
75
  """Check the code quality."""
90
76
  ctx.run(
@@ -93,7 +79,11 @@ def check_quality(ctx: Context) -> None:
93
79
  )
94
80
 
95
81
 
96
- @duty(skip_if=sys.version_info[:2] != (3, 12), skip_reason=pyprefix("Docs build only on Python 3.12"))
82
+ @duty(
83
+ skip_if=sys.version_info[:2] != (3, 12),
84
+ skip_reason=pyprefix("Docs build only on Python 3.12"),
85
+ nofail=PY_VERSION == PY_DEV,
86
+ )
97
87
  def check_docs(ctx: Context) -> None:
98
88
  """Check if the documentation builds correctly."""
99
89
  Path("htmlcov").mkdir(parents=True, exist_ok=True)
@@ -105,7 +95,7 @@ def check_docs(ctx: Context) -> None:
105
95
  )
106
96
 
107
97
 
108
- @duty
98
+ @duty(nofail=PY_VERSION == PY_DEV)
109
99
  def check_types(ctx: Context) -> None:
110
100
  """Check that the code is correctly typed."""
111
101
  os.environ["FORCE_COLOR"] = "1"
@@ -115,7 +105,7 @@ def check_types(ctx: Context) -> None:
115
105
  )
116
106
 
117
107
 
118
- @duty
108
+ @duty(nofail=PY_VERSION == PY_DEV)
119
109
  def check_api(ctx: Context, *cli_args: str) -> None:
120
110
  """Check for API breaking changes."""
121
111
  ctx.run(
@@ -142,39 +132,13 @@ def docs(ctx: Context, *cli_args: str, host: str = "127.0.0.1", port: int = 8000
142
132
 
143
133
 
144
134
  @duty
145
- def docs_deploy(ctx: Context, *, force: bool = False) -> None:
146
- """Deploy the documentation to GitHub pages.
147
-
148
- Parameters:
149
- force: Whether to force deployment, even from non-Insiders version.
150
- """
135
+ def docs_deploy(ctx: Context) -> None:
136
+ """Deploy the documentation to GitHub pages."""
151
137
  os.environ["DEPLOY"] = "true"
152
138
  with material_insiders() as insiders:
153
139
  if not insiders:
154
140
  ctx.run(lambda: False, title="Not deploying docs without Material for MkDocs Insiders!")
155
- origin = ctx.run("git config --get remote.origin.url", silent=True, allow_overrides=False)
156
- if "pawamoy-insiders/markdown-exec" in origin:
157
- ctx.run(
158
- "git remote add upstream git@github.com:pawamoy/markdown-exec",
159
- silent=True,
160
- nofail=True,
161
- allow_overrides=False,
162
- )
163
- ctx.run(
164
- tools.mkdocs.gh_deploy(remote_name="upstream", force=True),
165
- title="Deploying documentation",
166
- )
167
- elif force:
168
- ctx.run(
169
- tools.mkdocs.gh_deploy(force=True),
170
- title="Deploying documentation",
171
- )
172
- else:
173
- ctx.run(
174
- lambda: False,
175
- title="Not deploying docs from public repository (do that from insiders instead!)",
176
- nofail=True,
177
- )
141
+ ctx.run(tools.mkdocs.gh_deploy(force=True), title="Deploying documentation")
178
142
 
179
143
 
180
144
  @duty
@@ -198,7 +162,6 @@ def build(ctx: Context) -> None:
198
162
 
199
163
 
200
164
  @duty
201
- @not_from_insiders
202
165
  def publish(ctx: Context) -> None:
203
166
  """Publish source and wheel distributions to PyPI."""
204
167
  if not Path("dist").exists():
@@ -212,7 +175,6 @@ def publish(ctx: Context) -> None:
212
175
 
213
176
 
214
177
  @duty(post=["build", "publish", "docs-deploy"])
215
- @not_from_insiders
216
178
  def release(ctx: Context, version: str = "") -> None:
217
179
  """Release a new Python package.
218
180
 
@@ -223,7 +185,7 @@ def release(ctx: Context, version: str = "") -> None:
223
185
  ctx.run("false", title="A version must be provided")
224
186
  ctx.run("git add pyproject.toml CHANGELOG.md", title="Staging files", pty=PTY)
225
187
  ctx.run(["git", "commit", "-m", f"chore: Prepare release {version}"], title="Committing changes", pty=PTY)
226
- ctx.run(f"git tag {version}", title="Tagging commit", pty=PTY)
188
+ ctx.run(f"git tag -m '' -a {version}", title="Tagging commit", pty=PTY)
227
189
  ctx.run("git push", title="Pushing commits", pty=False)
228
190
  ctx.run("git push --tags", title="Pushing tags", pty=False)
229
191
 
@@ -236,20 +198,15 @@ def coverage(ctx: Context) -> None:
236
198
  ctx.run(tools.coverage.html(rcfile="config/coverage.ini"))
237
199
 
238
200
 
239
- @duty
240
- def test(ctx: Context, *cli_args: str, match: str = "") -> None: # noqa: PT028
241
- """Run the test suite.
242
-
243
- Parameters:
244
- match: A pytest expression to filter selected tests.
245
- """
246
- py_version = f"{sys.version_info.major}{sys.version_info.minor}"
247
- os.environ["COVERAGE_FILE"] = f".coverage.{py_version}"
201
+ @duty(nofail=PY_VERSION == PY_DEV)
202
+ def test(ctx: Context, *cli_args: str) -> None:
203
+ """Run the test suite."""
204
+ os.environ["COVERAGE_FILE"] = f".coverage.{PY_VERSION}"
205
+ os.environ["PYTHONWARNDEFAULTENCODING"] = "1"
248
206
  ctx.run(
249
207
  tools.pytest(
250
208
  "tests",
251
209
  config_file="config/pytest.ini",
252
- select=match,
253
210
  color="yes",
254
211
  ).add_args("-n", "auto", *cli_args),
255
212
  title=pyprefix("Running tests"),
@@ -31,11 +31,6 @@ nav:
31
31
  - Contributing: contributing.md
32
32
  - Code of Conduct: code_of_conduct.md
33
33
  - Coverage report: coverage.md
34
- - Insiders:
35
- - insiders/index.md
36
- - Getting started:
37
- - Installation: insiders/installation.md
38
- - Changelog: insiders/changelog.md
39
34
  - Author's website: https://pawamoy.github.io/
40
35
 
41
36
  theme:
@@ -83,7 +78,6 @@ theme:
83
78
  extra_css:
84
79
  - css/material.css
85
80
  - css/mkdocstrings.css
86
- - css/insiders.css
87
81
 
88
82
  extra_javascript:
89
83
  - js/feedback.js
@@ -148,7 +142,7 @@ plugins:
148
142
  show_root_heading: true
149
143
  show_root_full_path: false
150
144
  show_signature_annotations: true
151
- show_source: false
145
+ show_source: true
152
146
  show_symbol_type_heading: true
153
147
  show_symbol_type_toc: true
154
148
  signature_crossrefs: true
@@ -166,10 +160,6 @@ plugins:
166
160
  type: timeago
167
161
  - minify:
168
162
  minify_html: !ENV [DEPLOY, false]
169
- - group:
170
- enabled: !ENV [MATERIAL_INSIDERS, false]
171
- plugins:
172
- - typeset
173
163
 
174
164
  extra:
175
165
  social:
@@ -15,7 +15,7 @@ license-files = [
15
15
  "LICENSE",
16
16
  ]
17
17
  readme = "README.md"
18
- requires-python = ">=3.9"
18
+ requires-python = ">=3.10"
19
19
  keywords = [
20
20
  "markdown",
21
21
  "python",
@@ -31,7 +31,6 @@ classifiers = [
31
31
  "Programming Language :: Python",
32
32
  "Programming Language :: Python :: 3",
33
33
  "Programming Language :: Python :: 3 :: Only",
34
- "Programming Language :: Python :: 3.9",
35
34
  "Programming Language :: Python :: 3.10",
36
35
  "Programming Language :: Python :: 3.11",
37
36
  "Programming Language :: Python :: 3.12",
@@ -45,7 +44,7 @@ classifiers = [
45
44
  dependencies = [
46
45
  "pymdown-extensions>=9",
47
46
  ]
48
- version = "1.11.0"
47
+ version = "1.12.0"
49
48
 
50
49
  [project.optional-dependencies]
51
50
  ansi = [
@@ -4,7 +4,12 @@ import re
4
4
  from contextlib import suppress
5
5
  from pathlib import Path
6
6
 
7
- from pdm.backend.hooks.version import SCMVersion, Version, default_version_formatter, get_version_from_scm
7
+ from pdm.backend.hooks.version import ( # ty: ignore[unresolved-import]
8
+ SCMVersion,
9
+ Version,
10
+ default_version_formatter,
11
+ get_version_from_scm,
12
+ )
8
13
 
9
14
  _root = Path(__file__).parent.parent
10
15
  _changelog = _root / "CHANGELOG.md"
@@ -14,7 +14,8 @@ if TYPE_CHECKING:
14
14
  from collections.abc import Iterator
15
15
 
16
16
 
17
- PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.9 3.10 3.11 3.12 3.13 3.14").split()
17
+ PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.10 3.11 3.12 3.13 3.14 3.15").split()
18
+ PYTHON_DEV = "3.15"
18
19
 
19
20
 
20
21
  def shell(cmd: str, *, capture_output: bool = False, **kwargs: Any) -> str | None:
@@ -67,16 +68,31 @@ def setup() -> None:
67
68
  uv_install(venv_path)
68
69
 
69
70
 
71
+ class _RunError(subprocess.CalledProcessError):
72
+ def __init__(self, *args: Any, python_version: str, **kwargs: Any):
73
+ super().__init__(*args, **kwargs)
74
+ self.python_version = python_version
75
+
76
+
70
77
  def run(version: str, cmd: str, *args: str, **kwargs: Any) -> None:
71
78
  """Run a command in a virtual environment."""
72
79
  kwargs = {"check": True, **kwargs}
73
80
  uv_run = ["uv", "run", "--no-sync"]
74
- if version == "default":
75
- with environ(UV_PROJECT_ENVIRONMENT=".venv"):
76
- subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
77
- else:
78
- with environ(UV_PROJECT_ENVIRONMENT=f".venvs/{version}", MULTIRUN="1"):
79
- subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
81
+ try:
82
+ if version == "default":
83
+ with environ(UV_PROJECT_ENVIRONMENT=".venv"):
84
+ subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
85
+ else:
86
+ with environ(UV_PROJECT_ENVIRONMENT=f".venvs/{version}", MULTIRUN="1"):
87
+ subprocess.run([*uv_run, cmd, *args], **kwargs) # noqa: S603, PLW1510
88
+ except subprocess.CalledProcessError as process:
89
+ raise _RunError(
90
+ returncode=process.returncode,
91
+ python_version=version,
92
+ cmd=process.cmd,
93
+ output=process.output,
94
+ stderr=process.stderr,
95
+ ) from process
80
96
 
81
97
 
82
98
  def multirun(cmd: str, *args: str, **kwargs: Any) -> None:
@@ -144,19 +160,31 @@ def main() -> int:
144
160
  cmd = args.pop(0)
145
161
 
146
162
  if cmd == "run":
147
- run("default", *args)
163
+ if not args:
164
+ print("make: run: missing command", file=sys.stderr)
165
+ return 1
166
+ run("default", *args) # ty: ignore[missing-argument]
148
167
  return 0
149
168
 
150
169
  if cmd == "multirun":
151
- multirun(*args)
170
+ if not args:
171
+ print("make: run: missing command", file=sys.stderr)
172
+ return 1
173
+ multirun(*args) # ty: ignore[missing-argument]
152
174
  return 0
153
175
 
154
176
  if cmd == "allrun":
155
- allrun(*args)
177
+ if not args:
178
+ print("make: run: missing command", file=sys.stderr)
179
+ return 1
180
+ allrun(*args) # ty: ignore[missing-argument]
156
181
  return 0
157
182
 
158
183
  if cmd.startswith("3."):
159
- run(cmd, *args)
184
+ if not args:
185
+ print("make: run: missing command", file=sys.stderr)
186
+ return 1
187
+ run(cmd, *args) # ty: ignore[missing-argument]
160
188
  return 0
161
189
 
162
190
  opts = []
@@ -183,7 +211,14 @@ def main() -> int:
183
211
  if __name__ == "__main__":
184
212
  try:
185
213
  sys.exit(main())
186
- except subprocess.CalledProcessError as process:
214
+ except _RunError as process:
187
215
  if process.output:
188
216
  print(process.output, file=sys.stderr)
189
- sys.exit(process.returncode)
217
+ if (code := process.returncode) == 139: # noqa: PLR2004
218
+ print(
219
+ f"✗ (python{process.python_version}) '{' '.join(process.cmd)}' failed with return code {code} (segfault)",
220
+ file=sys.stderr,
221
+ )
222
+ if process.python_version == PYTHON_DEV:
223
+ code = 0
224
+ sys.exit(code)
@@ -85,7 +85,7 @@ def _get_debug_info() -> _Environment:
85
85
  interpreter_version=py_version,
86
86
  interpreter_path=sys.executable,
87
87
  platform=platform.platform(),
88
- variables=[_Variable(var, val) for var in variables if (val := os.getenv(var))],
88
+ variables=[_Variable(var, val) for var in variables if (val := os.getenv(var))], # ty: ignore[invalid-argument-type]
89
89
  packages=[_Package(pkg, _get_version(pkg)) for pkg in packages],
90
90
  )
91
91