Skip to content

Commit e5da25c

Browse files
committed
Add development info
1 parent bee1f43 commit e5da25c

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

developing.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Development workflow
2+
3+
FastAI.jl, as a end-user friendly umbrella package, puts importance on helpful documentation. To make it easier to write documentation and see the results interactively, you can follow this guide.
4+
5+
## Setup
6+
7+
You'll have to do the following:
8+
9+
**Fork FastAI.jl and add it as a `dev` dependency.** You can fork it from [the GitHub repository](https://github.com/FluxML/FastAI.jl). Then use `Pkg` to add your fork to your Julia environment:
10+
11+
```julia
12+
using Pkg
13+
Pkg.develop("https://github.com/<myusername>/FastAI.jl")
14+
```
15+
16+
**Activate the documentation environment and install the dependencies.** You can find the folder that FastAI.jl was cloned to using `using FastAI; pkgdir(FastAI)`. In a Julia session, change the current directory to that path, activate the `docs/` environment and install unregistered dependencies:
17+
18+
```julia
19+
using FastAI, Pkg
20+
21+
cd(pkgdir(FastAI))
22+
Pkg.activate("./docs/")
23+
Pkg.add("https://github.com/lorenzoh/Pollen.jl")
24+
Pkg.add("https://github.com/lorenzoh/LiveServer.jl")
25+
Pkg.instantiate()
26+
```
27+
28+
Finally you can start the development server which will serve the documentation locally and reload any changes you make:
29+
30+
```julia
31+
include("./docs/serve.jl")
32+
```
33+
34+
On subsequent runs, it'll be enough to activate the environment and include the startup file:
35+
36+
```julia
37+
using FastAI, Pkg
38+
Pkg.activate(joinpath(pkgdir(FastAI), "docs"))
39+
include(joinpath(pkgdir("FastAI"), "docs", "serve.jl"))
40+
```
41+
42+
### Notes
43+
44+
For performance reasons, the development server will only build each page once you open it in the browser, you might have to refresh the tab after a few seconds. The terminal output will show when a page is being built; for documentation pages that have a lot of code cells that need to be run, it can take some time for the page to be built. If any changes are made to the source file of the documentation package, the page will automatically be rebuilt and the tab reloads.
45+
46+
## Adding documentation
47+
48+
### Adding source files
49+
50+
Documentation pages correspond to a Markdown `.md` or Jupyter Notebook `.ipynb` file that should be stored in the `docs/` folder.
51+
52+
- Jupyter Notebooks should be used when they use resources that are not available on the GitHub CI, like a GPU needed for training. You should run them locally and the outputs will be captured and inserted into the HTML page.
53+
- Markdown documents should be preferred for everything else, as they allow the code examples to be run on the GitHub CI, meaning they'll stay up-to-date unlike a notebook that has to be manually rerun.
54+
55+
Both formats support the [Markdown syntax of Publish.jl](https://michaelhatherly.github.io/Publish.jl/dev/docs/syntax.html) and in markdown files the [cell syntax of Publish.jl](https://michaelhatherly.github.io/Publish.jl/dev/docs/cells.html) can be used to mark code cells. These will be run and the output is inserted into the HTML page.
56+
57+
### Linking to documentation
58+
59+
For a new documentation file to be discoverable, you have to add an entry to the nested Markdown list in `toc.md`, which corresponds to the sidebar in the documentation (Updating the sidebar currently requires interrupting and reincluding the file that starts the development server).
60+
61+
Documentation pages can also link to each other using standard Markdown link syntax.
62+
63+
### Referencing code symbols
64+
65+
Symbols like `fitonecycle!` can be referenced by using the cross-referencing syntax ```[`fitonecycle!`](#) ``` which will link to and create a reference page from the symbol's docstrings. It will also be added as an entry on the references page.

0 commit comments

Comments
 (0)