Skip to content

Commit 7e88d0b

Browse files
committed
docs: Add a "Try it out" page
1 parent dea4c83 commit 7e88d0b

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

docs/try_it_out.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Try Griffe in your browser
2+
3+
Try Griffe directly in your browser thanks to Pyodide!
4+
You can click the "Run" button in the top-right corner of each editor,
5+
or hit ++ctrl+enter++ to run the code.
6+
7+
8+
In the following example, we import `griffe` and use it to load itself.
9+
Then we output the signature of the `Function` class as JSON.
10+
11+
```pyodide install="griffe"
12+
import griffe
13+
griffe_pkg = griffe.load("griffe")
14+
griffe_pkg["dataclasses.Function"].as_json(indent=2)
15+
```
16+
17+
Try it out with another package of your choice!
18+
Just replace `your-dist-name` with a package's distribution name,
19+
and `your_package_name` with the package's import name:
20+
21+
```pyodide
22+
import micropip
23+
await micropip.install("your-dist-name")
24+
data = griffe.load("your_package_name")
25+
data.as_json(indent=2)[:1000] # truncate to a thousand characters...
26+
```

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ nav:
2323
- Docstrings:
2424
- Supported styles: docstrings.md
2525
- Parsing docstrings in Python: parsing_docstrings.md
26+
- Try it out!:
27+
- Run Griffe in your browser: try_it_out.md
2628
# defer to gen-files + literate-nav
2729
- API reference:
2830
- Griffe: reference/
@@ -85,6 +87,7 @@ markdown_extensions:
8587
- pymdownx.emoji:
8688
emoji_index: !!python/name:materialx.emoji.twemoji
8789
emoji_generator: !!python/name:materialx.emoji.to_svg
90+
- pymdownx.keys
8891
- pymdownx.magiclink
8992
- pymdownx.snippets:
9093
check_paths: true

0 commit comments

Comments
 (0)