Skip to content

Commit 28071ce

Browse files
committed
showdoc explanation
1 parent 79d8a9d commit 28071ce

File tree

5 files changed

+301
-17
lines changed

5 files changed

+301
-17
lines changed

nbdev/quarto.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/13_quarto.ipynb.
22

3-
# %% ../nbs/13_quarto.ipynb 1
3+
# %% ../nbs/13_quarto.ipynb 2
44
from __future__ import annotations
55
import warnings
66

@@ -18,14 +18,14 @@
1818
__all__ = ['BASE_QUARTO_URL', 'install_quarto', 'install', 'nbdev_sidebar', 'nbdev_readme', 'refresh_quarto_yml', 'nbdev_quarto',
1919
'preview', 'deploy']
2020

21-
# %% ../nbs/13_quarto.ipynb 4
21+
# %% ../nbs/13_quarto.ipynb 5
2222
_def_file_re = '\.(?:ipynb|qmd|html)$'
2323

2424
def _sprun(cmd):
2525
try: subprocess.check_output(cmd, shell=True)
2626
except subprocess.CalledProcessError as cpe: sys.exit(cpe.returncode)
2727

28-
# %% ../nbs/13_quarto.ipynb 5
28+
# %% ../nbs/13_quarto.ipynb 6
2929
BASE_QUARTO_URL='https://www.quarto.org/download/latest/'
3030

3131
def _install_linux():
@@ -50,15 +50,15 @@ def install_quarto():
5050
elif 'linux' in sys.platform: _install_linux()
5151
finally: system('sudo rm -f .installing')
5252

53-
# %% ../nbs/13_quarto.ipynb 6
53+
# %% ../nbs/13_quarto.ipynb 7
5454
@call_parse
5555
def install():
5656
"Install Quarto and the current library"
5757
install_quarto.__wrapped__()
5858
d = get_config().path('lib_path')
5959
if (d/'__init__.py').exists(): system(f'pip install -e "{d.parent}[dev]"')
6060

61-
# %% ../nbs/13_quarto.ipynb 7
61+
# %% ../nbs/13_quarto.ipynb 8
6262
def _doc_paths(path:str=None, doc_path:str=None):
6363
cfg = get_config()
6464
cfg_path = cfg.config_path
@@ -67,15 +67,15 @@ def _doc_paths(path:str=None, doc_path:str=None):
6767
tmp_doc_path = path/f"{cfg['doc_path']}"
6868
return cfg,cfg_path,path,doc_path,tmp_doc_path
6969

70-
# %% ../nbs/13_quarto.ipynb 8
70+
# %% ../nbs/13_quarto.ipynb 9
7171
def _f(a,b): return Path(a),b
7272
def _pre(p,b=True): return ' ' * (len(p.parts)) + ('- ' if b else ' ')
7373
def _sort(a):
7474
x,y = a
7575
if y.startswith('index.'): return x,'00'
7676
return a
7777

78-
# %% ../nbs/13_quarto.ipynb 9
78+
# %% ../nbs/13_quarto.ipynb 10
7979
@call_parse
8080
def nbdev_sidebar(
8181
path:str=None, # Path to notebooks
@@ -111,7 +111,7 @@ def nbdev_sidebar(
111111
yml_path.write_text(yml)
112112
if returnit: return files
113113

114-
# %% ../nbs/13_quarto.ipynb 11
114+
# %% ../nbs/13_quarto.ipynb 12
115115
def _render_readme(path):
116116
idx_path = path/get_config().readme_nb
117117
if not idx_path.exists(): return
@@ -127,7 +127,7 @@ def _render_readme(path):
127127
finally:
128128
if moved: (path/'sidebar.yml.bak').rename(yml_path)
129129

130-
# %% ../nbs/13_quarto.ipynb 12
130+
# %% ../nbs/13_quarto.ipynb 13
131131
@call_parse
132132
def nbdev_readme(
133133
path:str=None, # Path to notebooks
@@ -140,13 +140,13 @@ def nbdev_readme(
140140
if _rdm.exists(): _rdm.unlink() # py37 doesn't have arg missing_ok so have to check first
141141
move(str(tmp_doc_path/'README.md'), cfg_path) # README.md is temporarily in nbs/_docs
142142

143-
# %% ../nbs/13_quarto.ipynb 13
143+
# %% ../nbs/13_quarto.ipynb 14
144144
def _ensure_quarto():
145145
if shutil.which('quarto'): return
146146
print("Quarto is not installed. We will download and install it for you.")
147147
install.__wrapped__()
148148

149-
# %% ../nbs/13_quarto.ipynb 14
149+
# %% ../nbs/13_quarto.ipynb 15
150150
_quarto_yml="""ipynb-filters: [nbdev_filter]
151151
152152
project:
@@ -187,7 +187,7 @@ def _ensure_quarto():
187187
- custom.yml
188188
"""
189189

190-
# %% ../nbs/13_quarto.ipynb 15
190+
# %% ../nbs/13_quarto.ipynb 16
191191
def refresh_quarto_yml():
192192
"Generate `_quarto.yml` from `settings.ini`."
193193
cfg = get_config()
@@ -199,7 +199,7 @@ def refresh_quarto_yml():
199199
yml=_quarto_yml.format(**vals)
200200
p.write_text(yml)
201201

202-
# %% ../nbs/13_quarto.ipynb 16
202+
# %% ../nbs/13_quarto.ipynb 17
203203
@call_parse
204204
def nbdev_quarto(
205205
path:str=None, # Path to notebooks
@@ -226,7 +226,7 @@ def nbdev_quarto(
226226
rmtree(doc_path, ignore_errors=True)
227227
move(tmp_doc_path, cfg_path)
228228

229-
# %% ../nbs/13_quarto.ipynb 17
229+
# %% ../nbs/13_quarto.ipynb 18
230230
@call_parse
231231
def preview(
232232
path:str=None, # Path to notebooks
@@ -242,7 +242,7 @@ def preview(
242242
nbdev_quarto.__wrapped__(path, doc_path=doc_path, symlinks=symlinks, file_re=file_re, folder_re=folder_re,
243243
skip_file_glob=skip_file_glob, skip_file_re=skip_file_re, preview=True, port=port)
244244

245-
# %% ../nbs/13_quarto.ipynb 18
245+
# %% ../nbs/13_quarto.ipynb 19
246246
@call_parse
247247
def deploy(
248248
path:str=None, # Path to notebooks

nbs/13_quarto.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
"#|default_exp quarto"
1111
]
1212
},
13+
{
14+
"cell_type": "markdown",
15+
"id": "f0f931c2",
16+
"metadata": {},
17+
"source": [
18+
"# quarto\n",
19+
"\n",
20+
"> Install and interact with Quarto from nbdev"
21+
]
22+
},
1323
{
1424
"cell_type": "code",
1525
"execution_count": null,

0 commit comments

Comments
 (0)