mkdocstrings-python 1.6.2__tar.gz → 1.6.3__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 (78) hide show
  1. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/PKG-INFO +1 -1
  2. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/pyproject.toml +1 -1
  3. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/handler.py +8 -2
  4. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/rendering.py +5 -2
  5. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html +1 -1
  6. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/classes.html +1 -1
  7. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/functions.html +1 -1
  8. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/modules.html +1 -1
  9. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/other_parameters.html +1 -1
  10. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/parameters.html +1 -1
  11. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html +1 -1
  12. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html +1 -1
  13. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html +1 -1
  14. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/attributes.html +1 -1
  15. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/other_parameters.html +1 -1
  16. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/parameters.html +1 -1
  17. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/receives.html +1 -1
  18. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/returns.html +1 -1
  19. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/yields.html +1 -1
  20. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/LICENSE +0 -0
  21. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/README.md +0 -0
  22. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/py.typed +0 -0
  23. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/__init__.py +0 -0
  24. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/attribute.html +0 -0
  25. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/children.html +0 -0
  26. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/class.html +0 -0
  27. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html +0 -0
  28. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/examples.html +0 -0
  29. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/raises.html +0 -0
  30. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html +0 -0
  31. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/docstring.html +0 -0
  32. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/expression.html +0 -0
  33. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/function.html +0 -0
  34. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/labels.html +0 -0
  35. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/languages/en.html +0 -0
  36. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/languages/ja.html +0 -0
  37. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/languages/zh.html +0 -0
  38. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/module.html +0 -0
  39. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/_base/signature.html +0 -0
  40. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/attribute.html +0 -0
  41. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/children.html +0 -0
  42. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/class.html +0 -0
  43. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/admonition.html +0 -0
  44. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/attributes.html +0 -0
  45. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/classes.html +0 -0
  46. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/examples.html +0 -0
  47. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/functions.html +0 -0
  48. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/modules.html +0 -0
  49. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/other_parameters.html +0 -0
  50. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/parameters.html +0 -0
  51. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/raises.html +0 -0
  52. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/receives.html +0 -0
  53. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/returns.html +0 -0
  54. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/warns.html +0 -0
  55. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring/yields.html +0 -0
  56. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/docstring.html +0 -0
  57. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/expression.html +0 -0
  58. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/function.html +0 -0
  59. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/labels.html +0 -0
  60. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/language.html +0 -0
  61. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/languages/en.html +0 -0
  62. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/languages/ja.html +0 -0
  63. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/languages/zh.html +0 -0
  64. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/module.html +0 -0
  65. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/signature.html +0 -0
  66. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/material/style.css +0 -0
  67. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/raises.html +0 -0
  68. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/docstring/warns.html +0 -0
  69. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/language.html +0 -0
  70. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/languages/en.html +0 -0
  71. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html +0 -0
  72. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html +0 -0
  73. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/src/mkdocstrings_handlers/python/templates/readthedocs/style.css +0 -0
  74. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/tests/__init__.py +0 -0
  75. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/tests/conftest.py +0 -0
  76. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/tests/test_handler.py +0 -0
  77. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/tests/test_rendering.py +0 -0
  78. {mkdocstrings_python-1.6.2 → mkdocstrings_python-1.6.3}/tests/test_themes.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mkdocstrings-python
3
- Version: 1.6.2
3
+ Version: 1.6.3
4
4
  Summary: A Python handler for mkdocstrings.
5
5
  Author-Email: Timothée Mazzucotelli <pawamoy@pm.me>
6
6
  License: ISC
@@ -35,7 +35,7 @@ dependencies = [
35
35
  "mkdocstrings>=0.20",
36
36
  "griffe>=0.35",
37
37
  ]
38
- version = "1.6.2"
38
+ version = "1.6.3"
39
39
 
40
40
  [project.license]
41
41
  text = "ISC"
@@ -108,7 +108,6 @@ class PythonHandler(BaseHandler):
108
108
  "filters": ["!^_[^_]"],
109
109
  "annotations_path": "brief",
110
110
  "preload_modules": None,
111
- "load_external_modules": False,
112
111
  "allow_inspection": True,
113
112
  }
114
113
  """
@@ -189,6 +188,7 @@ class PythonHandler(BaseHandler):
189
188
  config_file_path: str | None = None,
190
189
  paths: list[str] | None = None,
191
190
  locale: str = "en",
191
+ load_external_modules: bool = False,
192
192
  **kwargs: Any,
193
193
  ) -> None:
194
194
  """Initialize the handler.
@@ -198,10 +198,12 @@ class PythonHandler(BaseHandler):
198
198
  config_file_path: The MkDocs configuration file path.
199
199
  paths: A list of paths to use as Griffe search paths.
200
200
  locale: The locale to use when rendering content.
201
+ load_external_modules: Load external modules when resolving aliases.
201
202
  **kwargs: Same thing, but with keyword arguments.
202
203
  """
203
204
  super().__init__(*args, **kwargs)
204
205
  self._config_file_path = config_file_path
206
+ self._load_external_modules = load_external_modules
205
207
  paths = paths or []
206
208
  glob_base_dir = os.path.dirname(os.path.abspath(config_file_path)) if config_file_path else "."
207
209
  with chdir(glob_base_dir):
@@ -282,7 +284,7 @@ class PythonHandler(BaseHandler):
282
284
  raise CollectionError(str(error)) from error
283
285
  unresolved, iterations = loader.resolve_aliases(
284
286
  implicit=False,
285
- external=final_config["load_external_modules"],
287
+ external=self._load_external_modules,
286
288
  )
287
289
  if unresolved:
288
290
  logger.debug(f"{len(unresolved)} aliases were still unresolved after {iterations} iterations")
@@ -372,11 +374,13 @@ class PythonHandler(BaseHandler):
372
374
 
373
375
 
374
376
  def get_handler(
377
+ *,
375
378
  theme: str,
376
379
  custom_templates: str | None = None,
377
380
  config_file_path: str | None = None,
378
381
  paths: list[str] | None = None,
379
382
  locale: str = "en",
383
+ load_external_modules: bool = False,
380
384
  **config: Any, # noqa: ARG001
381
385
  ) -> PythonHandler:
382
386
  """Simply return an instance of `PythonHandler`.
@@ -387,6 +391,7 @@ def get_handler(
387
391
  config_file_path: The MkDocs configuration file path.
388
392
  paths: A list of paths to use as Griffe search paths.
389
393
  locale: The locale to use when rendering content.
394
+ load_external_modules: Load external modules when resolving aliases.
390
395
  **config: Configuration passed to the handler.
391
396
 
392
397
  Returns:
@@ -399,4 +404,5 @@ def get_handler(
399
404
  config_file_path=config_file_path,
400
405
  paths=paths,
401
406
  locale=locale,
407
+ load_external_modules=load_external_modules,
402
408
  )
@@ -351,14 +351,17 @@ def do_filter_objects(
351
351
  @lru_cache(maxsize=1)
352
352
  def _get_black_formatter() -> Callable[[str, int], str]:
353
353
  try:
354
- from black import Mode, format_str
354
+ from black import InvalidInput, Mode, format_str
355
355
  except ModuleNotFoundError:
356
356
  logger.info("Formatting signatures requires Black to be installed.")
357
357
  return lambda text, _: text
358
358
 
359
359
  def formatter(code: str, line_length: int) -> str:
360
360
  mode = Mode(line_length=line_length)
361
- return format_str(code, mode=mode)
361
+ try:
362
+ return format_str(code, mode=mode)
363
+ except InvalidInput:
364
+ return code
362
365
 
363
366
  return formatter
364
367
 
@@ -40,7 +40,7 @@
40
40
  <ul>
41
41
  {% for attribute in section.value %}
42
42
  <li class="field-body">
43
- <b>{{ attribute.name }}</b>
43
+ <b><code>{{ attribute.name }}</code></b>
44
44
  {% if attribute.annotation %}
45
45
  {% with expression = attribute.annotation %}
46
46
  (<code>{% include "expression.html" with context %}</code>)
@@ -32,7 +32,7 @@
32
32
  <ul>
33
33
  {% for class in section.value %}
34
34
  <li class="field-body">
35
- <b>{{ class.name }}</b>
35
+ <b><code>{{ class.name }}</code></b>
36
36
  –
37
37
  <div class="doc-md-description">
38
38
  {{ class.description|convert_markdown(heading_level, html_id) }}
@@ -35,7 +35,7 @@
35
35
  {% for function in section.value %}
36
36
  {% if not function.name == "__init__" or not config.merge_init_into_class %}
37
37
  <li class="field-body">
38
- <b>{{ function.name }}</b>
38
+ <b><code>{{ function.name }}</code></b>
39
39
  –
40
40
  <div class="doc-md-description">
41
41
  {{ function.description|convert_markdown(heading_level, html_id) }}
@@ -32,7 +32,7 @@
32
32
  <ul>
33
33
  {% for module in section.value %}
34
34
  <li class="field-body">
35
- <b>{{ module.name }}</b>
35
+ <b><code>{{ module.name }}</code></b>
36
36
  –
37
37
  <div class="doc-md-description">
38
38
  {{ module.description|convert_markdown(heading_level, html_id) }}
@@ -40,7 +40,7 @@
40
40
  <ul>
41
41
  {% for parameter in section.value %}
42
42
  <li class="field-body">
43
- <b>{{ parameter.name }}</b>
43
+ <b><code>{{ parameter.name }}</code></b>
44
44
  {% if parameter.annotation %}
45
45
  {% with expression = parameter.annotation %}
46
46
  (<code>{% include "expression.html" with context %}</code>)
@@ -50,7 +50,7 @@
50
50
  <ul>
51
51
  {% for parameter in section.value %}
52
52
  <li class="field-body">
53
- <b>{{ parameter.name }}</b>
53
+ <b><code>{{ parameter.name }}</code></b>
54
54
  {% if parameter.annotation %}
55
55
  {% with expression = parameter.annotation %}
56
56
  (<code>{% include "expression.html" with context %}</code>
@@ -41,7 +41,7 @@
41
41
  <ul>
42
42
  {% for receives in section.value %}
43
43
  <li class="field-body">
44
- {% if receives.name %}<b>{{ receives.name }}</b>{% endif %}
44
+ {% if receives.name %}<b><code>{{ receives.name }}</code></b>{% endif %}
45
45
  {% if receives.annotation %}
46
46
  {% with expression = receives.annotation %}
47
47
  {% if receives.name %} ({% endif %}
@@ -41,7 +41,7 @@
41
41
  <ul>
42
42
  {% for returns in section.value %}
43
43
  <li class="field-body">
44
- {% if returns.name %}<b>{{ returns.name }}</b>{% endif %}
44
+ {% if returns.name %}<b><code>{{ returns.name }}</code></b>{% endif %}
45
45
  {% if returns.annotation %}
46
46
  {% with expression = returns.annotation %}
47
47
  {% if returns.name %} ({% endif %}
@@ -41,7 +41,7 @@
41
41
  <ul>
42
42
  {% for yields in section.value %}
43
43
  <li class="field-body">
44
- {% if yields.name %}<b>{{ yields.name }}</b>{% endif %}
44
+ {% if yields.name %}<b><code>{{ yields.name }}</code></b>{% endif %}
45
45
  {% if yields.annotation %}
46
46
  {% with expression = yields.annotation %}
47
47
  {% if yields.name %} ({% endif %}
@@ -14,7 +14,7 @@
14
14
  <ul class="first simple">
15
15
  {% for attribute in section.value %}
16
16
  <li>
17
- <b>{{ attribute.name }}</b>
17
+ <b><code>{{ attribute.name }}</code></b>
18
18
  {% if attribute.annotation %}
19
19
  {% with expression = attribute.annotation %}
20
20
  (<code>{% include "expression.html" with context %}</code>)
@@ -14,7 +14,7 @@
14
14
  <ul class="first simple">
15
15
  {% for parameter in section.value %}
16
16
  <li>
17
- <b>{{ parameter.name }}</b>
17
+ <b><code>{{ parameter.name }}</code></b>
18
18
  {% if parameter.annotation %}
19
19
  {% with expression = parameter.annotation %}
20
20
  (<code>{% include "expression.html" with context %}</code>)
@@ -14,7 +14,7 @@
14
14
  <ul class="first simple">
15
15
  {% for parameter in section.value %}
16
16
  <li>
17
- <b>{{ parameter.name }}</b>
17
+ <b><code>{{ parameter.name }}</code></b>
18
18
  {% if parameter.annotation %}
19
19
  {% with expression = parameter.annotation %}
20
20
  (<code>{% include "expression.html" with context %}</code>
@@ -14,7 +14,7 @@
14
14
  <ul class="first simple">
15
15
  {% for receives in section.value %}
16
16
  <li>
17
- {% if receives.name %}<b>{{ receives.name }}</b>{% endif %}
17
+ {% if receives.name %}<b><code>{{ receives.name }}</code></b>{% endif %}
18
18
  {% if receives.annotation %}
19
19
  {% with expression = receives.annotation %}
20
20
  {% if receives.name %}({% endif %}
@@ -14,7 +14,7 @@
14
14
  <ul class="first simple">
15
15
  {% for returns in section.value %}
16
16
  <li>
17
- {% if returns.name %}<b>{{ returns.name }}</b>{% endif %}
17
+ {% if returns.name %}<b><code>{{ returns.name }}</code></b>{% endif %}
18
18
  {% if returns.annotation %}
19
19
  {% with expression = returns.annotation %}
20
20
  {% if returns.name %}({% endif %}
@@ -14,7 +14,7 @@
14
14
  <ul class="first simple">
15
15
  {% for yields in section.value %}
16
16
  <li>
17
- {% if yields.name %}<b>{{ yields.name }}</b>{% endif %}
17
+ {% if yields.name %}<b></code>{{ yields.name }}</code></b>{% endif %}
18
18
  {% if yields.annotation %}
19
19
  {% with expression = yields.annotation %}
20
20
  {% if yields.name %}({% endif %}