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
Tries to explain a few concepts and expected outputs from papyri.
There's a bunch of stuff to expand on but I thought this could be useful
especially for new contributors.
There's nothing really *new*, just some reorganization and highlighting.
@@ -77,14 +77,24 @@ papyri enabled (left) and disabled (right).
77
77

78
78
</detail>
79
79
80
+
---
81
+
82
+
## Table of contents
83
+
84
+
-[Installation](#installation)
85
+
-[Usage](#usage)
86
+
-[Rendering](#rendering)
87
+
-[Architecture](#architecture)
88
+
80
89
## Installation (not fully functional):
81
90
82
-
Some functionality is not yet available when installing from PyPI.
83
-
For now you need a dev-install (see next section) to access all features.
91
+
Some functionality is not yet available when installing from PyPI. For now you
92
+
need a [Development installation](#development-installation) to access all
93
+
features.
84
94
85
95
You'll need Python 3.8 or newer, otherwise pip will tell you it can't find any matching distribution.
86
96
87
-
Pip install from PyPI:
97
+
Install from PyPI:
88
98
89
99
```bash
90
100
$ pip install papyri
@@ -111,7 +121,7 @@ This will augment the `?` operator to show better documentation (when installed
111
121
*Papyri does not completely build its own docs yet, but you might be able to view a static rendering of it
112
122
[here](https://pydocs.github.io/). It is not yet automatically built, so might be out of date.*
113
123
114
-
### Development install
124
+
### Development installation
115
125
116
126
You may need to get a modified version of numpydoc depending on the stage of development. You will need [pip >
117
127
21.3](https://pip.pypa.io/en/stable/news/#v21-3-1) if you want to make editable installs.
@@ -149,19 +159,19 @@ $ pytest
149
159
150
160
## Usage
151
161
152
-
In the end there should be roughly 3 steps,
162
+
Papyri relies on three steps:
153
163
154
-
- IR generation (package maintainers)
155
-
- IR installation (end user or via pip/conda)
156
-
- IR rendering (usually IDE, CLI/webserver)
164
+
- IR generation (executed by package maintainers);
165
+
- IR installation (executed by end users or via pip/conda);
166
+
- IR rendering (usually executed by the IDE, CLI/webserver).
157
167
158
-
### IR Generation
168
+
### IR Generation (`papyri gen`)
159
169
160
170
This is the step you want to trigger if you are building documentation using Papyri for a library you maintain. Most
161
171
likely as an end user you will not have to issue this step and can install pre-published documentation bundles.
162
172
This step is likely to occur only once per new release of a project.
163
173
164
-
Look at the Toml files in`examples`, this will give you example configurations from some existing libraries.
174
+
The Toml files in`examples` will give you example configurations from some existing libraries.
165
175
166
176
```
167
177
$ ls -1 examples/*.toml
@@ -177,8 +187,8 @@ examples/skimage.toml
177
187
178
188
Right now these files lives in papyri but would likely be in relevant repositories under `docs/papyri.toml` later on.
179
189
180
-
It is _slow_ on full numpy/scipy; use `--no-infer` (see below) for a subpar but
181
-
faster experience.
190
+
> [!NOTE]
191
+
> It is _slow_ on full numpy/scipy; use `--no-infer` (see below) for a subpar but faster experience.
182
192
183
193
Use `papyri gen <path to example file>`
184
194
@@ -192,7 +202,16 @@ $ papyri gen examples/numpy.toml
192
202
$ papyri gen examples/scipy.toml
193
203
```
194
204
195
-
This will create intermediate docs files inin`~/.papyri/data/<library name>_<library_version>`
205
+
This will create intermediate docs files inin`~/.papyri/data/<library name>_<library_version>`. See [Generation](#generation-papyri-gen) for more details.
206
+
207
+
You can also generate intermediate docs files for a subset of objects using the `--only` flag. For example:
208
+
209
+
```
210
+
$ papyri gen examples/numpy.toml --only numpy:einsum
211
+
```
212
+
213
+
> [!IMPORTANT]
214
+
> To avoid ambiguity, papyri uses [fully qualified names](#qualified-names) to refer to objects. This means that you need to use `numpy:einsum` instead of `einsum` or `numpy.einsum` to refer to the `einsum` function in the `numpy` module, for example.
196
215
197
216
198
217
### Installation/ingestion
@@ -210,11 +229,11 @@ You can ingest local folders with the following command:
210
229
$ papyri ingest ~/.papyri/data/<path to folder generated at previous step>
211
230
```
212
231
213
-
This will crosslink the newly generate folder with the existing ones.
232
+
This will crosslink the newly generated folder with the existing ones.
214
233
Ingested data can be found in `~/.papyri/ingest/` but you are not supposed to
215
234
interact with this folder with tools external to papyri.
216
235
217
-
There is currently a couple of pre-built documentation bundles that can be
236
+
There are currently a couple of pre-built documentation bundles that can be
218
237
pre-installed, but are likely to break with each new version of papyri. We
219
238
suggest you use the developer installation and ingestion procedure for now.
220
239
@@ -225,134 +244,204 @@ is of interest to you. This will likely be done by your favorite IDE, probably
225
244
just in time when you explore documentation. Nonetheless, we've
226
245
implemented a couple of external renderers to help debug issues.
227
246
228
-
WARNING:
229
-
230
-
Many rendering methods current require papyri's own docs to be built and ingested
231
-
first.
247
+
> [!WARNING]
248
+
> Many rendering methods currently require papyri's own docs to be built and ingested first.
232
249
233
250
```
234
251
$ papyri gen examples/papyri.toml
235
252
$ papyri ingest ~/.papyri/data/papyri_0.0.7 # or any current version
236
253
```
237
254
238
-
Or you can try to pre-install an old papyri doc bundle
255
+
Or you can try to pre-install an old papyri doc bundle:
239
256
240
257
```
241
258
$ papyri install papyri
242
259
```
243
260
244
261
### Standalone HTML rendering
245
262
263
+
To see the rendered documentation for all packages previously ingested, run
246
264
247
265
```bash
248
-
$ papyri render # render all the html pages statically in ~/.papyri/html
249
-
$ papyri serve-static # start a http.server with the propoer root to serve above files.
266
+
$ papyri serve
250
267
```
251
268
269
+
This will start a live server that will render the pages on the fly.
270
+
271
+
If you need to render static versions of the pages, use either of the following
272
+
commands:
273
+
252
274
```bash
253
-
$ papyri serve # start a server that will render the pages on the fly (nice to debug or iterate on theme, rendering)
275
+
$ papyri render # render all the html pages statically in ~/.papyri/html
276
+
$ papyri serve-static # start a http.server with the proper root to serve above files.
254
277
```
255
278
256
-
### Ascii terminal rendering (experimental)
279
+
### Rich terminal rendering
257
280
281
+
To render the documentation for a single object on a terminal, use
258
282
259
283
```
260
-
$ papyri ascii <fully qualified names> # try to render in the terminal.
284
+
$ papyri rich <fully qualified name>
261
285
```
262
286
263
-
For example,
287
+
For example:
264
288
265
289
```
266
-
$ papyri ascii numpy.linspace
290
+
$ papyri rich numpy:einsum # note the colon for the fully qualified name.
267
291
```
268
292
269
-
The next step uses urwid to provide a browsable interface in terminal.
293
+
To use the experimental interactive Textual interface in the terminal, use
0 commit comments