File tree Expand file tree Collapse file tree 4 files changed +34
-3
lines changed Expand file tree Collapse file tree 4 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 1
1
repos :
2
2
- repo : https://github.com/pre-commit/pre-commit-hooks
3
- rev : v3.2 .0
3
+ rev : v3.3 .0
4
4
hooks :
5
5
- id : end-of-file-fixer
6
6
- id : check-toml
7
7
- repo : https://github.com/nbQA-dev/nbQA
8
- rev : 0.3.2
8
+ rev : 0.3.5
9
9
hooks :
10
10
- id : nbqa-black
11
11
- id : nbqa-isort
12
12
- id : nbqa-pyupgrade
13
13
- repo : https://github.com/asottile/pyupgrade
14
- rev : v2.7.2
14
+ rev : v2.7.3
15
15
hooks :
16
16
- id : pyupgrade
17
17
args : [--py36-plus]
26
26
types : [jupyter]
27
27
entry : python scripts/check_watermark.py
28
28
language : python
29
+ - id : check-toc
30
+ name : Check all notebooks appear in table of contents
31
+ entry : python scripts/check_toc_is_complete.py
32
+ language : python
33
+ pass_filenames : false
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ Gallery.contents = {
34
34
"gaussian_process" : "Gaussian Processes" ,
35
35
"conditional-autoregressive-model" : "Gaussian Processes" ,
36
36
"log-gaussian-cox-process" :"Gaussian Processes" ,
37
+ "GP-Circular" : "Gaussian Processes" ,
37
38
"dependent_density_regression" : "Mixture Models" ,
38
39
"dp_mix" : "Mixture Models" ,
39
40
"gaussian-mixture-model-advi" : "Mixture Models" ,
@@ -59,6 +60,7 @@ Gallery.contents = {
59
60
"ODE_with_manual_gradients" : "Inference in ODE models" ,
60
61
"ODE_API_introduction" : "Inference in ODE models" ,
61
62
"probabilistic_matrix_factorization" : "Case Studies" ,
63
+ "MLDA_introduction" : "MCMC" ,
62
64
"MLDA_simple_linear_regression" : "MCMC" ,
63
65
"MLDA_gravity_surveying" : "MCMC" ,
64
66
"MLDA_variance_reduction_linear_regression" : "MCMC"
Original file line number Diff line number Diff line change @@ -6,13 +6,15 @@ Gallery.contents = {
6
6
"Gaussian_Processes.rst" : "Basics" ,
7
7
"data_container" : "Basics" ,
8
8
"sampling_compound_step" : "Deep dives" ,
9
+ "sampling_callback" : "Deep dives" ,
9
10
"sampler-stats" : "Deep dives" ,
10
11
"Diagnosing_biased_Inference_with_Divergences" : "Deep dives" ,
11
12
"Advanced_usage_of_Theano_in_PyMC3.rst" : "Deep dives" ,
12
13
"getting_started" : "Deep dives" ,
13
14
"ODE_API_shapes_and_benchmarking" : "Deep dives" ,
14
15
"DEMetropolisZ_EfficiencyComparison" : "Deep dives" ,
15
16
"DEMetropolisZ_tune_drop_fraction" : "Deep dives" ,
17
+ "factor_analysis" : "Deep dives" ,
16
18
"blackbox_external_likelihood" : "How-To" ,
17
19
"profiling" : "How-To" ,
18
20
"howto_debugging" : "How-To" ,
Original file line number Diff line number Diff line change
1
+ """
2
+ Check that given Jupyter notebooks all contain a final watermark cell to facilite reproducibility.
3
+
4
+ This is intended to be used as a pre-commit hook, see `.pre-commit-config.yaml`.
5
+ You can run it manually with `pre-commit run check-toc --all`.
6
+ """
7
+
8
+ import json
9
+ from pathlib import Path
10
+
11
+ if __name__ == "__main__" :
12
+ notebooks = (Path ("docs" ) / "source/notebooks" ).glob ("*.ipynb" )
13
+ toc_examples = (Path ("docs" ) / "source/notebooks/table_of_contents_examples.js" ).read_text ()
14
+ toc_tutorials = (Path ("docs" ) / "source/notebooks/table_of_contents_tutorials.js" ).read_text ()
15
+ toc_keys = {
16
+ ** json .loads (toc_examples [toc_examples .find ("{" ) :]),
17
+ ** json .loads (toc_tutorials [toc_tutorials .find ("{" ) :]),
18
+ }.keys ()
19
+ for notebook in notebooks :
20
+ assert (
21
+ notebook .stem in toc_keys
22
+ ), f"Notebook { notebook .name } not added to table of contents!"
You can’t perform that action at this time.
0 commit comments