work on pyscript/typst api
This commit is contained in:
parent
84bf7ce78c
commit
fe4b003971
3 changed files with 62 additions and 56 deletions
|
|
@ -74,10 +74,7 @@
|
|||
|
||||
#lorem(400)
|
||||
|
||||
```python
|
||||
# /// script
|
||||
# [tool.pyscript]
|
||||
# ///
|
||||
```python-run
|
||||
n = ""
|
||||
while not n.isnumeric():
|
||||
n = input("enter a valid number: ")
|
||||
|
|
@ -92,7 +89,7 @@ for i in range(1, int(n) + 1):
|
|||
else:
|
||||
print(i)
|
||||
```
|
||||
```python
|
||||
```python-run
|
||||
# /// script
|
||||
# # requires-python = ">=3.11" # not supported yet
|
||||
# dependencies = [
|
||||
|
|
@ -115,6 +112,30 @@ pprint([(k, v["title"]) for k, v in data.items()][:10])
|
|||
# Inline script metadata
|
||||
```
|
||||
|
||||
```python-run
|
||||
# /// script
|
||||
# # requires-python = ">=3.11" # not supported yet
|
||||
# dependencies = [
|
||||
# "rich",
|
||||
# ]
|
||||
#
|
||||
# [tool.pyscript]
|
||||
# repl = true
|
||||
# hide-meta = true
|
||||
# [tool.pyscript.files]
|
||||
# "https://peps.python.org/api/peps.json" = "./peps.json"
|
||||
# ///
|
||||
|
||||
import json
|
||||
from rich.pretty import pprint
|
||||
|
||||
with open("./peps.json") as fd:
|
||||
data = json.load(fd)
|
||||
pprint([(k, v["title"]) for k, v in data.items()][:10])
|
||||
# >>> print(data["723"]["title"])
|
||||
# Inline script metadata
|
||||
```
|
||||
|
||||
#summ.card
|
||||
|
||||
Test, `this is not a code block`, end test.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue