Repository navigation
Expand file tree
/
Copy pathcli.html
More file actions
617 lines (414 loc) · 24 KB
/
Copy pathcli.html
File metadata and controls
617 lines (414 loc) · 24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
---
title: Command line functions
keywords: fastai
sidebar: home_sidebar
summary: "Console commands added by the nbdev library"
description: "Console commands added by the nbdev library"
nb_path: "nbs/06_cli.ipynb"
---
<!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: nbs/06_cli.ipynb
# command to build the docs after a change: nbdev_build_docs
-->
<div class="container" id="notebook-container">
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p><code>nbdev</code> comes with the following commands. To use any of them, you must be in one of the subfolders of your project: they will search for the <code>settings.ini</code> recursively in the parent directory but need to access it to be able to work. Their names all begin with nbdev so you can easily get a list with tab completion.</p>
<ul>
<li><a href="/export2html.html#nbdev_build_docs"><code>nbdev_build_docs</code></a> builds the documentation from the notebooks</li>
<li><a href="/export2html.html#nbdev_build_lib"><code>nbdev_build_lib</code></a> builds the library from the notebooks</li>
<li><a href="/cli.html#nbdev_bump_version"><code>nbdev_bump_version</code></a> increments version in <code>settings.py</code> by one</li>
<li><a href="/clean.html#nbdev_clean_nbs"><code>nbdev_clean_nbs</code></a> removes all superfluous metadata form the notebooks, to avoid merge conflicts</li>
<li><a href="/export2html.html#nbdev_detach"><code>nbdev_detach</code></a> exports cell attachments to <code>dest</code> and updates references</li>
<li><a href="/sync.html#nbdev_diff_nbs"><code>nbdev_diff_nbs</code></a> gives you the diff between the notebooks and the exported library</li>
<li><a href="/merge.html#nbdev_fix_merge"><code>nbdev_fix_merge</code></a> will fix merge conflicts in a notebook file</li>
<li><a href="/cli.html#nbdev_install_git_hooks"><code>nbdev_install_git_hooks</code></a> installs the git hooks that use the last two command automatically on each commit/merge</li>
<li><a href="/export2html.html#nbdev_nb2md"><code>nbdev_nb2md</code></a> converts a notebook to a markdown file</li>
<li><a href="/cli.html#nbdev_new"><code>nbdev_new</code></a> creates a new nbdev project</li>
<li><a href="/test.html#nbdev_read_nbs"><code>nbdev_read_nbs</code></a> reads all notebooks to make sure none are broken</li>
<li><a href="/test.html#nbdev_test_nbs"><code>nbdev_test_nbs</code></a> runs tests in notebooks</li>
<li><a href="/sync.html#nbdev_trust_nbs"><code>nbdev_trust_nbs</code></a> trusts all notebooks (so that the HTML content is shown)</li>
<li><a href="/sync.html#nbdev_update_lib"><code>nbdev_update_lib</code></a> propagates any change in the library back to the notebooks</li>
</ul>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Navigating-from-notebooks-to-script-and-back">Navigating from notebooks to script and back<a class="anchor-link" href="#Navigating-from-notebooks-to-script-and-back"> </a></h2>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_build_lib" class="doc_header"><code>nbdev_build_lib</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/export2html.py#L457" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_build_lib</code>(<strong><code>fname</code></strong>:"A notebook name or glob to convert"=<em><code>None</code></em>, <strong><code>bare</code></strong>:"Omit nbdev annotation comments (may break some functionality)."=<em><code>False</code></em>)</p>
</blockquote>
<p>Export notebooks matching <code>fname</code> to python modules</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>By default (<code>fname</code> left to <code>None</code>), the whole library is built from the notebooks in the <code>lib_folder</code> set in your <code>settings.ini</code>.</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_update_lib" class="doc_header"><code>nbdev_update_lib</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/sync.py#L122" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_update_lib</code>(<strong><code>fname</code></strong>:"A python filename or glob to convert"=<em><code>None</code></em>, <strong><code>silent</code></strong>:"Don't print results"=<em><code>False</code></em>)</p>
</blockquote>
<p>Propagates any change in the modules matching <code>fname</code> to the notebooks that created them</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>By default (<code>fname</code> left to <code>None</code>), the whole library is treated. Note that this tool is only designed for small changes such as typo or small bug fixes. You can't add new cells in notebook from the library.</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_diff_nbs" class="doc_header"><code>nbdev_diff_nbs</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/sync.py#L140" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_diff_nbs</code>()</p>
</blockquote>
<p>Prints the diff between an export of the library in notebooks and the actual modules</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Running-tests">Running tests<a class="anchor-link" href="#Running-tests"> </a></h2>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_test_nbs" class="doc_header"><code>nbdev_test_nbs</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/test.py#L100" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_test_nbs</code>(<strong><code>fname</code></strong>:"A notebook name or glob to convert"=<em><code>None</code></em>, <strong><code>flags</code></strong>:"Space separated list of flags"=<em><code>None</code></em>, <strong><code>n_workers</code></strong>:"Number of workers to use"=<em><code>None</code></em>, <strong><code>verbose</code></strong>:"Print errors along the way"=<em><code>True</code></em>, <strong><code>timing</code></strong>:"Timing each notebook to see the ones are slow"=<em><code>False</code></em>, <strong><code>pause</code></strong>:"Pause time (in secs) between notebooks to avoid race conditions"=<em><code>0.5</code></em>)</p>
</blockquote>
<p>Test in parallel the notebooks matching <code>fname</code>, passing along <code>flags</code></p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>By default (<code>fname</code> left to <code>None</code>), the whole library is tested from the notebooks in the <code>lib_folder</code> set in your <code>settings.ini</code>.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Building-documentation">Building documentation<a class="anchor-link" href="#Building-documentation"> </a></h2>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_build_docs" class="doc_header"><code>nbdev_build_docs</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/export2html.py#L635" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_build_docs</code>(<strong><code>fname</code></strong>:"A notebook name or glob to convert"=<em><code>None</code></em>, <strong><code>force_all</code></strong>:"Rebuild even notebooks that haven't changed"=<em><code>False</code></em>, <strong><code>mk_readme</code></strong>:"Also convert the index notebook to README"=<em><code>True</code></em>, <strong><code>n_workers</code></strong>:"Number of workers to use"=<em><code>None</code></em>, <strong><code>pause</code></strong>:"Pause time (in secs) between notebooks to avoid race conditions"=<em><code>0.5</code></em>)</p>
</blockquote>
<p>Build the documentation by converting notebooks matching <code>fname</code> to html</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>By default (<code>fname</code> left to <code>None</code>), the whole documentation is build from the notebooks in the <code>lib_folder</code> set in your <code>settings.ini</code>, only converting the ones that have been modified since the their corresponding html was last touched unless you pass <code>force_all=True</code>. The index is also converted to make the README file, unless you pass along <code>mk_readme=False</code>.</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_nb2md" class="doc_header"><code>nbdev_nb2md</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/export2html.py#L647" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_nb2md</code>(<strong><code>fname</code></strong>:"A notebook file name to convert", <strong><code>dest</code></strong>:"The destination folder"=<em><code>'.'</code></em>, <strong><code>img_path</code></strong>:"Folder to export images to"=<em><code>''</code></em>, <strong><code>jekyll</code></strong>:"To use jekyll metadata for your markdown file or not"=<em><code>False</code></em>)</p>
</blockquote>
<p>Convert the notebook in <code>fname</code> to a markdown file</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_detach" class="doc_header"><code>nbdev_detach</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/export2html.py#L607" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_detach</code>(<strong><code>path_nb</code></strong>:"Path to notebook", <strong><code>dest</code></strong>:"Destination folder"=<em><code>''</code></em>, <strong><code>use_img</code></strong>:"Convert markdown images to img tags"=<em><code>False</code></em>, <strong><code>replace</code></strong>:"Write replacement notebook back to <code>path_bn</code>"=<em><code>True</code></em>)</p>
</blockquote>
<p>Export cell attachments to <code>dest</code> and update references</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Other-utils">Other utils<a class="anchor-link" href="#Other-utils"> </a></h2>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_read_nbs" class="doc_header"><code>nbdev_read_nbs</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/test.py#L126" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_read_nbs</code>(<strong><code>fname</code></strong>:"A notebook name or glob to convert"=<em><code>None</code></em>)</p>
</blockquote>
<p>Check all notebooks matching <code>fname</code> can be opened</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>By default (<code>fname</code> left to <code>None</code>), the all the notebooks in <code>lib_folder</code> are checked.</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_trust_nbs" class="doc_header"><code>nbdev_trust_nbs</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/sync.py#L157" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_trust_nbs</code>(<strong><code>fname</code></strong>:"A notebook name or glob to convert"=<em><code>None</code></em>, <strong><code>force_all</code></strong>:"Trust even notebooks that haven't changed"=<em><code>False</code></em>)</p>
</blockquote>
<p>Trust notebooks matching <code>fname</code></p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>By default (<code>fname</code> left to <code>None</code>), the all the notebooks in <code>lib_folder</code> are trusted. To speed things up, only the ones touched since the last time this command was run are trusted unless you pass along <code>force_all=True</code>.</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_fix_merge" class="doc_header"><code>nbdev_fix_merge</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/merge.py#L92" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_fix_merge</code>(<strong><code>fname</code></strong>:"A notebook filename to fix", <strong><code>fast</code></strong>:"Fast fix: automatically fix the merge conflicts in outputs or metadata"=<em><code>True</code></em>, <strong><code>trust_us</code></strong>:"Use local outputs/metadata when fast merging"=<em><code>True</code></em>)</p>
</blockquote>
<p>Fix merge conflicts in notebook <code>fname</code></p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>When you have merge conflicts after a <code>git pull</code>, the notebook file will be broken and won't open in jupyter notebook anymore. This command fixes this by changing the notebook to a proper json file again and add markdown cells to signal the conflict, you just have to open that notebook again and look for <code>>>>>>>></code> to see those conflicts and manually fix them. The old broken file is copied with a <code>.ipynb.bak</code> extension, so is still accessible in case the merge wasn't successful.</p>
<p>Moreover, if <code>fast=True</code>, conflicts in outputs and metadata will automatically be fixed by using the local version if <code>trust_us=True</code>, the remote one if <code>trust_us=False</code>. With this option, it's very likely you won't have anything to do, unless there is a real conflict.</p>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="bump_version" class="doc_header"><code>bump_version</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/cli.py#L19" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>bump_version</code>(<strong><code>version</code></strong>, <strong><code>part</code></strong>=<em><code>2</code></em>)</p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="input">
<div class="inner_cell">
<div class="input_area">
<div class=" highlight hl-ipython3"><pre><span></span><span class="n">test_eq</span><span class="p">(</span><span class="n">bump_version</span><span class="p">(</span><span class="s1">'0.1.1'</span> <span class="p">),</span> <span class="s1">'0.1.2'</span><span class="p">)</span>
<span class="n">test_eq</span><span class="p">(</span><span class="n">bump_version</span><span class="p">(</span><span class="s1">'0.1.1'</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="s1">'0.2.0'</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_bump_version" class="doc_header"><code>nbdev_bump_version</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/cli.py#L26" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_bump_version</code>(<strong><code>part</code></strong>:"Part of version to bump"=<em><code>2</code></em>)</p>
</blockquote>
<p>Increment version in <code>settings.py</code> by one</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Git-hooks">Git hooks<a class="anchor-link" href="#Git-hooks"> </a></h2>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_install_git_hooks" class="doc_header"><code>nbdev_install_git_hooks</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/cli.py#L37" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_install_git_hooks</code>()</p>
</blockquote>
<p>Install git hooks to clean/trust notebooks automatically</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p>This command installs git hooks to make sure notebooks are cleaned before you commit them to GitHub and automatically trusted at each merge. To be more specific, this creates:</p>
<ul>
<li>an executable '.git/hooks/post-merge' file that contains the command <a href="/sync.html#nbdev_trust_nbs"><code>nbdev_trust_nbs</code></a></li>
<li>a <code>.gitconfig</code> file that uses <code>nbev_clean_nbs</code> has a filter/diff on all notebook files inside <code>nbs_folder</code> and a <code>.gitattributes</code> file generated in this folder (copy this file in other folders where you might have notebooks you want cleaned as well)</li>
</ul>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h2 id="Starting-a-new-project">Starting a new project<a class="anchor-link" href="#Starting-a-new-project"> </a></h2>
</div>
</div>
</div>
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="extract_tgz" class="doc_header"><code>extract_tgz</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/cli.py#L81" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>extract_tgz</code>(<strong><code>url</code></strong>, <strong><code>dest</code></strong>=<em><code>'.'</code></em>)</p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
<div class="output_wrapper">
<div class="output">
<div class="output_area">
<div class="output_markdown rendered_html output_subarea ">
<h4 id="nbdev_new" class="doc_header"><code>nbdev_new</code><a href="https://github.com/fastai/nbdev/tree/master/nbdev/cli.py#L97" class="source_link" style="float:right">[source]</a></h4><blockquote><p><code>nbdev_new</code>()</p>
</blockquote>
<p>Create a new nbdev project from the current git repo</p>
</div>
</div>
</div>
</div>
</div>
{% endraw %}
{% raw %}
<div class="cell border-box-sizing code_cell rendered">
</div>
{% endraw %}
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<p><a href="/cli.html#nbdev_new"><code>nbdev_new</code></a> is a command line tool that creates a new nbdev project from the current directory, which must be a cloned git repo.</p>
<p>After you run <a href="/cli.html#nbdev_new"><code>nbdev_new</code></a>, please check the contents of <code>settings.ini</code> look good, and then run <a href="/export2html.html#nbdev_build_lib"><code>nbdev_build_lib</code></a>.</p>
</div>
</div>
</div>
<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<h4 id="Using-nbdev_new-with-private-repos">Using <a href="/cli.html#nbdev_new"><code>nbdev_new</code></a> with private repos<a class="anchor-link" href="#Using-nbdev_new-with-private-repos"> </a></h4><p><a href="/cli.html#nbdev_new"><code>nbdev_new</code></a> attempts to find your repo on GitHub to determine your default branch. If your repo is private, you will need to set the environment variable <code>GITHUB_TOKEN</code> with a <a href="https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token">personal access token</a> prior to running <a href="/cli.html#nbdev_new"><code>nbdev_new</code></a>, or <a href="/cli.html#nbdev_new"><code>nbdev_new</code></a> will use a default value instead.</p>
<p>You will receive a warning message if nbdev is not able to find your repo on GitHub that will tell you to replace the default branch name in <code>settings.ini</code> (which is the root of your repo).</p>
</div>
</div>
</div>
</div>