hippogriffe 0.1.2__tar.gz → 0.1.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.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hippogriffe
3
- Version: 0.1.2
4
- Summary: A simple ipynb->md converter for MkDocs
3
+ Version: 0.1.3
4
+ Summary: Tweaks for `mkdocstrings[python]`
5
5
  Project-URL: repository, https://github.com/patrick-kidger/hippogriffe
6
6
  Author-email: Patrick Kidger <contact@kidger.site>
7
7
  License: Apache License
@@ -41,52 +41,54 @@ class _PublicApi:
41
41
  self._data: dict[str, list[str]] = {}
42
42
  self._builtin_modules = builtin_modules
43
43
  self._public_modules = stdlib_modules + extra_public_modules
44
- seen: set[griffe.Alias | griffe.Object] = set() # Don't infinite loop on cycles
44
+ # Don't infinite loop on cycles. We only store Objects, and not Aliases, as in
45
+ # cycles then the aliases with be distinct: `X.Y.X.Y` is not `X.Y`, though the
46
+ # underlying object is the same.
45
47
 
46
- agenda: list[tuple[griffe.Alias | griffe.Object, bool]] = [(pkg, False)]
48
+ agenda: list[tuple[griffe.Object, bool]] = [(pkg, False)]
49
+ seen: set[griffe.Object] = {pkg}
47
50
  while len(agenda) > 0:
48
51
  item, force_public = agenda.pop()
49
- seen.add(item)
50
- # Skip private elements
51
- if item.name.startswith("_") and not (
52
- item.name.startswith("__") and item.name.endswith("__")
53
- ):
54
- continue
55
- if isinstance(item, griffe.Alias):
56
- try:
57
- final_item = item.final_target
58
- except griffe.AliasResolutionError:
59
- continue
60
- if item.name != final_item.name:
61
- # Renaming during import counts as private.
62
- # (In particular this happens for backward compatibility, e.g.
63
- # `equinox.nn.inference_mode` and `equinox.tree_inference`.)
64
- continue
65
- else:
66
- final_item = item
67
-
68
52
  toplevel_public = item.path in top_level_public_api
69
53
  if force_public or toplevel_public:
70
54
  # If we're in the public API, then we consider all of our children to be
71
55
  # in it as well... (this saves us from having to parse out `filters` and
72
56
  # `members` from our documentation)
73
- agenda.extend(
74
- (x, True) for x in item.all_members.values() if x not in seen
75
- )
76
57
  try:
77
- paths = self._data[final_item.path]
58
+ paths = self._data[item.path]
78
59
  except KeyError:
79
- paths = self._data[final_item.path] = []
60
+ paths = self._data[item.path] = []
80
61
  paths.append(item.path)
81
- self._objects.add(final_item)
62
+ self._objects.add(item)
82
63
  if toplevel_public:
83
- self._toplevel_objects.add(final_item)
64
+ self._toplevel_objects.add(item)
65
+ sub_force_public = True
84
66
  else:
85
67
  # ...if we're not in the public API then check our members -- some of
86
68
  # them might be in the public API.
87
- agenda.extend(
88
- (x, False) for x in item.all_members.values() if x not in seen
89
- )
69
+ sub_force_public = False
70
+ for member in item.all_members.values():
71
+ # Skip private elements
72
+ if member.name.startswith("_") and not (
73
+ member.name.startswith("__") and item.name.endswith("__")
74
+ ):
75
+ continue
76
+ if isinstance(member, griffe.Alias):
77
+ try:
78
+ final_member = member.final_target
79
+ except griffe.AliasResolutionError:
80
+ continue
81
+ if member.name != final_member.name:
82
+ # Renaming during import counts as private.
83
+ # (In particular this happens for backward compatibility, e.g.
84
+ # `equinox.nn.inference_mode` and `equinox.tree_inference`.)
85
+ continue
86
+ else:
87
+ final_member = member
88
+ if final_member in seen:
89
+ continue
90
+ agenda.append((final_member, sub_force_public))
91
+ seen.add(final_member)
90
92
 
91
93
  def toplevel(self) -> Iterable[griffe.Object]:
92
94
  return self._toplevel_objects
@@ -18,14 +18,14 @@ dependencies = [
18
18
  "mkdocstrings[python]>=0.28.3",
19
19
  "wadler_lindig>=0.1.4"
20
20
  ]
21
- description = "A simple ipynb->md converter for MkDocs"
21
+ description = "Tweaks for `mkdocstrings[python]`"
22
22
  keywords = ["mkdocs", "mkdocstrings", "griffe", "md", "markdown"]
23
23
  license = {file = "LICENSE"}
24
24
  name = "hippogriffe"
25
25
  readme = "README.md"
26
26
  requires-python = ">=3.10"
27
27
  urls = {repository = "https://github.com/patrick-kidger/hippogriffe"}
28
- version = "0.1.2"
28
+ version = "0.1.3"
29
29
 
30
30
  [project.optional-dependencies]
31
31
  dev = ["pre-commit"]
File without changes
File without changes
File without changes