File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 3838# Include notebooks at build time.
3939root_dir = Path (__file__ ).resolve ().parents [1 ]
4040external_nb_dir = root_dir / "examples"
41+ copied_files = []
4142for f in external_nb_dir .glob ("*.ipynb" ):
4243 dest = Path (__file__ ).parent / "examples" / f .name
4344 if dest .exists ():
4445 dest .unlink ()
46+ copied_files .append (dest )
4547 shutil .copy (f , dest )
4648
49+
50+ def post_build_hook (app , exception ):
51+ """Remove copied files after building documentation."""
52+ for f in copied_files :
53+ if f .exists ():
54+ f .unlink ()
55+
56+
57+ def setup (app ):
58+ app .connect ("build-finished" , post_build_hook )
59+
60+
4761# -- General configuration ------------------------------------------------
4862
4963# If your documentation needs a minimal Sphinx version, state it here.
Original file line number Diff line number Diff line change 1+ **Added: **
2+
3+ * No news added: Remove the copied notebooks after building the documentation.
4+
5+ **Changed: **
6+
7+ * <news item>
8+
9+ **Deprecated: **
10+
11+ * <news item>
12+
13+ **Removed: **
14+
15+ * <news item>
16+
17+ **Fixed: **
18+
19+ * <news item>
20+
21+ **Security: **
22+
23+ * <news item>
You can’t perform that action at this time.
0 commit comments