hippogriffe 0.1.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.
@@ -0,0 +1,16 @@
1
+ **/__pycache__
2
+ **/.ipynb_checkpoints
3
+ *.egg-info/
4
+ build/
5
+ dist/
6
+ site/
7
+ examples/data
8
+ examples/CIFAR
9
+ .all_objects.cache
10
+ .pymon
11
+ .idea
12
+ examples/MNIST
13
+ examples/multipart_serialised.eqx
14
+ .python-version
15
+ .DS_Store
16
+ .venv
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,294 @@
1
+ Metadata-Version: 2.4
2
+ Name: hippogriffe
3
+ Version: 0.1.0
4
+ Summary: A simple ipynb->md converter for MkDocs
5
+ Project-URL: repository, https://github.com/patrick-kidger/hippogriffe
6
+ Author-email: Patrick Kidger <contact@kidger.site>
7
+ License: Apache License
8
+ Version 2.0, January 2004
9
+ http://www.apache.org/licenses/
10
+
11
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
12
+
13
+ 1. Definitions.
14
+
15
+ "License" shall mean the terms and conditions for use, reproduction,
16
+ and distribution as defined by Sections 1 through 9 of this document.
17
+
18
+ "Licensor" shall mean the copyright owner or entity authorized by
19
+ the copyright owner that is granting the License.
20
+
21
+ "Legal Entity" shall mean the union of the acting entity and all
22
+ other entities that control, are controlled by, or are under common
23
+ control with that entity. For the purposes of this definition,
24
+ "control" means (i) the power, direct or indirect, to cause the
25
+ direction or management of such entity, whether by contract or
26
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
27
+ outstanding shares, or (iii) beneficial ownership of such entity.
28
+
29
+ "You" (or "Your") shall mean an individual or Legal Entity
30
+ exercising permissions granted by this License.
31
+
32
+ "Source" form shall mean the preferred form for making modifications,
33
+ including but not limited to software source code, documentation
34
+ source, and configuration files.
35
+
36
+ "Object" form shall mean any form resulting from mechanical
37
+ transformation or translation of a Source form, including but
38
+ not limited to compiled object code, generated documentation,
39
+ and conversions to other media types.
40
+
41
+ "Work" shall mean the work of authorship, whether in Source or
42
+ Object form, made available under the License, as indicated by a
43
+ copyright notice that is included in or attached to the work
44
+ (an example is provided in the Appendix below).
45
+
46
+ "Derivative Works" shall mean any work, whether in Source or Object
47
+ form, that is based on (or derived from) the Work and for which the
48
+ editorial revisions, annotations, elaborations, or other modifications
49
+ represent, as a whole, an original work of authorship. For the purposes
50
+ of this License, Derivative Works shall not include works that remain
51
+ separable from, or merely link (or bind by name) to the interfaces of,
52
+ the Work and Derivative Works thereof.
53
+
54
+ "Contribution" shall mean any work of authorship, including
55
+ the original version of the Work and any modifications or additions
56
+ to that Work or Derivative Works thereof, that is intentionally
57
+ submitted to Licensor for inclusion in the Work by the copyright owner
58
+ or by an individual or Legal Entity authorized to submit on behalf of
59
+ the copyright owner. For the purposes of this definition, "submitted"
60
+ means any form of electronic, verbal, or written communication sent
61
+ to the Licensor or its representatives, including but not limited to
62
+ communication on electronic mailing lists, source code control systems,
63
+ and issue tracking systems that are managed by, or on behalf of, the
64
+ Licensor for the purpose of discussing and improving the Work, but
65
+ excluding communication that is conspicuously marked or otherwise
66
+ designated in writing by the copyright owner as "Not a Contribution."
67
+
68
+ "Contributor" shall mean Licensor and any individual or Legal Entity
69
+ on behalf of whom a Contribution has been received by Licensor and
70
+ subsequently incorporated within the Work.
71
+
72
+ 2. Grant of Copyright License. Subject to the terms and conditions of
73
+ this License, each Contributor hereby grants to You a perpetual,
74
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
75
+ copyright license to reproduce, prepare Derivative Works of,
76
+ publicly display, publicly perform, sublicense, and distribute the
77
+ Work and such Derivative Works in Source or Object form.
78
+
79
+ 3. Grant of Patent License. Subject to the terms and conditions of
80
+ this License, each Contributor hereby grants to You a perpetual,
81
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
82
+ (except as stated in this section) patent license to make, have made,
83
+ use, offer to sell, sell, import, and otherwise transfer the Work,
84
+ where such license applies only to those patent claims licensable
85
+ by such Contributor that are necessarily infringed by their
86
+ Contribution(s) alone or by combination of their Contribution(s)
87
+ with the Work to which such Contribution(s) was submitted. If You
88
+ institute patent litigation against any entity (including a
89
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
90
+ or a Contribution incorporated within the Work constitutes direct
91
+ or contributory patent infringement, then any patent licenses
92
+ granted to You under this License for that Work shall terminate
93
+ as of the date such litigation is filed.
94
+
95
+ 4. Redistribution. You may reproduce and distribute copies of the
96
+ Work or Derivative Works thereof in any medium, with or without
97
+ modifications, and in Source or Object form, provided that You
98
+ meet the following conditions:
99
+
100
+ (a) You must give any other recipients of the Work or
101
+ Derivative Works a copy of this License; and
102
+
103
+ (b) You must cause any modified files to carry prominent notices
104
+ stating that You changed the files; and
105
+
106
+ (c) You must retain, in the Source form of any Derivative Works
107
+ that You distribute, all copyright, patent, trademark, and
108
+ attribution notices from the Source form of the Work,
109
+ excluding those notices that do not pertain to any part of
110
+ the Derivative Works; and
111
+
112
+ (d) If the Work includes a "NOTICE" text file as part of its
113
+ distribution, then any Derivative Works that You distribute must
114
+ include a readable copy of the attribution notices contained
115
+ within such NOTICE file, excluding those notices that do not
116
+ pertain to any part of the Derivative Works, in at least one
117
+ of the following places: within a NOTICE text file distributed
118
+ as part of the Derivative Works; within the Source form or
119
+ documentation, if provided along with the Derivative Works; or,
120
+ within a display generated by the Derivative Works, if and
121
+ wherever such third-party notices normally appear. The contents
122
+ of the NOTICE file are for informational purposes only and
123
+ do not modify the License. You may add Your own attribution
124
+ notices within Derivative Works that You distribute, alongside
125
+ or as an addendum to the NOTICE text from the Work, provided
126
+ that such additional attribution notices cannot be construed
127
+ as modifying the License.
128
+
129
+ You may add Your own copyright statement to Your modifications and
130
+ may provide additional or different license terms and conditions
131
+ for use, reproduction, or distribution of Your modifications, or
132
+ for any such Derivative Works as a whole, provided Your use,
133
+ reproduction, and distribution of the Work otherwise complies with
134
+ the conditions stated in this License.
135
+
136
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
137
+ any Contribution intentionally submitted for inclusion in the Work
138
+ by You to the Licensor shall be under the terms and conditions of
139
+ this License, without any additional terms or conditions.
140
+ Notwithstanding the above, nothing herein shall supersede or modify
141
+ the terms of any separate license agreement you may have executed
142
+ with Licensor regarding such Contributions.
143
+
144
+ 6. Trademarks. This License does not grant permission to use the trade
145
+ names, trademarks, service marks, or product names of the Licensor,
146
+ except as required for reasonable and customary use in describing the
147
+ origin of the Work and reproducing the content of the NOTICE file.
148
+
149
+ 7. Disclaimer of Warranty. Unless required by applicable law or
150
+ agreed to in writing, Licensor provides the Work (and each
151
+ Contributor provides its Contributions) on an "AS IS" BASIS,
152
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
153
+ implied, including, without limitation, any warranties or conditions
154
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
155
+ PARTICULAR PURPOSE. You are solely responsible for determining the
156
+ appropriateness of using or redistributing the Work and assume any
157
+ risks associated with Your exercise of permissions under this License.
158
+
159
+ 8. Limitation of Liability. In no event and under no legal theory,
160
+ whether in tort (including negligence), contract, or otherwise,
161
+ unless required by applicable law (such as deliberate and grossly
162
+ negligent acts) or agreed to in writing, shall any Contributor be
163
+ liable to You for damages, including any direct, indirect, special,
164
+ incidental, or consequential damages of any character arising as a
165
+ result of this License or out of the use or inability to use the
166
+ Work (including but not limited to damages for loss of goodwill,
167
+ work stoppage, computer failure or malfunction, or any and all
168
+ other commercial damages or losses), even if such Contributor
169
+ has been advised of the possibility of such damages.
170
+
171
+ 9. Accepting Warranty or Additional Liability. While redistributing
172
+ the Work or Derivative Works thereof, You may choose to offer,
173
+ and charge a fee for, acceptance of support, warranty, indemnity,
174
+ or other liability obligations and/or rights consistent with this
175
+ License. However, in accepting such obligations, You may act only
176
+ on Your own behalf and on Your sole responsibility, not on behalf
177
+ of any other Contributor, and only if You agree to indemnify,
178
+ defend, and hold each Contributor harmless for any liability
179
+ incurred by, or claims asserted against, such Contributor by reason
180
+ of your accepting any such warranty or additional liability.
181
+
182
+ END OF TERMS AND CONDITIONS
183
+
184
+ APPENDIX: How to apply the Apache License to your work.
185
+
186
+ To apply the Apache License to your work, attach the following
187
+ boilerplate notice, with the fields enclosed by brackets "[]"
188
+ replaced with your own identifying information. (Don't include
189
+ the brackets!) The text should be enclosed in the appropriate
190
+ comment syntax for the file format. We also recommend that a
191
+ file or class name and description of purpose be included on the
192
+ same "printed page" as the copyright notice for easier
193
+ identification within third-party archives.
194
+
195
+ Copyright [yyyy] [name of copyright owner]
196
+
197
+ Licensed under the Apache License, Version 2.0 (the "License");
198
+ you may not use this file except in compliance with the License.
199
+ You may obtain a copy of the License at
200
+
201
+ http://www.apache.org/licenses/LICENSE-2.0
202
+
203
+ Unless required by applicable law or agreed to in writing, software
204
+ distributed under the License is distributed on an "AS IS" BASIS,
205
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
206
+ See the License for the specific language governing permissions and
207
+ limitations under the License.
208
+ License-File: LICENSE
209
+ Keywords: griffe,markdown,md,mkdocs,mkdocstrings
210
+ Classifier: Development Status :: 3 - Alpha
211
+ Classifier: License :: OSI Approved :: Apache Software License
212
+ Classifier: Natural Language :: English
213
+ Classifier: Programming Language :: Python :: 3
214
+ Requires-Python: >=3.10
215
+ Requires-Dist: griffe>=1.6.0
216
+ Requires-Dist: mkdocs>=1.6.1
217
+ Requires-Dist: mkdocstrings[python]>=0.28.3
218
+ Requires-Dist: wadler-lindig>=0.1.4
219
+ Provides-Extra: dev
220
+ Requires-Dist: pre-commit; extra == 'dev'
221
+ Description-Content-Type: text/markdown
222
+
223
+ <h1 align="center">Hippogriffe</h1>
224
+
225
+ This is a set of tweaks on top of the MkDocs + `mkdocstrings[python]` + `griffe` documentation stack. In particular, we:
226
+
227
+ - Add `[source]` links to GitHub to each top-level class or function.
228
+ - Pretty-format type annotations:
229
+ - Fixes unions/generics/etc. to display as e.g. `int | str` rather than just `Union`, or `tuple[int, str]` rather than just `tuple`.
230
+ - Respects your public API: if a type is declared in your documentation as `::: yourlib.Foo` then its usage in type annotations will match: `some_fn(foo: yourlib.Foo)`.
231
+ - Show base classes inline after the class.
232
+
233
+ Before | After
234
+ :---------------------:|:----------------------:
235
+ ![old](./imgs/old.png) | ![new](./imgs/new.png)
236
+
237
+ ## Installation
238
+
239
+ ```bash
240
+ pip install hippogriffe
241
+ ```
242
+
243
+ Requires MkDocs 1.6.1+ and `mkdocstrings[python]` 0.28.3+
244
+
245
+ ## Usage
246
+
247
+ In `mkdocs.yml`:
248
+ ```yml
249
+ ...
250
+
251
+ plugins:
252
+ - hippogriffe
253
+ - mkdocstrings:
254
+ ...
255
+ ```
256
+
257
+ ## Configuration
258
+
259
+ Hippogriffe supports the following configuration options:
260
+
261
+ ```yml
262
+ plugins:
263
+ - hippogriffe:
264
+ show_bases: true/false
265
+ show_source_links: all/toplevel/none
266
+ extra_public_modules:
267
+ - foo
268
+ - bar
269
+ ```
270
+
271
+ **show_bases:**
272
+
273
+ If `false` then base classes will not be displayed alongside a class. Defaults to `true`.
274
+
275
+ **show_source_links:**
276
+
277
+ Sets which objects will have links to their location in the repository (as configured via the usual MkDocs `repo_url`). If `all` then all objects will have links. If `toplevel` then just `::: somelib.value` will have links, but their members will not. If `none` then no links will be added. Defaults to `toplevel`.
278
+
279
+ **extra_public_modules:**
280
+
281
+ A list of module names whose elements should be treated as part of the public API. Pretty-formatting of type annotations is done strictly: every annotation must be part of the known public API, else an error will be raised. The public API is defined as the combination of:
282
+
283
+ - Everything you document using `::: yourlib.Foo`, and all of their members.
284
+ - Anything from the standard library.
285
+ - All objects belonging to any of `extra_public_modules`.
286
+
287
+ For example,
288
+ ```yml
289
+ plugins:
290
+ - hippogriffe:
291
+ extra_public_modules:
292
+ - jax
293
+ - torch
294
+ ```
@@ -0,0 +1,72 @@
1
+ <h1 align="center">Hippogriffe</h1>
2
+
3
+ This is a set of tweaks on top of the MkDocs + `mkdocstrings[python]` + `griffe` documentation stack. In particular, we:
4
+
5
+ - Add `[source]` links to GitHub to each top-level class or function.
6
+ - Pretty-format type annotations:
7
+ - Fixes unions/generics/etc. to display as e.g. `int | str` rather than just `Union`, or `tuple[int, str]` rather than just `tuple`.
8
+ - Respects your public API: if a type is declared in your documentation as `::: yourlib.Foo` then its usage in type annotations will match: `some_fn(foo: yourlib.Foo)`.
9
+ - Show base classes inline after the class.
10
+
11
+ Before | After
12
+ :---------------------:|:----------------------:
13
+ ![old](./imgs/old.png) | ![new](./imgs/new.png)
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pip install hippogriffe
19
+ ```
20
+
21
+ Requires MkDocs 1.6.1+ and `mkdocstrings[python]` 0.28.3+
22
+
23
+ ## Usage
24
+
25
+ In `mkdocs.yml`:
26
+ ```yml
27
+ ...
28
+
29
+ plugins:
30
+ - hippogriffe
31
+ - mkdocstrings:
32
+ ...
33
+ ```
34
+
35
+ ## Configuration
36
+
37
+ Hippogriffe supports the following configuration options:
38
+
39
+ ```yml
40
+ plugins:
41
+ - hippogriffe:
42
+ show_bases: true/false
43
+ show_source_links: all/toplevel/none
44
+ extra_public_modules:
45
+ - foo
46
+ - bar
47
+ ```
48
+
49
+ **show_bases:**
50
+
51
+ If `false` then base classes will not be displayed alongside a class. Defaults to `true`.
52
+
53
+ **show_source_links:**
54
+
55
+ Sets which objects will have links to their location in the repository (as configured via the usual MkDocs `repo_url`). If `all` then all objects will have links. If `toplevel` then just `::: somelib.value` will have links, but their members will not. If `none` then no links will be added. Defaults to `toplevel`.
56
+
57
+ **extra_public_modules:**
58
+
59
+ A list of module names whose elements should be treated as part of the public API. Pretty-formatting of type annotations is done strictly: every annotation must be part of the known public API, else an error will be raised. The public API is defined as the combination of:
60
+
61
+ - Everything you document using `::: yourlib.Foo`, and all of their members.
62
+ - Anything from the standard library.
63
+ - All objects belonging to any of `extra_public_modules`.
64
+
65
+ For example,
66
+ ```yml
67
+ plugins:
68
+ - hippogriffe:
69
+ extra_public_modules:
70
+ - jax
71
+ - torch
72
+ ```
File without changes
@@ -0,0 +1,350 @@
1
+ import ast
2
+ import builtins
3
+ import contextlib
4
+ import functools as ft
5
+ import inspect
6
+ import pathlib
7
+ import re
8
+ import subprocess
9
+ import sys
10
+ from collections.abc import Callable
11
+ from typing import Any, Iterable, Iterator, Literal, get_origin
12
+
13
+ import griffe
14
+ import wadler_lindig as wl
15
+
16
+ from ._plugin import PluginConfig
17
+
18
+
19
+ _here = pathlib.Path(__file__).resolve().parent
20
+
21
+
22
+ def get_templates_path():
23
+ return _here / "templates"
24
+
25
+
26
+ class _PublicApi:
27
+ def __init__(
28
+ self,
29
+ pkg: griffe.Module,
30
+ top_level_public_api: set[str],
31
+ builtin_modules: list[str],
32
+ stdlib_modules: list[str],
33
+ extra_public_modules: list[str],
34
+ ):
35
+ self._objects: set[griffe.Object] = set()
36
+ self._toplevel_objects: set[griffe.Object] = set()
37
+ self._data: dict[str, list[str]] = {}
38
+ self._builtin_modules = builtin_modules
39
+ self._public_modules = stdlib_modules + extra_public_modules
40
+ seen: set[griffe.Alias | griffe.Object] = set() # Don't infinite loop on cycles
41
+
42
+ agenda: list[tuple[griffe.Alias | griffe.Object, bool]] = [(pkg, False)]
43
+ while len(agenda) > 0:
44
+ item, force_public = agenda.pop()
45
+ seen.add(item)
46
+ # Skip private elements
47
+ if item.name.startswith("_") and not (
48
+ item.name.startswith("__") and item.name.endswith("__")
49
+ ):
50
+ continue
51
+ if isinstance(item, griffe.Alias):
52
+ try:
53
+ final_item = item.final_target
54
+ except griffe.AliasResolutionError:
55
+ continue
56
+ if item.name != final_item.name:
57
+ # Renaming during import counts as private.
58
+ # (In particular this happens for backward compatibility, e.g.
59
+ # `equinox.nn.inference_mode` and `equinox.tree_inference`.)
60
+ continue
61
+ else:
62
+ final_item = item
63
+
64
+ toplevel_public = item.path in top_level_public_api
65
+ if force_public or toplevel_public:
66
+ # If we're in the public API, then we consider all of our children to be
67
+ # in it as well... (this saves us from having to parse out `filters` and
68
+ # `members` from our documentation)
69
+ agenda.extend(
70
+ (x, True) for x in item.all_members.values() if x not in seen
71
+ )
72
+ try:
73
+ paths = self._data[final_item.path]
74
+ except KeyError:
75
+ paths = self._data[final_item.path] = []
76
+ paths.append(item.path)
77
+ self._objects.add(final_item)
78
+ if toplevel_public:
79
+ self._toplevel_objects.add(final_item)
80
+ else:
81
+ # ...if we're not in the public API then check our members -- some of
82
+ # them might be in the public API.
83
+ agenda.extend(
84
+ (x, False) for x in item.all_members.values() if x not in seen
85
+ )
86
+
87
+ def toplevel(self) -> Iterable[griffe.Object]:
88
+ return self._toplevel_objects
89
+
90
+ def __iter__(self) -> Iterator[griffe.Object]:
91
+ yield from self._objects
92
+
93
+ def __getitem__(self, key: str) -> tuple[str, bool]:
94
+ try:
95
+ paths = self._data[key]
96
+ except KeyError as e:
97
+ for m in self._builtin_modules:
98
+ if key.startswith(m + "."):
99
+ return key.removeprefix(m + "."), False
100
+ for m in self._public_modules:
101
+ if key.startswith(m + "."):
102
+ return key, False
103
+ raise Exception(
104
+ f"Tried and failed to find {key} in the public API. Commons reasons "
105
+ "for this error are:\n"
106
+ "- If it is from outside this package, then that package is not listed "
107
+ "under the `hippogriffe.extra_public_modules`\n"
108
+ "- If it is from inside this package, then it may have been written "
109
+ "`::: somelib.Foo:` with a trailing colon, when just `:::somelib.Foo` "
110
+ "is correct."
111
+ ) from e
112
+ if len(paths) == 1:
113
+ return paths[0], True
114
+ else:
115
+ raise ValueError(f"{key} has multiple paths in the public API: {paths}")
116
+
117
+
118
+ _kind_map = {
119
+ inspect.Parameter.POSITIONAL_ONLY: griffe.ParameterKind.positional_only,
120
+ inspect.Parameter.POSITIONAL_OR_KEYWORD: griffe.ParameterKind.positional_or_keyword,
121
+ inspect.Parameter.VAR_POSITIONAL: griffe.ParameterKind.var_positional,
122
+ inspect.Parameter.KEYWORD_ONLY: griffe.ParameterKind.keyword_only,
123
+ inspect.Parameter.VAR_KEYWORD: griffe.ParameterKind.var_keyword,
124
+ }
125
+
126
+
127
+ def _pretty_annotation(
128
+ annotation,
129
+ context: dict,
130
+ use_public_name: Callable[[None | dict, Any], None | wl.AbstractDoc],
131
+ ):
132
+ if annotation is inspect.Signature.empty:
133
+ return None
134
+ else:
135
+ return wl.pformat(
136
+ annotation, custom=ft.partial(use_public_name, context), width=9999
137
+ )
138
+
139
+
140
+ def _pretty_param(
141
+ param: inspect.Parameter,
142
+ context: dict,
143
+ use_public_name: Callable[[None | dict, Any], None | wl.AbstractDoc],
144
+ ) -> griffe.Parameter:
145
+ annotation = _pretty_annotation(param.annotation, context, use_public_name)
146
+ if param.default is inspect.Signature.empty:
147
+ default = None
148
+ else:
149
+ default = wl.pformat(
150
+ param.default, custom=ft.partial(use_public_name, None), width=9999
151
+ )
152
+ return griffe.Parameter(
153
+ name=param.name,
154
+ annotation=annotation,
155
+ kind=_kind_map[param.kind],
156
+ default=default,
157
+ )
158
+
159
+
160
+ def _pretty_fn(
161
+ obj: griffe.Function,
162
+ use_public_name: Callable[[None | dict, Any], None | wl.AbstractDoc],
163
+ ) -> None:
164
+ try:
165
+ module = sys.modules[obj.module.path]
166
+ except KeyError:
167
+ context = {}
168
+ else:
169
+ context = module.__dict__
170
+ signature: inspect.Signature = obj.extra["hippogriffe"]["signature"]
171
+ obj.parameters = griffe.Parameters(
172
+ *[
173
+ _pretty_param(param, context, use_public_name)
174
+ for param in signature.parameters.values()
175
+ ]
176
+ )
177
+ signature.return_annotation
178
+ obj.returns = _pretty_annotation(
179
+ signature.return_annotation, context, use_public_name
180
+ )
181
+
182
+
183
+ _builtin_re = re.compile(r"builtins\.(\w+)")
184
+
185
+
186
+ # Modified version of `griffe.Class.resolved_bases`, so as not to drop builtins.
187
+ def _resolved_bases(cls: griffe.Class) -> list[str | griffe.Object]:
188
+ resolved_bases = []
189
+ for base in cls.bases:
190
+ base_path = base if isinstance(base, str) else base.canonical_path
191
+ match = _builtin_re.match(base_path)
192
+ with contextlib.suppress(
193
+ griffe.AliasResolutionError, griffe.CyclicAliasError, KeyError
194
+ ):
195
+ if match is None:
196
+ resolved_base = cls.modules_collection[base_path]
197
+ if resolved_base.is_alias:
198
+ resolved_base = resolved_base.final_target
199
+ else:
200
+ resolved_base = match.group(1)
201
+ if not hasattr(builtins, resolved_base):
202
+ raise KeyError
203
+ resolved_bases.append(resolved_base)
204
+ return resolved_bases
205
+
206
+
207
+ def _collect_bases(
208
+ cls: griffe.Class, public_api: _PublicApi, public_modules: set[str]
209
+ ) -> dict[str, bool]:
210
+ bases: dict[str, bool] = {}
211
+ for base in _resolved_bases(cls):
212
+ if isinstance(base, str):
213
+ # builtins case above
214
+ if "builtins" in public_modules:
215
+ bases[base] = False
216
+ elif isinstance(base, griffe.Class):
217
+ try:
218
+ base, autoref = public_api[base.path]
219
+ except KeyError:
220
+ bases.update(_collect_bases(base, public_api, public_modules))
221
+ else:
222
+ bases[base] = autoref
223
+ return bases
224
+
225
+
226
+ @ft.cache
227
+ def _get_repo_url(repo_url: None | str) -> tuple[pathlib.Path, str]:
228
+ if repo_url is None:
229
+ raise ValueError(
230
+ "`hippogriffe.show_source_links` requires specifying a top-level "
231
+ "`repo_url`."
232
+ )
233
+ is_github = (
234
+ repo_url.removeprefix("https://")
235
+ .removeprefix("https://")
236
+ .startswith("github.com")
237
+ )
238
+ if not is_github:
239
+ # We need to format the `repo_url` to what the repo expects, so we have to
240
+ # hardcode this in.
241
+ raise ValueError(
242
+ "`hippogriffe.show_source_links` currently only supports "
243
+ "`repo_url: https://github.com/...`."
244
+ )
245
+ try:
246
+ git_head = subprocess.run(
247
+ ["git", "rev-parse", "HEAD"], capture_output=True, check=False
248
+ )
249
+ git_toplevel = subprocess.run(
250
+ ["git", "rev-parse", "--show-toplevel"], capture_output=True, check=False
251
+ )
252
+ if git_head.returncode != 0 or git_toplevel.returncode != 0:
253
+ raise FileNotFoundError
254
+ except FileNotFoundError as e:
255
+ raise ValueError(
256
+ "`hippogriffe.show_source_links` requires running from a git repository, "
257
+ "but could not find git commit hash or root."
258
+ ) from e
259
+ else:
260
+ toplevel = pathlib.Path(git_toplevel.stdout.decode().strip())
261
+ commit_hash = git_head.stdout.decode().strip()
262
+ repo_url = (
263
+ f"{repo_url.removesuffix('/')}/blob/{commit_hash}/{{path}}#L{{start}}-{{end}}"
264
+ )
265
+ return toplevel, repo_url
266
+
267
+
268
+ class HippogriffeExtension(griffe.Extension):
269
+ def __init__(
270
+ self, config: PluginConfig, repo_url: None | str, top_level_public_api: set[str]
271
+ ):
272
+ self.config = config
273
+ self.repo_url = repo_url
274
+ self.top_level_public_api = top_level_public_api
275
+
276
+ def on_function_instance(
277
+ self,
278
+ *,
279
+ node: ast.AST | griffe.ObjectNode,
280
+ func: griffe.Function,
281
+ agent: griffe.Visitor | griffe.Inspector,
282
+ **kwargs: Any,
283
+ ) -> None:
284
+ del agent, kwargs
285
+ assert not isinstance(node, ast.AST)
286
+ func.extra["hippogriffe"]["signature"] = inspect.signature(node.obj)
287
+
288
+ def on_package_loaded(
289
+ self, *, pkg: griffe.Module, loader: griffe.GriffeLoader, **kwargs: Any
290
+ ) -> None:
291
+ assert self.top_level_public_api != {""}
292
+ del loader, kwargs
293
+
294
+ public_api = _PublicApi(
295
+ pkg,
296
+ top_level_public_api=self.top_level_public_api,
297
+ builtin_modules=self.config.builtin_modules,
298
+ stdlib_modules=self.config.stdlib_modules,
299
+ extra_public_modules=self.config.extra_public_modules,
300
+ )
301
+
302
+ def use_public_name(context: None | dict, obj: Any) -> None | wl.AbstractDoc:
303
+ # If we hit a Literal then don't try to convert any of its string-typed
304
+ # elements into types...
305
+ if get_origin(obj) is Literal:
306
+ return wl.pdoc(obj, width=9999)
307
+ # ...but otherwise do attempt to resolve strings into types.
308
+ if context is not None and isinstance(obj, str):
309
+ with contextlib.suppress(BaseException):
310
+ obj = eval(obj, context)
311
+ # Then if it's in the public API, convert it over.
312
+ if isinstance(obj, type) and obj is not type(None):
313
+ new_path, _ = public_api[f"{obj.__module__}.{obj.__qualname__}"]
314
+ return wl.TextDoc(new_path)
315
+
316
+ public_modules = set(self.config.extra_public_modules) | set(
317
+ self.config.stdlib_modules
318
+ )
319
+ for obj in public_api:
320
+ if obj.is_function:
321
+ assert type(obj) is griffe.Function
322
+ obj.extra["mkdocstrings"]["template"] = "hippogriffe/fn.html.jinja"
323
+ _pretty_fn(obj, use_public_name)
324
+ elif obj.is_class:
325
+ assert type(obj) is griffe.Class
326
+ obj.extra["mkdocstrings"]["template"] = "hippogriffe/class.html.jinja"
327
+ if self.config.show_bases:
328
+ public_bases = list(
329
+ _collect_bases(obj, public_api, public_modules).items()
330
+ )
331
+ obj.extra["hippogriffe"]["public_bases"] = public_bases
332
+
333
+ if self.config.show_source_links == "none":
334
+ api_iterable = ()
335
+ elif self.config.show_source_links == "toplevel":
336
+ api_iterable = public_api.toplevel()
337
+ elif self.config.show_source_links == "all":
338
+ api_iterable = public_api
339
+ else:
340
+ assert False
341
+ for obj in api_iterable:
342
+ if (
343
+ obj.lineno is not None
344
+ and obj.endlineno is not None
345
+ and isinstance(obj.filepath, pathlib.Path)
346
+ ):
347
+ toplevel, repo_url = _get_repo_url(self.repo_url)
348
+ path = obj.filepath.relative_to(toplevel)
349
+ url = repo_url.format(path=path, start=obj.lineno, end=obj.endlineno)
350
+ obj.extra["hippogriffe"]["url"] = url
@@ -0,0 +1,115 @@
1
+ import pathlib
2
+ import re
3
+ import sys
4
+ import typing
5
+
6
+ from mkdocs.config import Config
7
+ from mkdocs.config.config_options import Choice, Type
8
+ from mkdocs.config.defaults import MkDocsConfig
9
+ from mkdocs.plugins import BasePlugin, event_priority
10
+ from mkdocs.structure.files import File, Files, InclusionLevel
11
+ from mkdocstrings import AutoDocProcessor
12
+
13
+
14
+ _here = pathlib.Path(__file__).resolve().parent
15
+
16
+
17
+ class PluginConfig(Config):
18
+ show_bases = Type(bool, default=True)
19
+ """Whether to show class bases in-line with their name."""
20
+
21
+ show_source_links = Choice(["all", "toplevel", "none"], default="toplevel")
22
+ """Whether to include [source] links to the repo."""
23
+
24
+ extra_public_modules = Type(list, default=[])
25
+ """Any third-party modules whose objects are allowed in the public API."""
26
+
27
+ stdlib_modules = Type(list, default=list(sys.stdlib_module_names))
28
+ """A list of stdlib modules. This is concatenated with `extra_public_modules` to
29
+ form the list of external modules that are allowed in the public API
30
+ """
31
+
32
+ builtin_modules = Type(
33
+ list, default=["builtins", "collections.abc", "typing", "typing_extensions"]
34
+ )
35
+ """A list of 'builtin' module names we should strip from pretty type annotations.
36
+ For example `Sequence[Literal[1]]` instead of
37
+ `collections.abc.Sequence[typing_extensions.Literal[1]]`
38
+ """
39
+
40
+
41
+ def _get_options(config: MkDocsConfig) -> dict:
42
+ mkdocstrings_config = config.plugins["mkdocstrings"].config
43
+ options = (
44
+ mkdocstrings_config.setdefault("handlers", {})
45
+ .setdefault("python", {})
46
+ .setdefault("options", {})
47
+ )
48
+ return options
49
+
50
+
51
+ class HippogriffePlugin(BasePlugin[PluginConfig]):
52
+ css_filename: str = "assets/_hippogriffe.css"
53
+
54
+ @event_priority(50) # Before mkdocstrings
55
+ def on_config(self, config: MkDocsConfig) -> MkDocsConfig | None:
56
+ # Using the normalisation from https://peps.python.org/pep-0503/#normalized-names
57
+ # We extend it to also replace en dashes and em dashes.
58
+ # Not perfect but it should do.
59
+ typing.GENERATING_DOCUMENTATION = re.sub( # pyright: ignore[reportAttributeAccessIssue]
60
+ r"[-_.–—]+", "-", config.site_name
61
+ ).lower()
62
+
63
+ options = _get_options(config)
64
+ if options.get("force_inspection", False) is not True:
65
+ raise ValueError(
66
+ "hippogriffe requires "
67
+ "`mkdocstrings.python.options.force_inspection: true`. (This is so it "
68
+ "can do things like display type annotations correctly.)"
69
+ )
70
+ extensions = options.setdefault("extensions", [])
71
+ extensions.append(
72
+ {
73
+ "hippogriffe._extension": {
74
+ "config": self.config,
75
+ "repo_url": config.repo_url,
76
+ "top_level_public_api": {""},
77
+ }
78
+ }
79
+ )
80
+ # Lower priority than user files
81
+ config.extra_css.insert(0, self.css_filename)
82
+ if self.config.show_bases and options.get("merge_init_into_class", False):
83
+ raise ValueError(
84
+ "Cannot set both `hippogriffe.show_bases: true` and "
85
+ "`mkdocstrings.python.options.merge_init_into_class: true`, as they "
86
+ "use the same space in the documentation."
87
+ )
88
+
89
+ @event_priority(-50) # After other plugins have generated files
90
+ def on_files(self, files: Files, /, *, config: MkDocsConfig) -> Files | None:
91
+ for extension in _get_options(config)["extensions"]:
92
+ if type(extension) is dict and set(extension.keys()) == {
93
+ "hippogriffe._extension"
94
+ }:
95
+ top_level_public_api = extension["hippogriffe._extension"][
96
+ "top_level_public_api"
97
+ ]
98
+ assert top_level_public_api == {""}
99
+ break
100
+ else:
101
+ assert False
102
+ top_level_public_api.remove("")
103
+ for file in files:
104
+ if file.is_documentation_page():
105
+ for match in AutoDocProcessor.regex.finditer(file.content_string):
106
+ top_level_public_api.add(match["name"])
107
+ files.append(
108
+ File.generated(
109
+ config=config,
110
+ src_uri=self.css_filename,
111
+ abs_src_path=str(_here / self.css_filename),
112
+ inclusion=InclusionLevel.INCLUDED,
113
+ )
114
+ )
115
+ return files
@@ -0,0 +1,8 @@
1
+ code.hippogriffe-repo-url {
2
+ background-color: rgba(0,0,0,0);
3
+ }
4
+
5
+ code.hippogriffe-repo-url::after {
6
+ font-size: 0.7rem;
7
+ content: "[source]";
8
+ }
@@ -0,0 +1,22 @@
1
+ {% extends "_base/class.html.jinja" %}
2
+ {% import "hippogriffe/hippogriffe.jinja" as hippogriffe %}
3
+
4
+ {% block heading %}
5
+ {#- Heading block.
6
+
7
+ This block renders the heading for the class.
8
+ -#}
9
+ {% if config.show_symbol_type_heading %}<code class="doc-symbol doc-symbol-heading doc-symbol-class"></code>{% endif %}
10
+ {% if config.separate_signature %}
11
+ <span class="doc doc-object-name doc-class-name">{{ config.heading if config.heading and root else class_name }}{{ hippogriffe.bases(class) }}</span>
12
+ {% elif config.merge_init_into_class and "__init__" in all_members %}
13
+ {% with function = all_members["__init__"] %}
14
+ {%+ filter highlight(language="python", inline=True) %}
15
+ {{ class_name }}{% include "signature"|get_template with context %}
16
+ {% endfilter %}
17
+ {% endwith %}
18
+ {% else %}
19
+ <code>{{ class_name }}{{ hippogriffe.bases(class) }}</code>
20
+ {% endif %}
21
+ {{ hippogriffe.url(class) }}
22
+ {% endblock heading %}
@@ -0,0 +1,7 @@
1
+ {% extends "_base/function.html.jinja" %}
2
+ {% import "hippogriffe/hippogriffe.jinja" as hippogriffe %}
3
+
4
+ {% block heading %}
5
+ {{ super() }}
6
+ {{ hippogriffe.url(function) }}
7
+ {% endblock heading %}
@@ -0,0 +1,20 @@
1
+ {%- macro bases(obj) -%}
2
+ {%- if obj.extra.hippogriffe.public_bases -%}
3
+ (
4
+ {%- for base, autoref in obj.extra.hippogriffe.public_bases -%}
5
+ {%- if autoref -%}
6
+ <autoref identifier="{{ base }}">{{ base }}</autoref>
7
+ {%- else -%}
8
+ {{ base }}
9
+ {%- endif -%}
10
+ {%- if not loop.last %}, {% endif -%}
11
+ {%- endfor -%}
12
+ )
13
+ {%- endif -%}
14
+ {%- endmacro -%}
15
+
16
+ {%- macro url(obj) -%}
17
+ {%- if obj.extra.hippogriffe.url -%}
18
+ <a href="{{ obj.extra.hippogriffe.url }}"><code class='hippogriffe-repo-url'></code></a>
19
+ {%- endif -%}
20
+ {%- endmacro -%}
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ build-backend = "hatchling.build"
3
+ requires = ["hatchling"]
4
+
5
+ [project]
6
+ authors = [
7
+ {email = "contact@kidger.site", name = "Patrick Kidger"}
8
+ ]
9
+ classifiers = [
10
+ "Development Status :: 3 - Alpha",
11
+ "License :: OSI Approved :: Apache Software License",
12
+ "Natural Language :: English",
13
+ "Programming Language :: Python :: 3"
14
+ ]
15
+ dependencies = [
16
+ "griffe>=1.6.0",
17
+ "mkdocs>=1.6.1",
18
+ "mkdocstrings[python]>=0.28.3",
19
+ "wadler_lindig>=0.1.4"
20
+ ]
21
+ description = "A simple ipynb->md converter for MkDocs"
22
+ keywords = ["mkdocs", "mkdocstrings", "griffe", "md", "markdown"]
23
+ license = {file = "LICENSE"}
24
+ name = "hippogriffe"
25
+ readme = "README.md"
26
+ requires-python = ">=3.10"
27
+ urls = {repository = "https://github.com/patrick-kidger/hippogriffe"}
28
+ version = "0.1.0"
29
+
30
+ [project.optional-dependencies]
31
+ dev = ["pre-commit"]
32
+
33
+ [project.entry-points."mkdocs.plugins"]
34
+ hippogriffe = "hippogriffe._plugin:HippogriffePlugin"
35
+
36
+ [project.entry-points."mkdocstrings.python.templates"]
37
+ hippogriffe = "hippogriffe._extension:get_templates_path"
38
+
39
+ [tool.hatch.build]
40
+ include = ["hippogriffe/*"]
41
+
42
+ [tool.pyright]
43
+ include = ["hippogriffe"]
44
+
45
+ [tool.ruff]
46
+ extend-include = ["*.ipynb"]
47
+ src = []
48
+
49
+ [tool.ruff.lint]
50
+ fixable = ["I001", "F401"]
51
+ ignore = ["E402", "E721", "E731", "E741", "F722"]
52
+ select = ["E", "F", "I001"]
53
+
54
+ [tool.ruff.lint.isort]
55
+ combine-as-imports = true
56
+ lines-after-imports = 2
57
+ order-by-type = true