You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/get-started/dev-prepare.qmd
+54-7Lines changed: 54 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Prep: Auto, blueprint, collect"
2
+
title: "Components: Auto, blueprint, collect"
3
3
jupyter:
4
4
jupytext:
5
5
text_representation:
@@ -14,29 +14,76 @@ jupyter:
14
14
---
15
15
16
16
```{python}
17
-
from quartodoc import Auto, blueprint, collect, preview
17
+
from quartodoc import collect, preview
18
18
from quartodoc import MdRenderer
19
19
from quartodoc import layout
20
20
import yaml
21
21
```
22
22
23
+
### `Auto`: Config Options
23
24
24
-
### Auto discovery of functions, classes, and more
25
+
The `Auto` class contains data about how you wish to render a specific Python object, which you typically set in configuration options via the `quartodoc` section of your `_quarto.yml` file. In other words, `Auto` is a data structure that represents the configuration options for a specific Python object.
25
26
27
+
In the [previous](dev-big-picture.qmd) section, be demonstrated how we can find the `Auto` object corresponding to the `MdRenderer` class from our yaml configuration:
28
+
29
+
We can find the `Auto` object corresponding to the python object from our yaml configuration like this:
We can see many of the configuration options such as `members`, `name` and `children` as well as other options we didn't specify but are set to their default values. For example, we didn't set the option for [`dynamic`](basic-content.qmd#dynamic-lookup) but it is set to `false` by default.
54
+
55
+
However, we don't have to start with `yaml` files to create an `Auto` object. We can also create an `Auto` object with the fully qualified name of any Python object. For example, we can create an `Auto` object for the `MdRenderer` class like this:
26
56
```{python}
27
-
auto = Auto(name = "quartodoc.get_object")
28
-
auto
57
+
from quartodoc import Auto
58
+
auto = Auto(name = "quartodoc.MdRenderer", signature_name = 'short')
59
+
print(auto)
29
60
```
30
61
31
-
* auto just represents what we want to do, blueprint has all the logic.
32
-
* explain options like dynamic, show them in blueprint section
62
+
However, since we didn't specify any options, this is not the same `Auto` that we got from the yaml. For example, the `members` option is not set to `["render", "summarize"]` as it was in the yaml. Instead, it is set to `None` which means that all members will be included. We can see this by looking at the `obj` attribute of the `Auto` object:
63
+
64
+
```{python}
65
+
print(auto.members)
66
+
```
67
+
68
+
To set this option, we can pass it to the `Auto` constructor:
69
+
70
+
```{python}
71
+
auto = Auto(name = "quartodoc.MdRenderer",
72
+
members = ["render", "summarize"]
73
+
)
74
+
75
+
assert auto.members == auto_from_yml.members
76
+
print(auto)
77
+
```
33
78
79
+
Understanding how `Auto` an object created is helpful in case you need to debug `quartodoc`. If you find that a configuration option is not being set as you expect, you can create an `Auto` object for the Python object in question and compare it to the `Auto` object that you expect to be created from your yaml configuration.
0 commit comments