Skip to content

Commit 88d9d8f

Browse files
femtomcsritchie
andauthored
Move cookbooks out from under quarto, into docs directory. (#1483)
This PR: - renames - `some_oddities` => `jax_basics` - `methods_of_generative_fun` => `generative_function_interface`, - `choicemap_creation_selection` => `choicemaps` - moves all notebooks into `docs`, so they can built by mkdocs-jupyter --------- Co-authored-by: Sam Ritchie <[email protected]>
1 parent 8a302fa commit 88d9d8f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+92
-2248
lines changed

.github/workflows/docs.yml

-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ jobs:
2929
${{ secrets.INSIDER_SSH_KEY }}
3030
${{ secrets.MKDOCSTRINGS_PYTHON_SSH_KEY }}
3131
32-
- name: Set up Quarto
33-
uses: quarto-dev/quarto-actions/setup@v2
34-
with:
35-
version: 1.4.553
36-
3732
- uses: actions/setup-python@v4
3833
with:
3934
python-version: 3.11.5

.github/workflows/notebooks.yml

-41
This file was deleted.

.github/workflows/test_docs.yml

-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ jobs:
2828
${{ secrets.MKDOCSTRINGS_PYTHON_SSH_KEY }}
2929
${{ secrets.INSIDER_SSH_KEY }}
3030
31-
- name: Set up Quarto
32-
uses: quarto-dev/quarto-actions/setup@v2
33-
3431
- uses: actions/setup-python@v4
3532
with:
3633
python-version: 3.11.5

notebooks/cookbook/basics/choicemap_creation_selection.ipynb renamed to docs/cookbook/active/choice_maps.ipynb

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "raw",
4+
"cell_type": "markdown",
55
"metadata": {
66
"vscode": {
77
"languageId": "raw"
88
}
99
},
1010
"source": [
11-
"---\n",
12-
"title: Choice maps\n",
13-
"subtitle: What's a choice map, and how do I create one or select from it?\n",
14-
"---"
11+
"# Choice maps"
1512
]
1613
},
1714
{
@@ -651,7 +648,7 @@
651648
],
652649
"metadata": {
653650
"kernelspec": {
654-
"display_name": ".venv",
651+
"display_name": "Python 3 (ipykernel)",
655652
"language": "python",
656653
"name": "python3"
657654
},
@@ -665,7 +662,7 @@
665662
"name": "python",
666663
"nbconvert_exporter": "python",
667664
"pygments_lexer": "ipython3",
668-
"version": "3.11.4"
665+
"version": "3.12.7"
669666
}
670667
},
671668
"nbformat": 4,

notebooks/cookbook/basics/methods_of_generative_fun.ipynb renamed to docs/cookbook/active/generative_function_interface.ipynb

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "raw",
4+
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"---\n",
8-
"title: Methods of generative functions\n",
9-
"subtitle: Ok I have a generative function... now what can I do with it?\n",
10-
"--- "
7+
"# The generative function interface"
118
]
129
},
1310
{
@@ -421,7 +418,7 @@
421418
"name": "python",
422419
"nbconvert_exporter": "python",
423420
"pygments_lexer": "ipython3",
424-
"version": "3.12.4"
421+
"version": "3.12.7"
425422
}
426423
},
427424
"nbformat": 4,

notebooks/active/intro.ipynb renamed to docs/cookbook/active/intro.ipynb

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "raw",
4+
"cell_type": "markdown",
55
"metadata": {
66
"vscode": {
77
"languageId": "raw"
88
}
99
},
1010
"source": [
11-
"---\n",
12-
"title: Introduction\n",
13-
"subtitle: Morning coffee & first steps from the probabilistic base camp.\n",
14-
"---"
11+
"# Introduction"
1512
]
1613
},
1714
{
@@ -465,7 +462,7 @@
465462
"name": "python",
466463
"nbconvert_exporter": "python",
467464
"pygments_lexer": "ipython3",
468-
"version": "3.11.4"
465+
"version": "3.12.7"
469466
}
470467
},
471468
"nbformat": 4,

notebooks/cookbook/basics/some_oddities.ipynb renamed to docs/cookbook/active/jax_basics.ipynb

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "raw",
4+
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"---\n",
8-
"title: Some oddities\n",
9-
"subtitle: What are some sharp edges of Jax that are good to know before really starting?\n",
10-
"---"
7+
"# JAX Basics"
118
]
129
},
1310
{
@@ -619,7 +616,7 @@
619616
"outputs": [],
620617
"source": [
621618
"genjax.truncated_normal.sample(\n",
622-
" jax.random.PRNGKey(2), 0.5382424, 0.05, 0.83921564 - 0.03, 0.83921564 + 0.03\n",
619+
" jax.random.key(2), 0.5382424, 0.05, 0.83921564 - 0.03, 0.83921564 + 0.03\n",
623620
")\n",
624621
"\n",
625622
"minv = 0.83921564 - 0.03\n",
@@ -634,17 +631,17 @@
634631
" return std * jax.random.truncated_normal(key, low, high, (), jnp.float32) + mean\n",
635632
"\n",
636633
"\n",
637-
"raw_jax_truncated(jax.random.PRNGKey(2), minv, maxv, mean, std)\n",
634+
"raw_jax_truncated(jax.random.key(2), minv, maxv, mean, std)\n",
638635
"# ==> Array(0.80921566, dtype=float32)\n",
639636
"\n",
640-
"jax.jit(raw_jax_truncated)(jax.random.PRNGKey(2), minv, maxv, mean, std)\n",
637+
"jax.jit(raw_jax_truncated)(jax.random.key(2), minv, maxv, mean, std)\n",
641638
"# ==> Array(nan, dtype=float32)"
642639
]
643640
}
644641
],
645642
"metadata": {
646643
"kernelspec": {
647-
"display_name": ".venv",
644+
"display_name": "Python 3 (ipykernel)",
648645
"language": "python",
649646
"name": "python3"
650647
},
@@ -658,9 +655,9 @@
658655
"name": "python",
659656
"nbconvert_exporter": "python",
660657
"pygments_lexer": "ipython3",
661-
"version": "3.11.6"
658+
"version": "3.12.7"
662659
}
663660
},
664661
"nbformat": 4,
665-
"nbformat_minor": 2
662+
"nbformat_minor": 4
666663
}

docs/cookbook/index.md

-3
This file was deleted.

docs/developing.md

+1-22
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ This project uses:
1010
- [poetry](https://python-poetry.org/) for dependency management
1111
- [nox](https://nox.thea.codes/en/stable/) to automate testing/linting/building.
1212
- [mkdocs](https://www.mkdocs.org/) to generate static documentation.
13-
- [quarto](https://quarto.org/) to render Jupyter notebooks for tutorial notebooks.
1413

1514
### Commit Hooks
1615

@@ -122,10 +121,6 @@ version of `jax` and `jaxlib` resolve with the versions of packages in the
122121

123122
### Documentation environment setup
124123

125-
If you want to deploy the documentation and Jupyter notebooks to static HTML,
126-
you'll need to install [quarto](https://quarto.org/docs/get-started/) on your
127-
machine.
128-
129124
GenJAX builds documentation using an insiders-only version of
130125
[mkdocs-material](https://squidfunk.github.io/mkdocs-material/). GenJAX will
131126
attempt to fetch this repository during the documentation build step.
@@ -136,8 +131,7 @@ Run the following command to fully build the documentation:
136131
nox -r -s docs-build
137132
```
138133

139-
This command will use `mkdocs` to build the static site, and then use `quarto`
140-
to render the notebooks into the static site directory.
134+
This command will use `mkdocs` to build the static site.
141135

142136
To view the generated site, run:
143137

@@ -151,21 +145,6 @@ or to run both commands in sequence:
151145
nox -r -s docs-build-serve
152146
```
153147

154-
## Granting someone access to GenJAX's Artifact Registry
155-
156-
- Visit the [artifact registry
157-
page](https://console.cloud.google.com/artifacts?hl=en&project=probcomp-caliban)
158-
and click the checkbox next to `probcomp` to bring up the "Permissions" tab on
159-
the right side of the page
160-
- Click "Add Principal"
161-
- Under "New principals", type in the email addresses (associated with a Google
162-
account) of the people you want to grant access
163-
- Under "Role", fill in "Artifact Registry Reader"
164-
- Click "Save"
165-
166-
These users should now be able to follow the README.md instructions to install
167-
GenJAX.
168-
169148
## Releasing GenJAX
170149

171150
Published GenJAX artifacts live [on PyPI](https://pypi.org/project/genjax/) and

mkdocs.yml

+43-2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,42 @@ copyright: Copyright &copy; 2023 MIT Probabilistic Computing Project
2121

2222
nav:
2323
- Home: index.md
24-
- Cookbook: cookbook/index.md
24+
- Cookbook:
25+
- Just starting out:
26+
- JAX basics: cookbook/active/jax_basics.ipynb
27+
- Introduction: cookbook/active/intro.ipynb
28+
- The generative function interface: cookbook/active/generative_function_interface.ipynb
29+
- Working with choice maps: cookbook/active/choice_maps.ipynb
30+
- Debugging: cookbook/active/debugging.ipynb
31+
32+
- Still being tidied:
33+
- Generative functions: cookbook/inactive/generative_fun.ipynb
34+
35+
- Expressivity:
36+
- cookbook/inactive/expressivity/conditionals.ipynb
37+
- cookbook/inactive/expressivity/iterating_computation.ipynb
38+
- cookbook/inactive/expressivity/masking.ipynb
39+
- cookbook/inactive/expressivity/mixture.ipynb
40+
- cookbook/inactive/expressivity/custom_distribution.ipynb
41+
- cookbook/inactive/expressivity/stochastic_probabilities.ipynb
42+
- cookbook/inactive/expressivity/stochastic_probabilities_math.ipynb
43+
44+
- Inference:
45+
- Importance sampling: cookbook/inactive/inference/importance_sampling.ipynb
46+
- Custom proposal: cookbook/inactive/inference/custom_proposal.ipynb
47+
- MCMC: cookbook/inactive/inference/mcmc.ipynb
48+
49+
- Differentiation:
50+
- ADEV Example: cookbook/inactive/differentiation/adev_example.py
51+
52+
- Library developers:
53+
- Dimap combinator: cookbook/inactive/library_author/dimap_combinator.ipynb
54+
2555
- Library reference:
2656
- Core: library/core.md
2757
- Generative functions: library/generative_functions.md
2858
- Combinators: library/combinators.md
2959
- Inference: library/inference.md
30-
# - ADEV: library/adev.md
3160
- For developers:
3261
- Developing: developing.md
3362
- Code of conduct: codeofconduct.md
@@ -38,6 +67,9 @@ theme:
3867
name: material
3968
logo: assets/img/small_logo.png
4069
favicon: assets/img/gen-logo.png
70+
font:
71+
text: Roboto
72+
code: Berkeley Mono
4173
icon:
4274
repo: fontawesome/brands/github
4375
features:
@@ -77,6 +109,15 @@ plugins:
77109
- search
78110
- offline
79111
- markdown-exec
112+
- mkdocs-jupyter:
113+
execute: true
114+
allow_errors: false
115+
ignore:
116+
# TODO: re-enable once we can support marginals as targets
117+
- "cookbook/inactive/expressivity/ravi_stack.ipynb"
118+
- "cookbook/inactive/differentiation/adev_demo.py"
119+
120+
highlight_extra_classes: "custom-css-classes"
80121
- typeset:
81122
enabled: true
82123
- git-revision-date-localized:

notebooks/.gitignore

-1
This file was deleted.

0 commit comments

Comments
 (0)