Skip to content

Commit

Permalink
jekyll build from Action be766a5
Browse files Browse the repository at this point in the history
  • Loading branch information
willGraham01 committed Nov 23, 2023
0 parents commit 2b10892
Show file tree
Hide file tree
Showing 626 changed files with 449,949 additions and 0 deletions.
Empty file added .nojekyll
Empty file.
36 changes: 36 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This work is the copyright of its various contributors.

This collection of material is licensed under a Creative Commons - Attribution license.

The list of contributors can be found at https://github.com/UCL/rsd-engineeringcourse/graphs/contributors.

It is a derivative work of the work of the Software Carpentry Initiative,
a full list of contributors can be found at https://github.com/swcarpentry/boot-camps/graphs/contributors.

You are free:

- to **Share** - to copy, distribute and transmit the work
- to **Remix** - to adapt the work

Under the following conditions:

- **Attribution** - You must attribute the work in the manner specified by the
author or licensor (but not in any way that suggests that they endorse you or
your use of the work).

With the understanding that:

- **Waiver** - Any of the above conditions can be waived if you get permission
from the copyright holder.
- **Other Rights** - In no way are any of the following rights affected by the
license:
- Your fair dealing or fair use rights;
- The author’s moral rights;
- Rights other persons may have either in the work itself or in how the work
is used, such as publicity or privacy rights.
- **Notice** - For any reuse or distribution, you must make clear to others the
license terms of this work. The best way to do this is with a link to this
[web page](http://creativecommons.org/licenses/by/3.0/).

For the full legal text of this license, please see
http://creativecommons.org/licenses/by/3.0/legalcode.
109 changes: 109 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
PANDOC=pandoc

ROOT=""

PANDOCARGS=-t revealjs -s -V theme=night --css=http://lab.hakim.se/reveal-js/css/theme/night.css \
--css=$(ROOT)/css/ucl_reveal.css --css=$(ROOT)/site-styles/reveal.css \
--default-image-extension=png --highlight-style=zenburn --mathjax -V revealjs-url=http://lab.hakim.se/reveal-js
PRENOTEBOOKS=$(wildcard ch*/*.ipynb.py)
NOTEBOOKS_DONE=$(PRENOTEBOOKS:.ipynb.py=.ipynb)
NOTEBOOKS=$(filter-out %.v2.ipynb %.nbconvert.ipynb,$(sort $(wildcard ch*/*.ipynb)))
SVGS=$(wildcard ch*/*.svg)

HTMLS=$(PRENOTEBOOKS:.ipynb.py=.html)

EXECUTED=$(NOTEBOOKS:.ipynb=.nbconvert.ipynb)
PNGS=$(SVGS:.svg=.png)
NBV2=$(NOTEBOOKS:.ipynb=.v2.ipynb)

default: _site

%/slides.html: %/*.md Makefile
cat $^ | $(PANDOC) $(PANDOCARGS) -o $@

%.png: %.py Makefile
python $< $@

%.png: %.nto Makefile
neato $< -T png -o $@

%.png: %.dot Makefile
dot $< -T png -o $@

%.png: %.svg Makefile
dbus-run-session inkscape -z -e $@ -w 600 $<

%.png: %.uml plantuml.jar Makefile
java -Djava.awt.headless=true -jar plantuml.jar -p < $< > $@

%.html: %.nbconvert.ipynb Makefile jekyll_template
jupyter nbconvert --to html --template jekyll_template --stdout $< > $@

%.v2.ipynb: %.nbconvert.ipynb
jupyter nbconvert --to notebook --nbformat 2 --stdout $< > $@

%.ipynb: %.ipynb.py
jupytext --to ipynb $< -o - > $@

%.nbconvert.ipynb: %.ipynb
jupyter nbconvert --to notebook --allow-errors --ExecutePreprocessor.timeout=120 --execute --stdout $< > $@

notes.pdf: combined.ipynb $(PNGS) Makefile
jupyter nbconvert --to pdf --template latex_template $<
mv combined.pdf notes.pdf

combined.ipynb: $(EXECUTED)
python nbmerge.py $^ $@
sed -i -e 's/\.svg/\.png/g' $@

notes.tex: combined.ipynb $(PNGS) Makefile
jupyter nbconvert --to latex --template latex_template $<
mv combined.tex notes.tex

notebooks.zip: ${NBV2}
zip -r notebooks $^

ready: $(HTMLS) # notes.pdf notebooks.zip

plantuml.jar:
wget http://sourceforge.net/projects/plantuml/files/plantuml.jar/download -O plantuml.jar

.PHONY: ready

_site: ready
jekyll build --verbose

preview: ready
jekyll serve --verbose

worked: $(NOTEBOOKS_DONE)
find ./ -iname '*ipynb'

clean:
rm -f ch*/generated/*.png
rm -rf ch*/*.html
rm -f ch*/*.pyc
rm -f ch*/*.ipynb
rm -f index.html
rm -rf _site
rm -rf images js css _includes _layouts favicon* master.zip indigo-jekyll-master
rm -f indigo
rm -f ch01python/analyzer.py
rm -f ch01python/eight
rm -f ch01python/eight.py
rm -rf ch01python/module1/
rm -f ch01python/pretty.py
rm -f ch*/*.nbconvert.ipynb
rm -rf ch*/*.v2.ipynb
rm -rf combined*
rm -f notes.pdf
rm -f notes.tex
rm -f ch04packaging/greeter.py
rm -f ch04packaging/map.png
rm -f ch05construction/anotherfile.py
rm -f ch05construction/config.yaml
rm -f ch05construction/context.py
rm -f ch06design/fixed.png
rm -f ch07dry/datasource*.yaml
rm -f ch07dry/example.yaml
rm -f notebooks.zip
93 changes: 93 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# rsd-engineeringcourse

Course materials for Research Software Engineering course.


## Content:

In this course, you will move beyond programming, to learn how to construct reliable, readable, efficient research software in a collaborative environment. The emphasis is on practical techniques, tips, and technologies to effectively build and maintain complex code. This is a semester module (30 hours over 10 half-days), intensive, practical course. The content of each of the 10 half-day units is as follows:

1. Code management. Distributed version control. Git. Github
1. Collaborating around code. Issue tracking. Code review and pull requests. Branches and merging
1. Introduction to Python and Scientific programming
1. Analysing and plotting Research data
1. Testing scientific software. Unit testing, regression testing. Test-driven design. Expectations and assertions. Mocking. Build-and-test servers. Negative testing. Sensible error messages. Setting up Continuous Integration.
1. Documenting software projects. Managed logging. Debugging and debuggers. Coverage measurement. Finding errors in the past.
1. Writing libraries and creating packages. Software licenses. Citing software. Software sustainability. Comments. Coding conventions.
1. Software as engineering. Pragmatic use of diagram languages. Requirements engineering. Agile and Waterfall. Functional and architectural design.
1. Best practice in construction. Design and development. Object-oriented design.
1. Analysing performance. Profiling code. Developing faster code.

## Prerequisites:

- You must have reasonable experience in at least one compiled language, such as C++, C, or Fortran, and at least one dynamic language, such as Python, Ruby, Matlab or R.
- You must also have experience of the Unix shell.

Examples and exercises for this course will be provided in Python. You will therefore find it easiest to follow along if you have experience in it. Appropriate Python experience could be obtained from the Software Carpentry workshops. Previous experience with version control (such as from Software Carpentry) would be helpful.

You are required to bring your own laptop to the course as the classrooms we are using do not have desktop computers.

# Contributing to this repository

This repository contains the course notes as Jupyter notebooks converted into `py:percent` format. This allows to edit the files as plain text as well as jupyter notebooks. To edit them as jupyter notebooks you'll need to have installed jupytext and open the `ipynb.py` files as notebooks via right-click and select "open with" and "notebook" on the Jupyter file browser.

⚠ Do not run `make` locally on your computer! ⚠

It will produce side effects on your global git configuration!
Instead, follow the instructions below.

## Testing it locally

The site is built using gh-actions. If you'd like to test the actions locally,
you can run the actions using [`act`](https://github.com/nektos/act) command
tool. By default this will run the action in a copy of the repository and you
won't be able to inspect the steps that happened. If you'd like to keep the
output in the current directory, use the `-b` (bind) flag.

```bash
$ act -b
[Build website/Build-website] 🚀 Start image=catthehacker/ubuntu:act-latest
[Build website/Build-website] 🐳 docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Build website/Build-website] ⭐ Run actions/checkout@v2
[Build website/Build-website] ✅ Success - actions/checkout@v2
[Build website/Build-website] ⭐ Run actions/cache@v2
INFO[0000] ☁ git clone 'https://github.com/actions/cache' # ref=v2
[Build website/Build-website] ✅ Success - actions/cache@v2
[Build website/Build-website] ⭐ Run Install TeXLive
INFO[0000] ☁ git clone 'https://github.com/DanySK/setup-texlive-action' # ref=0.1.1
[Build website/Build-website] ✅ Success - Install TeXLive
[Build website/Build-website] ⭐ Run Setup Python
INFO[0001] ☁ git clone 'https://github.com/actions/setup-python' # ref=v2
[Build website/Build-website] ✅ Success - Setup Python
[Build website/Build-website] ⭐ Run Install dependencies
INFO[0001] ☁ git clone 'https://github.com/py-actions/py-dependency-install' # ref=v2
[Build website/Build-website] ✅ Success - Install dependencies
[Build website/Build-website] ⭐ Run Building notes
[Build website/Build-website] ✅ Success - Building notes
[Build website/Build-website] ⭐ Run Builds website
INFO[0001] ☁ git clone 'https://github.com/helaili/jekyll-action' # ref=v2
[Build website/Build-website] 🐳 docker run image=act-helaili-jekyll-action-v2:latest platform= entrypoint=[] cmd=[]
[Build website/Build-website] ✅ Success - Builds website
```

Alternatively, if you want to only run the jekyll build step once you've run the whole action, you can use the official jekyll containers with:

```bash
$ docker run --rm --volume="$PWD:/srv/jekyll" --volume="$PWD/vendor/bundle:/usr/local/bundle" -p 4000:4000 -it jekyll/jekyll:latest jekyll serve
```

and open http://localhost:4000/rsd-engineeringcourse (or the link provided).
Note that this is mounting the `bundle` directory where `act` will create them.

# Migration from jupyter notebooks to py:percent

Using `jupytext` we've converted all the jupyter notebooks into plain text python files (py:percent) with:

```bash
# First cleaned all outputs and commited it
nbstripout --extra-keys metadata.kernelspec ch*/*ipynb
# convert them
find ./ -iname '*ipynb' -exec jupytext --opt notebook_metadata_filter="kernelspec,jupytext,jekyll" --to py:percent {} -o {}.py \;
# then deleted the ipynb
find ./ -iname '*ipynb' -delete
```
73 changes: 73 additions & 0 deletions assets/css/jekyll-styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
div#slidelink {
float: right;
}

.hll { background-color: #ffffcc }
.c { color: #999988; font-style: italic } /* Comment */
.err { color: #a61717; background-color: #e3d2d2 } /* Error */
.k { color: #000000; font-weight: bold } /* Keyword */
.o { color: #000000; font-weight: bold } /* Operator */
.cm { color: #999988; font-style: italic } /* Comment.Multiline */
.cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.c1 { color: #999988; font-style: italic } /* Comment.Single */
.cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.ge { color: #000000; font-style: italic } /* Generic.Emph */
.gr { color: #aa0000 } /* Generic.Error */
.gh { color: #999999 } /* Generic.Heading */
.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.go { color: #888888 } /* Generic.Output */
.gp { color: #555555 } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #aaaaaa } /* Generic.Subheading */
.gt { color: #aa0000 } /* Generic.Traceback */
.kc { color: #000000; font-weight: bold } /* Keyword.Constant */
.kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
.kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
.kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
.kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
.kt { color: #445588; font-weight: bold } /* Keyword.Type */
.m { color: #009999 } /* Literal.Number */
.s { color: #d01040 } /* Literal.String */
.na { color: #008080 } /* Name.Attribute */
.nb { color: #0086B3 } /* Name.Builtin */
.nc { color: #445588; font-weight: bold } /* Name.Class */
.no { color: #008080 } /* Name.Constant */
.nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
.ni { color: #800080 } /* Name.Entity */
.ne { color: #990000; font-weight: bold } /* Name.Exception */
.nf { color: #990000; font-weight: bold } /* Name.Function */
.nl { color: #990000; font-weight: bold } /* Name.Label */
.nn { color: #555555 } /* Name.Namespace */
.nt { color: #000080 } /* Name.Tag */
.nv { color: #008080 } /* Name.Variable */
.ow { color: #000000; font-weight: bold } /* Operator.Word */
.w { color: #bbbbbb } /* Text.Whitespace */
.mf { color: #009999 } /* Literal.Number.Float */
.mh { color: #009999 } /* Literal.Number.Hex */
.mi { color: #009999 } /* Literal.Number.Integer */
.mo { color: #009999 } /* Literal.Number.Oct */
.sb { color: #d01040 } /* Literal.String.Backtick */
.sc { color: #d01040 } /* Literal.String.Char */
.sd { color: #d01040 } /* Literal.String.Doc */
.s2 { color: #d01040 } /* Literal.String.Double */
.se { color: #d01040 } /* Literal.String.Escape */
.sh { color: #d01040 } /* Literal.String.Heredoc */
.si { color: #d01040 } /* Literal.String.Interpol */
.sx { color: #d01040 } /* Literal.String.Other */
.sr { color: #009926 } /* Literal.String.Regex */
.s1 { color: #d01040 } /* Literal.String.Single */
.ss { color: #990073 } /* Literal.String.Symbol */
.bp { color: #999999 } /* Name.Builtin.Pseudo */
.vc { color: #008080 } /* Name.Variable.Class */
.vg { color: #008080 } /* Name.Variable.Global */
.vi { color: #008080 } /* Name.Variable.Instance */
.il { color: #009999 } /* Literal.Number.Integer.Long */
.photograph {
background-color: #007e9e;
}
.header--mobile {
background-color: #007e9e;
border-bottom-color: #007e9e;
}

1 change: 1 addition & 0 deletions assets/css/print.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading

0 comments on commit 2b10892

Please sign in to comment.