Skip to content

Commit 77aeee5

Browse files
committed
Further improvements for the README
1 parent b0c62c7 commit 77aeee5

File tree

1 file changed

+54
-58
lines changed

1 file changed

+54
-58
lines changed

README.md

Lines changed: 54 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# DataScienceTutorials.jl
22

3-
This repository contains the source code for a [set of tutorials](https://juliaai.github.io/DataScienceTutorials.jl/) introducing the use of Julia and Julia packages such as MLJ (but not only) to do "data science" in Julia.
3+
This repository contains the source code for a [set of tutorials](https://juliaai.github.io/DataScienceTutorials.jl/) introducing the use of Julia and Julia packages such as MLJ, among others, to do "data science" in Julia.
44

5-
## For readers
5+
## 📖 For readers
66

77
You can read the tutorials [online](https://juliaai.github.io/DataScienceTutorials.jl/).
88

@@ -18,11 +18,11 @@ Pkg.instantiate()
1818

1919
**Note**: you are strongly encouraged to [open issues](https://github.com/juliaai/DataScienceTutorials.jl/issues/new) on this repository indicating points that are unclear or could be better explained, help us have great tutorials!
2020

21-
## For developers
21+
## 👩‍💻 For developers
2222

2323
The rest of these instructions assume that you've cloned the package and have `cd` to it.
2424

25-
### Structure
25+
### 📂 Structure
2626
The following are the folders relevant to pages on the website:
2727
```
2828
├── _literate
@@ -40,18 +40,20 @@ The following are the folders relevant to pages on the website:
4040
├── index.md # has markdown for the landing page
4141
├── search.md # has markdown for the search page
4242
├── routes.json # has all the navigation bar data
43-
├── collapse-script.jl # script that adds dropdowns to tutorials
43+
├── collapse-script.jl # script that adds collapsible sections to tutorials
4444
├── deploy.jl # deployment script
4545
├── Manifest.toml
46-
└── Project.toml # Project's environment
46+
└── Project.toml # For the project's environment
4747
```
48-
To understand the rest of the structure which could help you change styles with CSS or add interaction with JavaScript read the relevant page on [Franklin's documentation](https://franklinjl.org/workflow/)
48+
To understand the rest of the structure which could help you change styles with CSS or add interaction with JavaScript read the relevant page on [Franklin's documentation](https://franklinjl.org/workflow/).
4949

50-
### Fixing an existing tutorial
50+
### 👨🏻‍🔧 Modifying an existing tutorial
5151

52-
Find the corresponding Julia script in `_literate` and fix it in a PR.
52+
* Find the corresponding Julia script in `_literate` and fix it in a PR.
53+
* Ensure it works and renders properly as explained in [this section](#👀-visualise-modifications-locally).
5354

54-
### Add a new tutorial
55+
56+
### ✨ Add a new tutorial
5557

5658
* Go to the appropriate folder inside `_literate` depending on the category of the tutorial as described above
5759
* Duplicate one of the tutorials as a starting point.
@@ -60,26 +62,59 @@ Find the corresponding Julia script in `_literate` and fix it in a PR.
6062
* Write your tutorial following the blueprint
6163
* Run `julia collapse-script.jl` to add necessary Franklin syntax to your tutorial to make sections in it collapsible like other tutorials
6264

63-
**Note**: your tutorial **must** "just work" otherwise it will be ignored, in other words, any Julia user should be able to just copy the folder containing your `.jl` and `.toml` files, and run it without having to do anything special.
65+
> [!IMPORTANT]
66+
> Your tutorial **must** "just work" otherwise it will be ignored, in other words, any Julia user should be able to just copy the folder containing your `.jl` and `.toml` files, and run it without having to do anything special.
6467
6568
Once all that's done, the remaining things to do are to create the HTML page and a link in the appropriate location. Let's assume you wanted to add an E2E tutorial "Dinosaurs" then this implies that `_literate/end-to-end/dinosaurs.jl` exists and you would:
6669

6770
* Create a file `dinosaurs.md` in the top-level folder `end-to-end/` by duplicating the `end-to-end/wine.md` and changing the reference in it to `\tutorial{end-to-end/dinosaurs}`
6871
* Add a link pointing to that tutorial in `routing.json` following the template so your tutorial shows in the navigation bar
69-
* Ensure your tutorials renders correctly by running the following:
72+
* Ensure your tutorials renders correctly as explained in the [next section](#👀-visualise-modifications-locally).
73+
74+
> [!NOTE]
75+
> For plots, we do prefer that you use `Plots.jl` with the default backend. In general, try to avoid having Python as a dependency in your tutorial.
76+
77+
<details>
78+
<summary> For more information about adding plots</summary>
79+
<br>
80+
Follow the pattern in existing tutorials; finish a code block defining a plot with:
81+
7082
```julia
71-
cd("path/to/DataScienceTutorials")
83+
savefig(joinpath(@OUTPUT, "MyTutorial-Fig1.svg")) # hide
84+
85+
# \figalt{the alt here}{MyTutorial-Fig1.svg}
86+
```
87+
88+
Here "the alt here" is the text that appears if there is problem rendering the
89+
figure. Please do not use anything else than SVG; please also stick to
90+
this path and start the name of the file with the name of the tutorial
91+
(to help keep files organised).
7292

93+
Do not forget to add the `# hide` which will ensure the line is not displayed on the website, notebook, or script.
94+
</details>
95+
96+
### 👀 Visualise modifications locally
97+
98+
```julia
7399
using Pkg
74100
Pkg.activate(".")
75101
Pkg.instantiate()
76102

77103
using Franklin
78-
serve() # serve the website locally
104+
serve()
79105
```
80-
This may generate some files under `__site`. Don't push them in your PR.
81106

82-
### Publishing updates
107+
This makes Franklin to re-evaluate some of the code based on the changes which may take some time, progress is indicated in the REPL. Once it finishes it will open the browser to render the website after the changes.
108+
109+
**Note**:
110+
- If you decide to change some of the code while `serve()` is running, this is fine, Franklin will detect it and trigger an update of the relevant web pages (after evaluating the new code).
111+
112+
- This may generate some files under `__site` don't push them in your PR as they will be pushed upon deployment.
113+
114+
- Avoid modifying the literate file, killing the Julia session, then calling `serve()` that sequence can cause weird issues where Julia will complain about the age of the world...
115+
116+
117+
### 🚀 Publishing updates
83118

84119
**Assumptions**:
85120

@@ -105,47 +140,8 @@ run(`sudo $(npm_cmd()) i lunr cheerio`)
105140

106141
This should take ≤ 15 seconds to complete.
107142

108-
---
109-
110-
# Old instructions (still valid)
111-
112-
### Visualise modifications locally
113-
114-
```julia
115-
cd("path/to/DataScienceTutorials")
116-
using Franklin
117-
serve()
118-
```
119-
120-
If you have changed the *code* of some of the literate scripts, Franklin will need to re-evaluate some of the code which may take some time, progress is indicated in the REPL.
121-
122-
If you decide to change some of the code while `serve()` is running, this is fine, Franklin will detect it and trigger an update of the relevant web pages (after evaluating the new code).
123-
124-
**Notes**:
125-
- avoid modifying the literate file, killing the Julia session, then calling `serve()` that sequence can cause weird issues where Julia will complain about the age of the world...
126-
- the `serve()` command above activates the environment.
127-
128-
### Plots
129-
130-
For the moment, plots are done with `PyPlot.jl` (though you're not restricted to use it).
131-
It's best not to use `Plots.jl` because the loading time would risk making full updates of the webpage annoyingly slow.
132-
133-
In order to display a plot, finish a code block defining a plot with
134-
135-
```
136-
savefig(joinpath(@OUTPUT, "MyTutorial-Fig1.svg")) # hide
137-
138-
# \figalt{the alt here}{MyTutorial-Fig1.svg}
139-
```
140-
141-
Here "the alt here" is the text that appears if there is problem rendering the
142-
figure. Please do not use anything else than SVG; please also stick to
143-
this path and start the name of the file with the name of the tutorial
144-
(to help keep files organised).
145-
146-
Do not forget to add the `# hide` which will ensure the line is not displayed on the website, notebook, or script.
143+
### 🕵🏽 Troubleshooting
147144

148-
### Troubleshooting
149145

150146
#### Stale files
151147

@@ -159,7 +155,7 @@ save the file, wait for Franklin to complete its update and then remove it (othe
159155

160156
If you get an "age of the world" error, the `reeval` steps above usually works as well.
161157

162-
If you want to force the reevaluation of everything once, restart a Julia session and use
158+
If you want to force the reevaluation of all tutorials at once, restart a Julia session and use
163159

164160
```julia
165161
serve(; eval_all=true)
@@ -169,7 +165,7 @@ note that this will take a while.
169165

170166
#### Merge conflicts or Missing Styles
171167

172-
If you get merge conflicts or have styles that seem to be missing after `serve()`, do
168+
If you get merge conflicts or have new website styles that seem to be missing after `serve()`, do
173169

174170
```julia
175171
cleanpull()

0 commit comments

Comments
 (0)