Skip to content

Commit a5fc8e3

Browse files
authored
Merge pull request #543 from probcomp/reorganize_docs
Reorganize and add documentation
2 parents ff2deec + a50003a commit a5fc8e3

Some content is hidden

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

66 files changed

+1466
-1504
lines changed

.github/workflows/ContinuousIntegration.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ name: ContinuousIntegration
66
on:
77
push:
88
branches: [ master ]
9+
paths-ignore:
10+
- 'docs/**'
11+
- 'README.md'
12+
- 'CONTRIBUTING.md'
13+
- 'WEBSITE.md'
914
pull_request:
1015
branches: [ master ]
16+
paths-ignore:
17+
- 'docs/**'
18+
- 'README.md'
19+
- 'CONTRIBUTING.md'
20+
- 'WEBSITE.md'
1121

1222
jobs:
1323
ContinuousIntegration:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Adapted from
2+
# https://documenter.juliadocs.org/stable/man/hosting/#Cleaning-up-gh-pages
3+
4+
name: Doc Preview Cleanup
5+
6+
on:
7+
pull_request:
8+
types: [closed]
9+
10+
# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time
11+
concurrency:
12+
group: doc-preview-cleanup
13+
cancel-in-progress: false
14+
15+
jobs:
16+
doc-preview-cleanup:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
steps:
21+
- name: Checkout gh-pages branch
22+
uses: actions/checkout@v4
23+
with:
24+
ref: gh-pages
25+
- name: Delete preview and history + push changes
26+
run: |
27+
if [ -d "${preview_dir}" ]; then
28+
git config user.name "Documenter.jl"
29+
git config user.email "documenter@juliadocs.github.io"
30+
git rm -rf "${preview_dir}"
31+
git commit -m "delete preview"
32+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
33+
git push --force origin gh-pages-new:gh-pages
34+
fi
35+
env:
36+
preview_dir: docs/previews/PR${{ github.event.number }}

CONTRIBUTING.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
- In the introduction section(s), provide at least a few sentences of high-level description of the feature, to orient the user. Include external links and internal links. Then, include some short code snippets showing a minimal example of the feature being used. If relevant, include some simple Tex math.
3636

37-
- Build the docs locally to test that it builds and looks right:
38-
```sh
39-
./docs/build_docs_locally.sh
40-
```
37+
- Build the docs locally to test that it builds and looks right.
38+
39+
- Once you have a made a PR and are assigned a PR `NUMBER`, update your PR description with a link to the automatically generated documentation preview at https://www.gen.dev/docs/previews/PR{NUMBER}.

WEBSITE.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
The Gen website is hosted on Github pages at https://probcomp.github.io/Gen/
1+
The Gen website is hosted at https://www.gen.dev/.
22

33
The website is generated from the source files that are at the head commit of the `gh-pages` branch of the Gen repository.
44

55
To edit the website, check out the `gh-pages` branch, and commit and push changes.
66

7-
Automatically-generated Gen documentation is pushed to the `gh-pages` branch whenever a commit is made to the `master` branch of the Gen repository using a combination of Github Actions and Documenter.jl, which are configured in the files `.github/workflows/Documentation.yml` and `docs/make.jl` in the `master` branch.
7+
Automatically-generated Gen documentation is pushed to the `docs` folder of the `gh-pages` branch whenever a commit is made to the `master` branch of the Gen repository using a combination of Github Actions and Documenter.jl, which are configured in the files `.github/workflows/Documentation.yml` and `docs/make.jl` in the `master` branch. When a pull request is merged into the `master` branch, the `gh-pages` branch is updated with the new documentation, and documentation previews will be cleaned up by the `.github/workflows/Documentation.yml` workflow.
8+
89
The automatically-managed files and directories are:
910

10-
- `dev/` (documentation for the version of Gen on the head of `master` branch)
11+
- `docs/dev/` (documentation for the version of Gen on the head of `master` branch)
12+
13+
- `docs/v*.*.*/` (directories that contain documentation for each tagged release of Gen)
1114

12-
- `v*.*.*/` (directories that contain documentation for each tagged release of Gen)
15+
- `docs/latest/` (a symbolic link to `dev/`)
1316

14-
- `latest/` (a symbolic link to `dev/`)
17+
- `docs/stable/` (a symbolic link to the documentation directory of the latest tagged release Gen)
1518

16-
- `stable/` (a symbolic link to the documentation directory of the latest tagged release Gen)
19+
- `docs/previews/` (documentation previews for unmerged pull requests)
1720

18-
- `versions.js`
21+
- `docs/versions.js`
1922

2023
*Do not make commits that modify the contents of these automatically managed files and directories.*
2124

docs/README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
# Website Docs
2-
- `pages.jl` to find skeleton of website.
3-
- `make.jl` to build the website index.
1+
# Gen.jl Documentation
42

5-
The docs are divided in roughly four sections:
3+
- `pages.jl` to find skeleton of the Gen.jl documentation.
4+
- `make.jl` to build the documentation website index.
5+
6+
The documentation is divided into three sections:
67
- Getting Started + Tutorials
78
- How-to Guides
8-
- API = Modeling API + Inference API
9-
- Explanations + Internals
10-
9+
- Reference Guides
1110

1211
# Developing
13-
To build the docs, run `julia --make.jl` or alternatively startup the Julia REPL and include `make.jl`. For debugging, consider setting `draft=true` in the `makedocs` function found in `make.jl`.
14-
Currently you must write the tutorial directly in the docs rather than a source file (e.g. Quarto). See `getting_started` or `tutorials` for examples.
12+
13+
To build the docs, run `julia --make.jl`. Alternatively, start the Julia REPL, activate the `Project.toml` in this directory, then include `make.jl`. For debugging, consider setting `draft=true` in the `makedocs` function found in `make.jl`. This will avoid running the `@example` blocks when generating the tutorials.
14+
15+
Currently you must write the tutorial directly in the docs rather than in a source file. See `tutorials` for examples.
1516

1617
Code snippets must use the triple backtick with a label to run. The environment carries over so long as the labels match. Example:
1718

@@ -21,4 +22,4 @@ x = rand()
2122

2223
```@example tutorial_1
2324
print(x)
24-
```
25+
```

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ makedocs(
88
clean = true,
99
warnonly = true,
1010
format = Documenter.HTML(;
11-
assets = String["assets/header.js", "assets/header.css", "assets/theme.css"],
1211
collapselevel=1,
1312
),
1413
sitename = "Gen.jl",
@@ -21,4 +20,5 @@ deploydocs(
2120
repo = "github.com/probcomp/Gen.jl.git",
2221
target = "build",
2322
dirname = "docs",
23+
push_preview = true,
2424
)

docs/pages.jl

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,46 @@
11
pages = [
2-
"Home" => "index.md",
3-
"Getting Started" => [
4-
"Example 1: Linear Regression" => "getting_started/linear_regression.md",
5-
],
2+
"Gen.jl" => "index.md",
63
"Tutorials" => [
7-
"Basics" => [
8-
"tutorials/basics/modeling_in_gen.md",
9-
"tutorials/basics/gfi.md",
10-
"tutorials/basics/combinators.md",
11-
"tutorials/basics/particle_filter.md",
12-
"tutorials/basics/vi.md",
13-
],
14-
"Advanced" => [
15-
"tutorials/trace_translators.md",
16-
],
17-
"Model Optmizations" => [
18-
"Speeding Inference with the Static Modeling Language" => "tutorials/model_optimizations/scaling_with_sml.md",
19-
],
4+
"Getting Started" => "tutorials/getting_started.md",
5+
"Introduction to Modeling in Gen" => "tutorials/modeling_in_gen.md",
6+
"Object Tracking with SMC" => "tutorials/smc.md",
7+
"Variational Inference in Gen" => "tutorials/vi.md",
8+
"Learning Generative Functions" => "tutorials/learning_gen_fns.md",
9+
"Speeding Up Inference with the SML" => "tutorials/scaling_with_sml.md",
2010
],
2111
"How-to Guides" => [
22-
"MCMC Kernels" => "how_to/mcmc_kernels.md",
23-
"Custom Distributions" => "how_to/custom_distributions.md",
24-
"Custom Modeling Languages" => "how_to/custom_dsl.md",
25-
"Custom Gradients" => "how_to/custom_derivatives.md",
26-
"Incremental Computation" => "how_to/custom_incremental_computation.md",
12+
"Extending Gen" => "how_to/extending_gen.md",
13+
"Adding New Distributions" => "how_to/custom_distributions.md",
14+
"Adding New Generative Functions" => "how_to/custom_gen_fns.md",
15+
"Custom Gradients" => "how_to/custom_gradients.md",
16+
"Custom Incremental Computation" => "how_to/custom_incremental_computation.md",
2717
],
28-
"API Reference" => [
18+
"Reference" => [
19+
"Core Interfaces" => [
20+
"Generative Function Interface" => "ref/core/gfi.md",
21+
"Choice Maps" => "ref/core/choice_maps.md",
22+
"Selections" => "ref/core/selections.md",
23+
"Change Hints" => "ref/core/change_hints.md",
24+
],
2925
"Modeling Library" => [
30-
"Generative Functions" => "api/model/gfi.md",
31-
"Probability Distributions" => "api/model/distributions.md",
32-
"Choice Maps" => "api/model/choice_maps.md",
33-
"Built-in Modeling Languages" => "api/model/modeling.md",
34-
"Combinators" => "api/model/combinators.md",
35-
"Selections" => "api/model/selections.md",
36-
"Optimizing Trainable Parameters" => "api/model/parameter_optimization.md",
37-
"Trace Translators" => "api/model/trace_translators.md",
26+
"Built-In Modeling Language" => "ref/modeling/dml.md",
27+
"Static Modeling Language" => "ref/modeling/sml.md",
28+
"Probability Distributions" => "ref/modeling/distributions.md",
29+
"Combinators" => "ref/modeling/combinators.md",
30+
"Custom Generative Functions" => "ref/modeling/custom_gen_fns.md",
3831
],
3932
"Inference Library" => [
40-
"Importance Sampling" => "api/inference/importance.md",
41-
"MAP Optimization" => "api/inference/map.md",
42-
"Markov chain Monte Carlo" => "api/inference/mcmc.md",
43-
"MAP Optimization" => "api/inference/map.md",
44-
"Particle Filtering" => "api/inference/pf.md",
45-
"Variational Inference" => "api/inference/vi.md",
46-
"Learning Generative Functions" => "api/inference/learning.md"
33+
"Importance Sampling" => "ref/inference/importance.md",
34+
"Markov Chain Monte Carlo" => "ref/inference/mcmc.md",
35+
"Particle Filtering & SMC" => "ref/inference/pf.md",
36+
"Trace Translators" => "ref/inference/trace_translators.md",
37+
"Parameter Optimization" => "ref/inference/parameter_optimization.md",
38+
"MAP Optimization" => "ref/inference/map.md",
39+
"Variational Inference" => "ref/inference/vi.md",
40+
"Wake-Sleep Learning" => "ref/inference/wake_sleep.md",
4741
],
42+
"Internals" => [
43+
"Modeling Language Implementation" => "ref/internals/language_implementation.md",
44+
]
4845
],
49-
"Explanation and Internals" => [
50-
"Modeling Language Implementation" => "explanations/language_implementation.md",
51-
"explanations/combinator_design.md"
52-
]
5346
]

docs/src/api/inference/map.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/src/api/inference/mcmc.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

docs/src/api/inference/pf.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)