From 548469b4fc11406a0b956d2b911f08a8402f08d7 Mon Sep 17 00:00:00 2001 From: Arnaud Legrand Date: Tue, 19 Feb 2019 15:28:06 +0100 Subject: [PATCH] Remove all html generated files (from the 1st edition) and automate org -> markdown generation --- Makefile | 5 + Makefile.ressources | 15 + .../ressources => bin}/html_png_inliner.pl | 0 module1/ressources/Makefile | 14 +- .../ressources/introduction_to_markdown.html | 540 ----------- module2/ressources/Makefile | 14 +- module2/ressources/emacs_orgmode.html | 604 ------------- module2/ressources/gitlab.html | 504 ----------- module2/ressources/jupyter.html | 421 --------- module2/ressources/maintaining_a_journal.html | 281 ------ module2/ressources/rstudio.html | 303 ------- module3/ressources/Makefile | 3 + module4/ressources/Makefile | 15 +- module4/ressources/html_png_inliner.pl | 17 - module4/ressources/resources_environment.html | 847 ------------------ module4/ressources/resources_environment.org | 13 + .../ressources/resources_environment_fr.org | 16 +- module4/ressources/resources_refs.html | 205 ----- 18 files changed, 54 insertions(+), 3763 deletions(-) create mode 100644 Makefile create mode 100644 Makefile.ressources rename {module2/ressources => bin}/html_png_inliner.pl (100%) delete mode 100644 module1/ressources/introduction_to_markdown.html delete mode 100644 module2/ressources/emacs_orgmode.html delete mode 100644 module2/ressources/gitlab.html delete mode 100644 module2/ressources/jupyter.html delete mode 100644 module2/ressources/maintaining_a_journal.html delete mode 100644 module2/ressources/rstudio.html create mode 100644 module3/ressources/Makefile delete mode 100755 module4/ressources/html_png_inliner.pl delete mode 100644 module4/ressources/resources_environment.html delete mode 100644 module4/ressources/resources_refs.html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f0e6a75 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +ressources-md: + for i in module1/ressources module2/ressources module3/ressources \ + module4/ressources; do \ + make -C $$i; \ + done diff --git a/Makefile.ressources b/Makefile.ressources new file mode 100644 index 0000000..412ef16 --- /dev/null +++ b/Makefile.ressources @@ -0,0 +1,15 @@ + +%.md: %.org + pandoc -f org -t markdown_github -o $@ $^ + +# %.html: %.org +# emacs -batch $^ --funcall org-html-export-to-html +# sed -i -e 's/
/
  • /g' \ +# -e 's/
      /
        /g' $@ +# mv $@ $@.bak +# html_png_inliner.pl < $@.bak | grep -A $(NLINES) -e '' | grep -B $(NLINES) -e '
        ' | grep -v -e '' -e '
        ' > $@ +# rm $@.bak + +clean: + rm -f *~ diff --git a/module2/ressources/html_png_inliner.pl b/bin/html_png_inliner.pl similarity index 100% rename from module2/ressources/html_png_inliner.pl rename to bin/html_png_inliner.pl diff --git a/module1/ressources/Makefile b/module1/ressources/Makefile index 41df172..839d368 100644 --- a/module1/ressources/Makefile +++ b/module1/ressources/Makefile @@ -1,13 +1,3 @@ -all: introduction_to_markdown.html +all: introduction_to_markdown.md - -NLINES=10000000 - -%.html: %.org - emacs -batch $^ --funcall org-html-export-to-html - sed -i -e 's/
        /
      • /g' \ - -e 's/
          /
            /g' $@ - mv $@ $@.bak - cat $@.bak | grep -A $(NLINES) -e '' | grep -B $(NLINES) -e '
            ' | grep -v -e '' -e '
            ' > $@ - rm $@.bak +include ../../Makefile.ressources diff --git a/module1/ressources/introduction_to_markdown.html b/module1/ressources/introduction_to_markdown.html deleted file mode 100644 index c878a66..0000000 --- a/module1/ressources/introduction_to_markdown.html +++ /dev/null @@ -1,540 +0,0 @@ -
            -

            Introduction à Markdown

            - -

            -Voici un aperçu rapide de la syntaxe Markdown repris d'une -présentation de Github ainsi que de celles d'Archer Reilly. -

            -
            -

            Syntaxe

            -
            -
            -
            -

            Headers

            -
            -
            -# This is an <h1> tag
            -## This is an <h2> tag
            -###### This is an <h6> tag
            -
            -
            -
            - -
            -

            Emphasis

            -
            -
            -*This text will be italic*
            -_This will also be italic_
            -
            -**This text will be bold**
            -__This will also be bold__
            -
            -_You **can** combine them_
            -
            -
            -
            - -
            -

            Lists

            -
            -
            -
            -

            Unordered

            -
            -
            -- Item 1
            -- Item 2
            -  - Item 2a
            -  - Item 2b
            -
            -
            -
            -
            -

            Ordered

            -
            -
            -1. Item 1
            -2. Item 2
            -3. Item 3
            -   1. Item 3a
            -   2. Item 3b
            -
            -
            -
            -
            -
            -

            Images

            -
            -
            -![GitHub Logo](/images/logo.png)
            -Format: ![Alt Text](url)
            -
            -
            -
            -
            -

            Links

            -
            -
            -http://github.com - automatic!
            -[GitHub](http://github.com)
            -
            -
            -
            -
            -

            Blockquotes

            -
            -
            -As Kanye West said:
            -
            -> We're living the future so
            -> the present is our past.
            -
            -
            -
            -
            -

            Inline code

            -
            -
            -To print some text with python, you should use the `print()` function.
            -```
            -print("Hello world!")
            -```
            -
            -
            -
            -
            -
            -

            Écrire des Maths

            -
            -

            -Il est possible d'écrire des formules en Markdown, soit en mode inline -soit en mode displayed formulas. Dans le premier cas, les formules -sont inclues directement à l'intérieur du paragraphe courant alors -que dans le second, elles apparaissent centrées et mises en exergue. -

            - -

            -Le formatage de la formule est légèrement différent dans les deux cas -car pour qu'une formule s'affiche joliment sur une seule ligne, il -faut la "tasser" un peu plus que lorsqu'elle est mise en valeur. -

            - -

            -Pour écrire une formule en mode inline, il faut la délimiter par un $ -(du coup, pour écrire le symbole dollar, il faut le préfixer par un -backslash, comme ceci: \$) alors que pour écrire en mode displayed, il -faut la délimiter par un $$. Un petit exemple valant mieux qu'un long -discours, voici concrètement comment cela fonctionne: -

            - -
            -Cette expression $\sum_{i=1}^n X_i$ est inlinée.
            -
            - -

            -Cette expression \(\sum_{i=1}^n X_i\) est inlinée. -

            - -
            -Cette expression est mise en valeur:
            -
            -$$\sum_{i=1}^n X_i$$
            -
            -

            -Cette expression est mise en valeur: -

            - -

            -\[\sum_{i=1}^n X_i\] -

            - -

            -Nous vous présentons par la suite une sélection de symboles et de -commandes courantes. En fait, à peu près tout ce qui est classique -dans le langage LaTeX peut être utilisé pourvu que vous délimitiez -bien avec un $. Pour d'autres exemples plus complets jetez un coup -d'œil à ces exemples de James H. Steiger. -

            -
            -
            -

            Lettres grecques

            -
            - - - --- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            SymboleCommande
            \(\alpha\)$\alpha$
            \(\beta\)$\beta$
            \(\gamma\)$\gamma$
            \(\Gamma\)$\Gamma$
            \(\pi\)$\pi$
            -
            -
            -
            -

            Fonctions et opérateurs

            -
            - - - --- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            SymboleCommande
            \(\cos\)$\cos$
            \(\sin\)$\sin$
            \(\lim\)$\lim$
            \(\exp\)$\exp$
            \(\to\)$\to$
            \(\in\)$\in$
            \(\forall\)$\forall$
            \(\exists\)$\exists$
            \(\equiv\)$\equiv$
            \(\sim\)$\sim$
            \(\approx\)$\approx$
            \(\times\)$\times$
            \(\le\)$\le$
            \(\ge\)$\ge$
            -
            -
            -
            -

            Exposants et indices

            -
            - - - --- -- - - - - - - - - - - - - - - - - - - - - - - -
            SymboleCommande
            \(k_{n+1}\)$k_{n+1}$
            \(n^2\)$n^2$
            \(k_n^2\)$k_n^2$
            -
            -
            -
            -

            Fractions, coefficients binomiaux, racines, …

            -
            - - - --- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            SymboleCommande
            \(\frac{4z^3}{16}\)$\frac{4z^3}{16}$
            \(\frac{n!}{k!(n-k)!}\)$\frac{n!}{k!(n-k)!}$
            \(\binom{n}{k}\)$\binom{n}{k}$
            \(\frac{\frac{x}{1}}{x - y}\)$\frac{\frac{x}{1}}{x - y}$
            \(^3/_7\)$^3/_7$
            \(\sqrt{k}\)$\sqrt{k}$
            \(\sqrt[n]{k}\)$\sqrt[n]{k}$
            -
            -
            -
            -

            Sommes et intégrales

            -
            - - - --- -- - - - - - - - - - - - - - - - - - -
            SymboleCommande
            \(\sum_{i=1}^{10} t_i\)$\sum_{i=1}^{10} t_i$
            \(\int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x\)$\int_0^\infty \mathrm{e}^{-x}\,\mathrm{d}x$
            -
            -
            -
            -

            Déguisements

            -
            - - - --- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            SymboleCommande
            \(\hat{a}\)$\hat{a}$
            \(\bar{a}\)$\bar{a}$
            \(\dot{a}\)$\dot{a}$
            \(\ddot{a}\)$\ddot{a}$
            \(\overrightarrow{AB}\)$\overrightarrow{AB}$
            -
            -
            -
            - -
            -

            Autour de markdown

            -
            -

            -Tout d'abord, pour aller plus loin avec markdown et ses extensions / ramifications : -

            - - -

            -Comme nous l'illustrons dans la « film d'écran » (screencast), l'éditeur de texte des dépôts github et gitlab permet d'interpréter / transformer à la demande un fichier mardown en un fichier html. C'est à la fois agréable et pratique, mais ce n'est pas une solution pour une utilisation quotidienne de markdown, pour cela, il est plus efficace d'éditer son texte, avec un éditeur de texte, sur son ordinateur, avant de « l'exporter » dans un format comme html, pdf, docx, epub, etc. Il existe des éditeurs plus ou moins spécialisés pour markdown, certains sont indiqués sur la page Editors du site de pandoc, mais nous préconisons clairement l'emploi d'un éditeur de texte « généraliste » capable de reconnaître la syntaxe markdown. Nous en avons indiqué en début de séquence et on pourra trouver des informations complémentaires dans la section Quelques éditeurs adaptés à l'édition Markdown du didacticiel de Jean-Daniel Bonjour. -

            - -

            -Pour convertir un fichier markdown en un format « arbitraire », la solution à ce jour la plus complète est Pandoc, logiciel développé par John MacFarlane, un philosophe de Berkeley (le site github). En plus du site de Pandoc, le didacticiel de J.-D. Bonjour donne de nombreuses explications sur comment installer et utiliser pandoc dans la section Utilisation du convertisseur Pandoc. Comme pandoc – écrit en Haskell – peut être parfois un peu difficile à installer, nous indiquons maintenant quelques solutions alternatives : -

            -
              -
            • Des sites comme http://www.markdowntopdf.com/ et http://markdown2pdf.com/ permettent de convertir en ligne un fichier markdown en un fichier pdf.
            • -
            • Le projet CommonMark propose, en plus d'une spécifications plus rigoureuse de la syntaxe markdown, des convertisseurs markdownhtml / LaTeX (et plus) écris en C et en JavaScript (https://github.com/CommonMark/CommonMark).
            • -
            • Le site de John Gruber, le créateur de markdown, fournit un convertisseur markdownhtml écrit en perl.
            • -
            • MultiMarkdown est une autre extension de markdown qui vient avec son convertisseur markdownhtml écrit en C.
            • -
            • grip est un serveur écrit en python qui permet de convertir et visualiser à la volée des fichiers markdown avec son navigateur (très utile pour éviter d'avoir à faire des « commits » en grande quantité lorsqu'on écrit de tels fichiers pour un dépôt github ou gitlab).
            • -
            -

            -La conversion en pdf passe toujours par LaTeX ce qui nécessite d'avoir une version complète et à jour de ce logiciel sur sa machine. -

            - -

            -Dans la petite démonstration, nous montrons comment générer un fichier docx à partir d'un fichier md avec Pandoc et nous soulignons qu'il est alors possible d'utiliser un traitement de texte comme LibreOffice pour modifier le fichier obtenu. Il est clair que si des modifications sont apportées au docx elle en seront pas (automatiquement) propagées au md. Il faudra utiliser Pandoc pour cela et effectuer une conversion de docx vers md (et seules les éléments du format docx qui existent en md seront conservés). -

            - -

            -Une stratégie qui est souvent employée et qui fonctionne bien en pratique consiste à faire le gros du travail de rédaction d'un article ou d'un mémoire en Markdown. La rédaction terminée, le fichier est exporté au format docx (ou LaTeX) et des ajustements de mise en page sont alors effectués avec un logiciel de traitement de texte (ou un éditeur LaTeX). -

            -
            -
            -
            diff --git a/module2/ressources/Makefile b/module2/ressources/Makefile index 44c89dd..8969184 100644 --- a/module2/ressources/Makefile +++ b/module2/ressources/Makefile @@ -1,15 +1,5 @@ -all: gitlab.html emacs_orgmode.html jupyter.html rstudio.html maintaining_a_journal.html +all: emacs_orgmode.md jupyter.md maintaining_a_journal.md gitlab.md gitlab_fr.md rstudio.md rstudio_fr.md video_examples/README.md -NLINES=10000000 +include ../../Makefile.ressources -%.html: %.org - emacs -batch $^ --funcall org-html-export-to-html - sed -i -e 's/
            /
          • /g' \ - -e 's/
              /
                /g' $@ - mv $@ $@.bak - html_png_inliner.pl < $@.bak | grep -A $(NLINES) -e '' | grep -B $(NLINES) -e '
                ' | grep -v -e '' -e '
                ' > $@ - rm $@.bak -clean: - rm -f *~ diff --git a/module2/ressources/emacs_orgmode.html b/module2/ressources/emacs_orgmode.html deleted file mode 100644 index a35d82a..0000000 --- a/module2/ressources/emacs_orgmode.html +++ /dev/null @@ -1,604 +0,0 @@ -
                -

                Emacs/org-mode

                - -

                -Disclaimer: The two sections A simple "reproducible research" emacs -configuration and A stub of replicable article explain how to set up -emacs/org-mode for this MOOC. These are very important sections in the -context of this MOOC. These sections are illustrated in two -out of the three video tutorials of this sequence, and which you -really should follow carefully. Otherwise, you may have trouble doing -the exercises later on. Likewise, I strongly encourage you to watch -the "emacs and git" video tutorial available at the same place. -

                - -

                -The next section provides information on how to install emacs. -

                - -
                -

                Installing emacs, org-mode, ess, and auctex.

                -
                -
                -
                -

                Linux (Debian, Ubuntu)

                -
                -

                -We provide here only instructions for Debian-based distributions. Feel -free to contribute to this document to provide up-to-date information -for other distributions (e.g.n redhat, fedora). -

                - -

                -Today, the stable versions of the most common distributions provide -recent enough versions of emacs and org-mode: -

                - -

                -If your distribution is older than this, well, it may be a good time -for upgrading… -

                - -

                -Simply run (as root): -

                -
                -
                apt-get update ; apt-get install emacs25 org-mode ess r-base auctex
                -
                -
                - -

                -Then make sure you have a sufficiently recent version of emacs. -

                -
                -
                emacs --version 2>&1 | head -n 1
                -
                -
                - -
                -GNU Emacs 25.2.2
                -
                -
                - -

                -Likewise, you'll want to check you have a recent version of org-mode: -

                -
                -
                emacs -batch --funcall "org-version" 2>&1 | grep version
                -
                -
                - -
                -Org mode version 9.1.11 (9.1.11-dist @ /usr/share/emacs/25.2/site-lisp/elpa/org-9.1.11/)
                -
                -
                - -

                -The version numbers you get will depend on the distribution you are -running. You really want to make sure you do not rely on org-mode 8, -which is now deprecated. -

                -
                -
                -
                -

                macOS

                -
                -

                -Note: macOS comes with a prehistoric command-line-only version of Emacs located at /usr/bin/emacs. It's best to forget about it. -

                - -
                  -
                • -Option 1: Install the .dmg file from Vincent Goulet: -https://vigou3.gitlab.io/emacs-modified-macos/. It ships with recent -versions: -

                  -
                    -
                  • Emacs 26.1
                  • -
                  • Org-mode 9.1.13
                  • -
                  • ESS 17.11
                  • -
                  - -

                  -If you install this version of Emacs, or in fact any other version of -Emacs distributed as a clickable application in a .dmg file, -you must type the full path to the executable if you want to run -Emacs from a terminal. For example, if your clickable application -is at /Applications/Emacs.app, then the executable is at -/Applications/Emacs.app/Contents/MacOS/Emacs -

                • - -
                • -Option 2: If you use Homebrew, do the following: -

                  -
                  -
                  brew update
                  -brew install emacs --with-cocoa
                  -brew linkapps emacs
                  -brew install wget
                  -brew tap dunn/emacs
                  -brew install auctex
                  -brew tap brewsci/science
                  -brew install ess
                  -
                  -
                  -

                  -This provides an emacs command for use from the command line, plus a clickable application at Cellar/emacs/26.1_1/Emacs.app inside your Homebrew directory. If -you installed Homebrew at the default location /usr/local, then this is /usr/local/Cellar/emacs/26.1_1/Emacs.app. -If you installed Homebrew on an account with administrator privileges, you can add -

                  -
                  -
                  brew linkapps emacs
                  -
                  -
                  -

                  -in order to make Emacs accessible directly from /Applications. -

                • -
                -
                -
                -
                -

                Windows

                -
                -

                -Install the .exe file from Vincent Goulet: -https://vigou3.gitlab.io/emacs-modified-windows/. It ships with recent -versions: -

                -
                  -
                • Emacs 26.1
                • -
                • Org-mode 9.1.13
                • -
                • ESS 17.11
                • -
                -
                - -
                -

                Directory naming conventions

                -
                -

                -In the following instructions, we refer to your home -directory through the (UNIX) ~/ notation. On Windows, your home -directory should be something like C:\Users\yourname. Therefore, -whenever we mention the ~/org/ (resp. the ~/.emacs.d/) directory this -means we are referring to C:\Users\yourname\org (resp. -C:\Users\yourname\.emacs.d\). -

                -
                -
                -
                -

                Making R and Python available to the console

                -
                -

                -When running a command, Windows will look for the command in the -directories indicated in the PATH environment variable. If none of -these directories contains the command, Windows will stop and indicate -the command does not exist. To make sure R (which may be in -something like C:/Program Files/R/R-3.5.1/bin/x64/) and Python (which may be in something like C:/Program Files/Python/Python37/) can -easily be run from Emacs, you should thus configure the PATH variable -accordingly. -

                - -

                -This requires to go through the "Environment Variable" editor as -explained here. -

                -
                -
                -
                -

                Installing and configuring Matplotlib (graphic python library)

                -
                -

                -Open an DOS console and type the following command: -

                -
                -
                python -m pip install -U matplotlib
                -
                -
                - -
                -

                install_matplotlib.png

                -
                - -

                -Then you will want to deactivate interactive plots in matplotlib. To -this end, you first need to know where the matplotlib configuration is -located. Open a python console the type the following code: -

                -
                -
                import matplotlib
                -matplotlib.matplotlib_fname()
                -
                -
                - -
                -

                matplotlib.png

                -
                - -

                -Open the matplotlibrc file and add a # at the beginning of the line -starting with backend, which amounts to use the default Agg value. -

                -
                -
                -
                - -
                -

                All platforms: pretty code in HTML export

                -
                -

                -To have code pretty printing when exporting to HTML, you should -install the htmlize package, which is done by opening emacs and -typing the following command: -

                -
                -M-x package-install RET htmlize RET    # where M-x means pressing the "Esc" key then the "x" key
                -
                -
                -
                -
                - -
                -

                A simple "reproducible research" emacs configuration

                -
                -

                -This section is illustrated in a video tutorial ("Mise en place -Emacs/Orgmode" in French). Watching it before following the -instructions given in this section may help. -

                - -

                -Emacs comes with very basic default configuration and it appears like -everyone has its own taste. You will for example find here several -default Emacs configurations that reflect the preferences of their -creators. Likewise the configuration of Org-Mode is incredibly -flexible (see for example the org-mode website for more -references). In the context of this MOOC, we propose you a relatively -minimalist one that is rather "reproducible research" oriented by -adding a few org-mode specific configurations. -

                -
                - -
                -

                Step 0: Backup and download our configuration

                -
                -

                -The procedure we propose will wipe your already existing custom Emacs -configuration if you have one. You should thus beforehand make a -backup of ~/.emacs and of ~/.emacs.d/init.el (if these files exist). -

                - -

                -Then download this archive and uncompress it. It contains the -following files and we will refer to them in the following: -

                - -
                -rr_org/init.el
                -rr_org/journal.org
                -
                -
                - -

                -Alternatively, the files you are looking for are available here. -

                -
                -
                -
                -

                Step 1: Prepare your journal

                -
                -

                -Create an org/ directory in the top of your home: -

                -
                -
                mkdir -p ~/org/
                -
                -
                -

                -Then copy rr_org/journal.org file in your ~/org/ directory. This -file will be your laboratory notebook and all the notes you will -capture with C-c c will go automatically go in this file. The first -entry of this notebook is populated with many Emacs shortcuts that you -should give a try. -

                -
                -
                -
                -

                Step 2: Set up Emacs configuration

                -
                -

                -Copy rr_org/init.el in your ~/.emacs.d/ directory. -

                - -

                -Alternatively, if you do not want to mess with your already existing -emacs configuration, you may launch emacs with this specific -configuration with the following command: emacs -q -l rr_org/init.el. -

                -
                -
                -
                -

                Step 3: Adapt the configuration to your specific needs if required

                -
                -

                -There are two situations in which it might be necessary to modify -init.el: -

                -
                  -
                1. Your network environment forces you to use a proxy for access -to Web sites (HTTP(S) protocol).
                2. -
                3. -You have multiple installations of Python or R on your computer, -or they are in unusual places and not fully configured. -If you can run -

                  -
                    -
                  • "python3" and "R" under Linux and macOS
                  • -
                  • "Python" and "R" under Windows
                  • -
                  -

                  -in a terminal without getting an error message, then you should -not have to do anything. -

                4. -
                - -

                -If you do have to modify init.el, check the comments at the -beginning of the file for instructions. -

                -
                -
                -
                -

                Step 4: Check whether the installation is working or not

                -
                -

                -Open a new instance of Emacs and open a foo.org file. Copy the -following lines in this file: -

                -
                -#+begin_src shell :session foo :results output :exports both
                -ls -la # or dir under windows
                -#+end_src
                -
                -
                - -

                -Put your cursor inside this code block and execute it with the -following command: C-c C-c (If you are not familiar with Emacs -commands, this one means 'Ctrl + C' twice) -

                - -

                -A #+RESULTS: block with the result of the command should appear if it -worked. -

                - -

                -In the video, we already have demonstrated the main features and -shortcuts of emacs/org-mode that will help you maintain a document and -benefit from literate programming. The list of features and shortcuts -is demonstrated in the first entry of your labbook. -

                -
                -
                -
                -

                Step 5: Open and play with your journal:

                -
                -

                -In step 1, you were told to create an journal in -~org/journal.org. First you probably want to make sure this file is -stored in a version control system like git. We leave it up to you -to set this up but if you have any trouble, feel free to ask on the -FUN forums. -

                -
                -
                -
                -
                -

                A stub of a replicable article

                -
                -

                -This section is illustrated in a video tutorial ("Écrire un article -réplicable avec Emacs/Orgmode" in French). Watching it before -following the instructions given in this section may help. -

                - -

                -Remember, you need a working LaTeX and R environment. If you can't -open a terminal and run the commands R, pdflatex, and python, you will not be -able to generate this document. When being compiled, the article downloads the -corresponding LaTeX packages so you also need to have a working wget -command (alternatively, it uses curl). Once downloaded, you may still read the -source (article.org) and understand how it works though. -

                - -

                -Download the following archive, uncompress it and simply make to generate the -article. You should then be able to open the resulting article. This -is summarized in the following command: -

                -
                -
                wget --no-check-certificate -O replicable_article.tgz https://app-learninglab.inria.fr/gitlab/learning-lab/mooc-rr-ressources/raw/master/module2/ressources/replicable_article.tgz
                -tar zxf replicable_article.tgz; cd replicable_article; make ; evince article.pdf
                -
                -
                - -

                -Possible issues: -

                -
                  -
                • -If the make command fails (especially on Mac), it may be because -Emacs or something else is not correctly installed. In that case, -open the article directly with the following command: -

                  -
                  -
                  emacs -q --eval "(setq enable-local-eval t)" --eval "(setq enable-local-variables t)"  article.org
                  -
                  -
                  -

                  -and export it to pdf with the following shortcut: C-c C-e l o -

                • -
                • If it still doesn't work and emacs complains about not finding ESS, -it may be because you installed ESS in your home instead of -system-wide. In that case, try to remove the -q in the previous -command line to load your personal emacs configuration.
                • -
                - -

                -Finally, when you'll be tired of always re-executing all the source -code when exporting, just look for the following line in article.org: -

                -
                -# #+PROPERTY: header-args :eval never-export
                -
                -

                -If you remove the in the beginning of the line, it will not be a -comment anymore and will indicate org-mode to stop evaluating every -chunk of code when exporting. -

                -
                -
                - -
                -

                Emacs tips and tricks

                -
                -
                -
                -

                Cheat-sheets

                -
                -

                -Learning Emacs and Org-Mode can be difficult as there is an inordinate -amount of shortcuts. Many people have thus come up with -cheat-sheats. Here is a selection in case it helps: -

                -
                - - -
                -
                -

                Video tutorials

                -
                -

                -For those of you who prefer video explanations, here is a Youtube -channel with many step by step emacs tutorials. -

                -
                -
                -
                -

                Additional useful emacs packages

                -
                -
                -
                -

                Company-mode

                -
                -

                -Company-mode is a text completion framework for Emacs. It allows to -have smart completion in emacs for the most common languages. If you -feel this is needed, you should follow the instructions from the -official Web page: http://company-mode.github.io/ -

                -
                -
                -
                -

                Magit

                -
                -

                -Magit is an Emacs interface for Git. Its usage is briefly illustrated -in the context of this MOOC in a video tutorial ("Utilisation -Emacs/git" in French). -

                - -

                -It is very powerful and we use it on a daily basis but you should -definitely understand what git does behind the scenes beforehand. If -you feel this would be useful for you, you should follow this visual -walk-through or this really short "crash course". If you installed the -previous "reproducible research" emacs configuration, you can easily -invoke magit by using C-x g. -

                -
                -
                -
                - -
                -
                diff --git a/module2/ressources/gitlab.html b/module2/ressources/gitlab.html deleted file mode 100644 index 910ba2a..0000000 --- a/module2/ressources/gitlab.html +++ /dev/null @@ -1,504 +0,0 @@ -
                -

                Git and GitLab

                - -

                -This document is particularly important if you follow the RStudio or -the Org-Mode path. If you follow the Jupyter path, it can be -ignored at first as we have closely integrated Jupyter and -GitLab in the context of this MOOC. -

                - -

                -So far, you only used git via the web interface from the GitLab we -deployed for the MOOC: https://app-learninglab.inria.fr/gitlab/ -

                - -

                -If you access this link from the FUN platform, you do not have to -authenticate and you can readily read and modify all your files. This -is very convenient but in most cases, you will want to have your own -local copy of the repository and you will have to synchronize your -local copy with the remote GitLab one. To propagate your -modifications, you will obviously have to authenticate yourself on -GitLab. -

                - -

                -This document describes the software you need to have installed on -your machine and how to handle authentication. The "Configuring Git" -section is illustrated in a video tutorial (in French). -

                - -

                -Please read all these instructions carefully, in particular the one on -"Configuring your password on GitLab". -

                - -
                -

                Installing Git

                -
                -
                -
                -

                Linux (Debian, Ubuntu)

                -
                -

                -We provide here only instructions for Debian-based distributions. Feel -free to contribute to this document to provide up-to-date information -for other distributions (e.g., RedHat, Fedora). -

                - -

                -Run (as root): -

                -
                -
                apt-get update ; apt-get install git
                -
                -
                -
                -
                -
                -

                Mac OSX and Windows

                -
                - -
                -
                -
                -
                -

                Configuring Git

                -
                -
                -
                -

                Telling Git who you are: Name and Email

                -
                -
                  -
                1. Open terminal.
                2. -
                3. -Set a Git username and email: -

                  -
                  -
                  git config --global user.name "Mona Lisa"
                  -git config --global user.email "email@example.com"
                  -
                  -
                4. - -
                5. -Confirm that you have set the Git username correctly: -

                  -
                  -
                  git config --global user.name
                  -git config --global user.email
                  -
                  -
                  - -
                  -Mona Lisa
                  -email@example.com
                  -
                  -
                6. -
                -
                -
                -
                -

                Dealing with proxies

                -
                -

                -You may be behind a proxy, in which case you may have trouble cloning -or fetching from a remote repository or you may get an error like -unable to access ... Couldn't resolve host ... -

                - -

                -In such case, consider something like this: -

                -
                -
                git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
                -
                -
                - -

                -The proxyPassword will be stored in plain text (unencrypted) in your .gitconfig file, -which you may not want. In that case, remove it from the URL and you -will be prompted for it every time it is needed. -

                -
                -
                -
                -

                Getting your default password on GitLab (and possibly changing it)

                -
                -

                -Warning (Jupyter users) : changing your default Gitlab password will -prevent you from committing in Jupyter. You will have to do the extra -step of changing your ~/.git-credentials in the Jupyter environment -(possibly several times). -

                - -
                  -
                1. -Get your default password using the Gitlab credentials retrieval -tool as described on the corresponding resource. -

                  -
                  - -
                  -

                  password_retrieval.png

                  -
                  -
                  -

                  -The first long and ugly character sequence is your GitLab -login/id. It is easy to find once you are logged on gitlab. The -second one however is your password and this webpage is the only -place where you can find it. We used the FUN authentification -mechanism to propagate your credentials so only you can have access -to it. You'll need to use this password when trying to propagate -some modifications from your computer to GitLab. -

                  - -

                  -Note: You have to access this webpage from the FUN platform -otherwise you may get a 405 error when trying to direcly open -https://app-learninglab.inria.fr/jupyterhub/services/password. -

                  -
                  - -
                  -

                  erreur405.png

                  -
                  -
                2. -
                3. -Access GitLab. -

                  - -

                  -Note: Again, you have to access Gitlab from the FUN platform -otherwise you may get a 405 error when trying to direcly open -https://app-learninglab.inria.fr/gitlab/users/sign_in. -

                4. -
                5. -Click on the first Sign in button (alternatively, you can the -login/password you just retrieved and use the second Sign in -button). -

                  -
                  - -
                  -

                  signin.png

                  -
                  -
                6. -
                7. -If you wish to modify your password, you should go to Account > Settings > Password -and define your password using the default -password you just retrieved. Again, if you use the Jupyter -notebooks we have deployed for the MOOC, remember that changing -your default Gitlab password will prevent you from committing in -Jupyter. You will have to do the extra step of changing your -Jupyter ~/.git-credentials through a Jupyter console (see next -section). -

                  -
                  - -
                  -

                  password.png

                  -
                  -
                8. -
                -
                -
                -
                -

                Remembering your password locally

                -
                -

                -If you clone your repository by simply pasting the GitLab URL, you will be -prompted for your login and your password every time you want to -propagate your local modifications, which is tedious. This is why you -should ask git to remember your login and password as follows -

                -
                -
                git config --global credential.helper cache                  # remember my password
                -git config --global credential.helper "cache --timeout=3600" # for one hour at most
                -
                -
                -

                -With this setup, you will be prompted for your password but it will be -cached in memory and they will not be asked again before an hour. You -may want to read these instructions to better understand how all this -works. -

                - -

                -If you want your password to be permanently remembered, you should use -this command -

                -
                -
                git config credential.helper store
                -
                -
                -

                -Your password will be then stored in a .git-credentials file in plain -text. On a perfectly secured machine, it may be fine… or not… ;) -Use it at your own risk. -

                -
                -
                -
                -

                Optional: authenticating through SSH

                -
                -

                -There are two ways of authenticating and synchronizing your local -repository with GitLab: through HTTPS or through SSH. The first one is -what was just described and does not require any particular software -installation on your machine so this is what I recommend for this -MOOC. Yet, I like the second one better (although is may seem a bit -more technical), which is why I describe it here. It consists in -installing SSH, creating a pair or private/public keys, and uploading -your SSH public key on GitLab. This section provides with information -on how to do this. -

                -
                -
                -

                Installing SSH

                -
                -
                -
                  -
                • Linux (Debian, Ubuntu)
                  -
                  -

                  -We provide here only instructions for debian-based distributions. Feel -free to contribute to this document to provide up-to-date information -for other distributions (e.g., RedHat, Fedora). -

                  - -

                  -Run (as root): -

                  -
                  -
                  apt-get update ; apt-get install openssh-client
                  -
                  -
                  -
                  -
                • -
                • macOS
                  -
                  -

                  -You do not have anything to do as it is installed by default. -

                  -
                  -
                • -
                • Windows
                  -
                  -

                  -You should install the Putty client. Once it is installed, look for -the section on generating an SSH key. -

                  -
                  -
                • -
                -
                -
                -

                Setting up SSH on GitLab

                -
                -

                -Here are all the official explanations on how to set up your SSH key -on GitLab. Alternatively, you may also want to have a look at this -video: -

                - -
                -
                -
                -
                -
                -

                Using Git through the command line to synchronize your local files with Gitlab

                -
                -

                -This section describes a generic (through the command line) way to -synchronize your local files with Gitlab. You will not need this if -you follow the Jupyter path. If you follow the RStudio path, all -these operations can be done through RStudio and you may want to read -the corresponding instructions. If you follow the Org-Mode path, all -these operations can be done through Magit and you may want to read -the corresponding instructions. -

                - -

                -Here are other ways to learn Git through the command line: -

                - - -

                -Now, let's start! -

                -
                  -
                1. Obtain the repository URL -adresse_depot.png
                2. -Cloning the repository -

                  -
                  -
                  cd /the/directory/where/you/want/to/clone/your/repository
                  -git clone https://app-learninglab.inria.fr/gitlab/xxx/mooc-rr.git
                  -
                  -
                  -

                  -Alternatively, you may want to indicate now your login although I -rather suggest you follow the Remembering your password locally -instructions: -

                  -
                  -
                  git clone https://xxx@app-learninglab.inria.fr/gitlab/xxx/mooc-rr.git
                  -
                  -
                  -

                  -Now a directory mooc-rr has been created on your computer. -

                3. -
                4. -Inspect the repository -

                  -
                  -
                  cd mooc-rr
                  -ls # (Unix)
                  -dir # (Windows)
                  -
                  -
                5. -
                6. -Synchronizing to GitLab -

                  - -

                  -You should indicate which files to track (git add) and commit them -locally (git commit) before they can be transfered (git push) to -GitLab. The git status will indicate you whether files are -tracked/modified/committed/… -

                  - -

                  -Let's assume you just created a `fichier.txt` file on the top of -the mooc-rr directory. -

                  - -
                  -
                  git status
                  -
                  -
                  - - -
                  -

                  status1.png

                  -
                  - -
                  -
                  git add fichier.txt
                  -git status
                  -
                  -
                  - - -
                  -

                  status2.png

                  -
                  - -
                  -
                  git commit -m "message commit"
                  -
                  -
                  - - -
                  -

                  commit_git.png

                  -
                  - -
                  -
                  git status
                  -
                  -
                  - - -
                  -

                  status3.png

                  -
                  - -

                  -The file can then be transfered to GitLab: -

                  -
                  -
                  git push
                  -
                  -
                  - -

                  -At this point, git will as you about your login/password unless -you followed the previous Remembering your password locally instructions. -

                  - -

                  -N.B.: you will not be allowed to propagate your modifications to -GitLab if other modifications (e.g., from someone else) have been -propagated in between -

                  - - -
                  -

                  rejected.png

                  -
                7. -
                8. -Synchronizing from Gitlab: to avoid the previous problem, you need -to fetch the remote GitLab modifications first and apply them -locally. -

                  -
                  -
                  git pull
                  -
                  -
                  -

                  -Only then will you be able to git push. -

                9. -
                -
                -
                -
                diff --git a/module2/ressources/jupyter.html b/module2/ressources/jupyter.html deleted file mode 100644 index 22def4f..0000000 --- a/module2/ressources/jupyter.html +++ /dev/null @@ -1,421 +0,0 @@ -
                -

                Jupyter

                - - -
                -

                1. Jupyter tips and tricks

                -
                -

                -The following webpage lists several Jupyter tricks (in particular, it -illustrates many IPython magic commands) that should improve your -efficiency (note that this blog post is about two years old so some of -the tricks may have been integrated in the default behavior of Jupyter -now). -

                -
                -
                -

                Creating or importing a notebook

                -
                -

                -Using the Jupyter environment we deployed for this MOOC will allow to -easily access any file from your default GitLab project. There are -situations however where you may want to play with other notebooks. -

                -
                -
                Adding a brand new notebook in a given directory
                Simply follow -the following steps: -
                  -
                1. From the menu: File -> Open. You're now in the Jupyter file manager.
                2. -
                3. Navigate to the directory where you want your notebook to be created.
                4. -
                5. Then from the top right button: New -> Notebook: Python 3.
                6. -
                7. -Give your notebook a name from the menu: File -> Rename. -

                  - -

                  -N.B.: If you create a file by doing File -> New Notebook -> - Python 3, the new notebook will be created in the current -directory. Moving it afterward is possible but a bit cumbersome -(you'll have to go through the Jupyter file manager by following -the menu File -> Open, then select it, Shut it down, and Move -and/or Rename). -

                8. -
                -
                Importing an already existing notebook
                If your notebook is -already in your GitLab project, then simply synchronize by using -the Git pull button and use the File -> Open menu. Otherwise, -imagine, you want to import the following notebook from someone -else's repository to re-execute it. -
                  -
                1. Download the file on your computer. E.g., for this GitLab hosted -notebook, click on Open raw (a small </> within a document icon) -and save (Ctrl-S on most browsers) the content (a long Json text -file).
                2. -
                3. Open the Jupyter file manager from the menu File -> Open and -navigate to the directory where you want to upload your notebook.
                4. -
                5. Then from the top right button, Upload the previously downloaded -notebook and confirm the upload.
                6. -
                7. Open the freshly uploaded notebook through the Jupyter file -manager.
                8. -
                -
                -
                -
                -
                -

                Running R and Python in the same notebook

                -
                -

                -rpy2 package allows to use both languages in the same notebook by: -

                -
                  -
                1. -Loading rpy2: -

                  -
                  -
                  %load_ext rpy2.ipython
                  -
                  -
                2. -
                3. -Using the %R Ipython magic: -

                  -
                  -
                  %%R 
                  -summary(cars)
                  -
                  -
                  -

                  -Python objects can then even be passed to R as follows (assuming df -is a pandas dataframe): -

                  -
                  -
                  %%R -i df
                  -plot(df)
                  -
                  -
                4. -
                -

                -Note that this %%R notation indicates that R should be used for the whole cell but -an other possibility is to use %R to have a single line of R within a -python cell. -

                -
                -
                -
                -

                Other languages

                -
                -

                -Jupyter is not limited to Pytyhon and R. Many other languages are available: -https://github.com/jupyter/jupyter/wiki/Jupyter-kernels, including -non-free languages like SAS, Mathematica, Matlab… Note that the maturity of these kernels differs widely. -

                - -

                -None of these other languages have been deployed in the context of our -MOOC but you may want to read the next sections to learn how -to set up your own Jupyter on your computer and benefit from these extensions. -

                - -

                -Since the question was asked several times, if you really need to stay -with SAS, you should know that SAS can be used within Jupyter using -either the Python SASKernel or the Python SASPy package (step by step -explanations about this are given here). -

                - -

                -Since proprietary software such as SAS cannot easily be inspected, we discourage its use as it hinders reproducibility by -essence. But perfection does not exist anyway and using Jupyter -literate programming approach allied with systematic control version -and environment control will certainly help anyway. -

                -
                -
                -
                - -
                -

                2. Installing and configuring Jupyter on your computer

                -
                -

                -In this section, we explain how to set up a Jupyter environment on -your own computer similar to the one deployed for this MOOC. -

                - -

                -Note that Jupyter notebooks are only a small part of the picture and -that Jupyter is now part of a bigger project: JupyterLab, which allows -you to mix various components (including notebooks) in your -browser. In the context of this MOOC, our time frame was too short to -benefit from JupyterLab which was still under active development. You may, however, prefer JupyterLab when doing an installation on your own computer. -

                -
                - -
                -

                2.1 Installing Jupyter

                -
                -

                -Follow these instructions if you wish to have a Jupyter environment on -your own computer similar to the one we set up for this MOOC. -

                - -

                -First, download and install the latest version of Miniconda. We use -Miniconda version 4.5.4 and Python version 3.6 on our server. -

                - -

                -Miniconda is a light version of Anaconda, which includes Python, the Jupyter Notebook, and other commonly used packages for scientific computing and data science. -

                - -

                -Then download the moocrr environment file and create the environment using conda: -

                -
                -
                conda env create -f environment.yml
                -
                -# Windows activate the environment
                -activate mooc_rr
                -
                -# Linux and MacOS activate the environment
                -source activate mooc_rr
                -
                -# Linux, MacOS and Windows: launch the notebook
                -jupyter notebook
                -
                -
                -
                -
                -
                -

                2.2 Making sure Jupyter allows you to use R

                -
                -

                -The environment described in the last section should include R, but if -you proceeded otherwise and only have Python available in Jupyter, you -may want to read the following section. -

                -
                -
                -

                • Installing IRKernel (R package)

                -
                -

                -Do the following in R console: -

                - -

                -Install the devtools package: -

                - -
                -
                install.packages('devtools',dep=TRUE)
                -
                -
                - -

                -Define a proxy if needed: -

                - -
                -
                library(httr)
                -set_config(use_proxy(url="proxy", port=80, username="username", password="password")) 
                -
                -
                - -

                -Install the IRkernel package: -

                - -
                -
                devtools::install_github('IRkernel/IRkernel')
                -IRkernel::installspec()  # to register the kernel in the current R installation
                -
                -
                -
                -
                - -
                -

                • Installing rpy2 (Python package)

                -
                -

                -On Linux, the rpy2 package is available in standard distributions -

                -
                -
                sudo apt-get install python3-rpy2 python3-tzlocal
                -
                -
                -

                -An alternative (not really recommended if the first one is available) -consists in going through the python package manager with -

                -
                -
                pip3 install rpy2
                -
                -
                - -

                -Windows -

                - -

                -Download the rpy2 binary file by choosing the right operating system. -

                - -

                -Open a DOS console and type the following command: -

                -
                -
                python -m pip install rpy2‑2.9.4‑cp37‑cp37m‑win_amd64.whl # adapt filename
                -
                -
                - -

                -Install also tzlocal: -

                -
                -
                python -m pip install tzlocal
                -
                -
                -
                -
                -
                -
                -

                2.3 Additional tips

                -
                -
                -
                -

                • Exporting a notebook

                -
                -

                -Here is what we had to install on a recent Debian computer to make sure -the notebook export via LaTeX works: -

                -
                -
                sudo apt-get install texlive-xetex wkhtmltopdf
                -
                -
                - -

                -Obviously, you can convert to html or pdf using the using the File > Download as > HTML (or PDF) menu option. This can also be done from -the command line with the following command: -

                - -
                -
                ipython3 nbconvert --to pdf Untitled.ipynb
                -
                -
                - -

                -If you want to use a specific style, then the nbconvert exporter -should be customized. This is discussed and demoed here. We encourage -you to simply read the doc of nbconvert. -

                - -

                -Instead of going directly through LaTeX and playing too much with the -nbconvert exporter, an other option consists in exporting to Markdown -and playing with pandoc. Both approaches work, it's rather a matter of -taste. -

                - -

                -Windows -

                - -

                -Download and install MiKTeX from the MiKTeX webpage by choosing the -right operating system. You will be prompted to install some specific -packages when exporting to pdf. -

                -
                -
                - -
                -

                • Improving notebook readability

                -
                -

                -Here are a few extensions that can ease your life: -

                -
                  -
                • -Code folding to improve readability when browsing the notebook. -

                  -
                  -
                  pip3 install jupyter_contrib_nbextensions
                  -# jupyter contrib nbextension install --user # not done yet
                  -
                  -
                • -
                • -Hiding code to improve readability when exporting. -

                  -
                  -
                  sudo pip3 install hide_code
                  -sudo jupyter-nbextension  install --py hide_code
                  -jupyter-nbextension  enable --py hide_code
                  -jupyter-serverextension enable --py hide_code
                  -
                  -
                • -
                -
                -
                - -
                -

                • Interacting with GitLab and GitHub

                -
                -

                -To ease your experience, we added pull/push buttons that allow -you to commit and sync with GitLab. This development was specific to -the MOOC but inspired from a previous proof of concept. We have -recently discovered that someone else developed about at the same time -a rather generic version of this Jupyter plugin. Otherwise, remember -that it is very easy to insert a shell cell in Jupyter in which you -can easily issue git commands. This is how we work most of the time. -

                - -

                -This being said, you may have noticed that Jupyter keeps a perfect -track of the sequence in which cells have been run by updating the -"output index". This is a very good property from the reproducibility -point of view but depending on your usage, you may find it a bit -painful when committing. Some people have thus developed specific git -hooks to ignore these numbers when committing Jupyter notebooks. There -is a long an interesting discussion about various options on -StackOverflow. -

                - -

                -For those who use JupyterLab rather than the plain Jupyter, a specific JupyterLab git plugin has been developed to offer a nice version control experience. -

                -
                -
                -
                -
                -
                diff --git a/module2/ressources/maintaining_a_journal.html b/module2/ressources/maintaining_a_journal.html deleted file mode 100644 index e2726ab..0000000 --- a/module2/ressources/maintaining_a_journal.html +++ /dev/null @@ -1,281 +0,0 @@ -
                -

                Maintaining a journal

                - - -
                -

                Some examples of LabBooks provided for inspiration

                -
                -

                -Since a few years, we systematically require any or our students to -have a laboratory notebook in org-mode. Most of the time, they start -in private repositories but often end up being fully opened. Here are -a few ones: -

                - - - -

                -Org-mode is obviously not the only option and many of our students use -am mixture of org-mode, rstudio and jupyter depending on what is more -convenient. -

                -
                -
                - -
                -

                How to report efficiently (by Martin Quinson)

                -
                -

                -My friend Martin has gathered an excellent compendium of information -and references on his webpage to explain his students what he expects -from them. I'll therefore simply paraphrase him here with the most -important aspects related to reporting but feel free to read the -original version: -

                -
                -
                -

                Reporting

                -
                -

                -I ask you to write a little reporting regularly. Depending on the -situation, it may be every day, every week or every month. In any -case, your reporting is very important for the following reasons: -

                - -
                  -
                • It forces you to think about what you are doing, which may help you -to unblock your problem by your own. Writing down the problems in a -clear way is often sufficient to see the solution appearing.
                • -
                • It helps me following your progress even between the meetings. I -cannot unblock you if I don't detect that you are on a wrong lead or -otherwise blocked.
                • -
                • It keeps a track of the steps in your work. That's good for the day -where you want to write your final report (even if a final report -should never be presented in the chronological order). That's good -for the next after you who will be supposed to continue you effort, -or to build upon it.
                • -
                • That person may be yourself (if you go for a PhD program), another -intern, myself or even someone else on the Internet: that's what we -call Open Science, an effort where everyone can build upon the -scientific work of everyone.
                • -
                - -

                -I want you to write your reporting in an org file (yep, you don't have -a choice here). [..] -

                -
                -
                -
                -

                Reporting Logistics

                -
                -

                -Once you're setup with all software installed and somehow configured, -you need to create a reporting file in a place where I can see it and -where it won't get lost if your disk crashes or something. Open a -dedicated git repository (on github, gitorious, gitlab, …) for -that. After your internship, your report should be archived directly -in the source tree of the software that you are working on, if -any. But having your reporting located in the source tree may -complicate things during your work. -

                - -

                -Yes, it means that your file will be public at some point, but that's -why we call it "Open Science", after all. Also, you should write it in -English if possible. The part of your reporting that is called -"Journal" (see below) may be written in French if you are more -efficient this way but the rest must be in English. Don't make your -tone too formal because the file is public. Make it efficient. Nobody -will ever blame you for the work you did during an internship a long -time ago. If you really want, we can even make this file -anonymous. Just speak to me. -

                - -

                -You want to write your reporting before leaving work. Weekly reporting -should be written on Friday, one or two hours before leaving. That's -the best solution to have a nice week end without thinking about work, -and still lose no information that you would need on Monday morning. -

                -
                -
                -
                -

                Reporting Document Organization

                -
                -

                -Your reporting document should have four main parts: -

                - -
                -
                Findings
                This section summarizes the general information that you -gathered during your work. It is empty at the beginning -of your internship, and gets fleshed with the important -things that you find on your way. That's where -bibliographical information go, for example. But that's -definitely not where TODO notes go (see below).
                -
                Development
                This section presents the technical sides of your -work. Don't write anything in there yet. Put it all -in the Journal part for now.
                -
                Journal
                Describe the day-to-day work done for each period (day, -week or month) of your internship. That's the most -important part of your reporting, and we come back to it -below.
                -
                Conclusion

                -That's what you write in the next week of your -internship. You can see it as a letter to the next -guy, explaining the current state of your work, a few -words about its technical organization, and what -should be done next on that topic. Keep this part -highly technical, the overall organization of your -internship will be seen in your final report. -

                - -

                -The Journal part is the only part that you may write -in French on need. You want to add one subsection per -period to your journal. Don't make it too long, or you -would waste time writing long texts that very few will -ever read. Don't make it too short or it will be -impossible to understand it on Monday morning (or -three months after). Finding the good balance is -sometimes difficult, but I will provide feedback on -your first entries, so don't worry. -

                -
                - -

                -Each of section describing a period should contain three subsubsections: -

                -
                -
                Things done
                a few words about what you've done. Something like 2 -or 4 items with a few words describing what you've -done. You can omit the title of that section and put -the items directly in the upper section (see the -example below).
                -
                Blocking points and questions
                try to explain clearly the things -that block you or slow you down. If you found the solution -already, then it should be part of the previous subsection (but -you should say a few words nevertheless). Also ask every question -that you may have for me in that section. If the question are -personal (e.g., about the logistics of your internship such as -salary or so), please prefer emails that are not publicly -visible. If this section is empty for a given period, skip it -all together (no empty subsubsections).
                -
                Planned work
                A few items about what you plan to work on during -the next period.
                -
                - -

                -A template of reporting file is given at the end of this section. This -is just a strong advice: If you really feel better with another file -organization, then give it a try for one period, and ask for my -feedback. I can adapt, and I do not pretend that my advice is the -definitive answer. It's just the result of my experience so far. -

                - -

                -Notice how TODO items are written: they are given as items in the -Planned work sections of the journal. As explained in the -documentation, you simply have to write "[ ]" in front of items that -you plan to do in the future. -

                - -

                -You should add a [1/] on the "Planned work" line, so that emacs keeps -track of what is done and what is still to do. Once they are done, you -type C-c C-C on their lines to change the blank box [ ] into a checked -box [X]. Also, the [1/] will be changed to denote the amount of work -that is still to be done. -

                - -

                -At any point, you can see all ongoing TODO items with the following -keystrokes: "C-c / t". More information on TODOs in orgmode's -documentation. The important thing here is that most TODO items must -only be written in the Journal part (so that we know when they -occurred). -

                - -

                -Do not edit past entries of your journal, unless you have very good -reasons. If you must, make sure that you don't lose information about -the path that you took (remember the Open Science thingy). You should -always add information to past entries, such as: -

                - -
                -
                - *edit* This hypothesis does not hold; see the entry of [the day where you found it] for more information.
                -
                -
                - -

                -The only exception are TODO entries, that should clearly be rewritten -to DONE entries. If you need to adapt your TODO entry (because the -initial goal was poorly stated or otherwise), change the initial entry -from TODO to CANCELED (or check the box after stating in a subitem -that it was not done but canceled, and why), and create a new TODO -entry in the current period section. -

                -
                -* Introduction
                -This file contains the reporting for my beloved internship done on
                -this topic on that year. For now, just add the official title of
                -your internship (check the convention signed between your
                -university and my lab). After a few weeks, once you really
                -understand your internship, you should write a few paragraphs about
                -the context, problem and motivation of your work, with some
                -possible use cases. But don't do that right now.
                -* Bibliography
                -* Journal
                -** Week 2 feb
                -- read the doc about writing my reporting
                -*** Questions
                -- do I really have to use emacs?
                -*** Work Planed [1/2]
                -- [X] install emacs and setup orgmode
                -- [ ] read the provided articles
                -** Week 9 feb
                -- Installed emacs    
                -(omit the Questions section if no question)
                -*** Work Planed
                -- do some useful work
                -
                -
                -
                -
                -
                diff --git a/module2/ressources/rstudio.html b/module2/ressources/rstudio.html deleted file mode 100644 index 94066eb..0000000 --- a/module2/ressources/rstudio.html +++ /dev/null @@ -1,303 +0,0 @@ -
                -

                Rstudio

                - - -
                -

                Installing RStudio

                -
                -
                -
                -

                Linux (debian, ubuntu)

                -
                -

                -We provide here only instructions for Debian-based distributions. Feel -free to contribute to this document to provide up-to-date information -for other distributions (e.g., RedHat, Fedora). -

                - -

                -Today, the stable versions of the most common distributions provide -recent enough versions of R: -

                - -

                -If your distribution is older than this, well, it may be a good time -for upgrading… -

                -
                - -
                -

                Installing R

                -
                -

                -First, you need to install the R language and convenient packages -by running (as root): -

                -
                -
                apt-get update ; sudo apt-get install r-base r-cran-knitr r-cran-ggplot2 
                -
                -
                - -

                -Alternatively, if the installation of r-cran-gplot2 or r-cran-knitr -fails, you may want to install them locally (through the R packaging -system) and manually by running the following commands in R (or -RStudio): -

                -
                -
                install.packages("knitr")
                -install.packages("ggplot2")
                -
                -
                - -

                -If you plan to export pdf documents with LaTeX, you probably also want -to run (as root): -

                -
                -
                apt-get update ; apt-get install texlive-base
                -
                -
                -
                -
                - -
                -

                Installing RStudio

                -
                -

                -RStudio is unfortunately not packaged within Debian so the easiest is -to download the corresponding Debian package on the RStudio webpage -and then to install it manually (you may have to adjust the version number in the following example). Here is how to install it: -

                - -
                -
                cd /tmp/
                -wget https://download1.rstudio.org/rstudio-xenial-1.1.453-amd64.deb
                -sudo dpkg -i rstudio-xenial-1.1.453-amd64.deb
                -sudo apt-get update ; sudo apt-get -f install # to fix possibly missing dependencies
                -
                -
                -
                -
                -
                -
                -

                Mac OSX and Windows

                -
                -
                -

                -Some instructions on installing R and knitr must be missing. This -should be tested and improved. -

                -
                -
                  -
                • Download and install R from the CRAN webpage by choosing the right operating system.
                • -
                • Download and install RStudio from the RStudio webpage by choosing the right operating system.
                • -
                • Download and install MiKTeX from the MiKTeX webpage by choosing the right operating system. You will be prompted to install some specific packages when exporting to pdf.
                • -
                • Open RStudio and type the following commands in the console to install knitr and ggplot2:
                • -
                -
                -
                install.packages("knitr", dep=TRUE)
                -install.packages("ggplot2", dep=TRUE)
                -
                -
                -
                -
                -
                -
                -

                RStudio documentation

                -
                -

                -The RStudio team has created a lot of very good material and -tutorials. You should definitively look at the Cheat sheets -webpage. In particular you may want to have look at the following -ones: -

                - -

                -In case it helps, here are some (sometimes outdated) French versions -of these documents: -

                - -
                -
                - -
                -

                Using Git from RStudio

                -
                -

                -If you have never used git with RStudio, we strongly advise that you -follow our tutorial on using git from RStudio ("RStudio et Gitlab" -in French). Before proceeding, make sure you also have followed the -"git/GitLab configuration" tutorial (in French). -

                - -

                -Alternatively, you may want to watch this video (in English). If you -do not like videos, you should have a look at the step-by-step -explanations from Software Carpentry. It comes with many screenshots -and is quite progressive. -

                -
                - -
                -

                Cloning a repository

                -
                -

                -Open RStudio and do the following steps: -

                -
                  -
                • -Create a new version controled project: File / New Project / Version Control -

                  -
                  - -
                  -

                  new_project.png

                  -
                  - - -
                  -

                  git.png

                  -
                  -
                • -
                • -Get the URL from your GitLab repository: -

                  -
                  - -
                  -

                  adresse_depot.png

                  -
                  -
                • -
                • -Indicate this URL in the "Repository URL" field (you may want to -prefix this URL with xxx@ where xxx is your Gitlab id to avoid -repeatedly giving it later on). -

                  -
                  - -
                  -

                  clone.png

                  -
                  -
                • -
                • If you're behind a proxy, git should be configured -accordingly. Check the "Dealing with proxies" section.
                • -
                • Git will then connect to Gitlab and fetch a whole copy of the -repository.
                • -
                • -RStudio should restart in a mode related to Git: -

                  -
                  - -
                  -

                  rstudio.png

                  -
                  -
                • -
                • The file manager on the right, allows you to browse the version -controled repository.
                • -
                -
                -
                -
                -

                Modifying a file

                -
                -
                  -
                • Open Module2/exo1/toy_document.Rmd and perform a simple -modification.
                • -
                • Save
                • -
                • -Go to the Git menu to commit -

                  -
                  - -
                  -

                  commit.png

                  -
                  - - -
                  -

                  commit2.png

                  -
                  -
                • -
                • -Select the lines to commit and then click on commit -

                  -
                  - -
                  -

                  commit5.png

                  -
                  -
                  -

                  -Your modifications have now been commited on your local -machine. They haven't been propagated to GitLab yet. -

                • -
                • -Click on push to propagate them on GitLab -

                  -
                  - -
                  -

                  push.png

                  -
                  - - -
                  -

                  push2.png

                  -
                  - - -
                  -

                  push3.png

                  -
                  -
                  -

                  -NB: You won't be able to propagate your modifications on GitLab if -some modifications have been done on GitLab in the meantime. -push4.png

                • -
                • You should first merge these remote modifications locally. Click on -pull to get these modifications on your machine.
                • -
                -
                -
                -
                -
                diff --git a/module3/ressources/Makefile b/module3/ressources/Makefile new file mode 100644 index 0000000..07fecf7 --- /dev/null +++ b/module3/ressources/Makefile @@ -0,0 +1,3 @@ +all: + +include ../../Makefile.ressources diff --git a/module4/ressources/Makefile b/module4/ressources/Makefile index 4727054..ec0abfd 100644 --- a/module4/ressources/Makefile +++ b/module4/ressources/Makefile @@ -1,15 +1,4 @@ -all: resources_refs.html resources_environment.html exo1.html exo2.html exo3.html +all: resources_refs.md resources_environment.md resources_refs_fr.md resources_environment_fr.md # exo1.html exo2.html exo3.html -NLINES=10000000 +include ../../Makefile.ressources -%.html: %.org - emacs -batch $^ --funcall org-html-export-to-html - sed -i -e 's/
                /
              • /g' \ - -e 's/
                  /
                    /g' $@ - mv $@ $@.bak - html_png_inliner.pl < $@.bak | grep -A $(NLINES) -e '' | grep -B $(NLINES) -e '
                    ' | grep -v -e '' -e '
                    ' > $@ - rm $@.bak - -clean: - rm -f *~ diff --git a/module4/ressources/html_png_inliner.pl b/module4/ressources/html_png_inliner.pl deleted file mode 100755 index 2dcbe1f..0000000 --- a/module4/ressources/html_png_inliner.pl +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/perl -w -use strict; - -my($line); -while(defined($line=)) { - if($line =~ /^(.*) -

                    Tracking environment information

                    - - -
                    -

                    Getting information about your Git repository

                    -
                    -

                    -When taking notes, it may be difficult to remember which version of -the code or of a file was used. This is what version control is useful -for. Here are a few useful commands that we typically insert at the -top of our notebooks in shell cells -

                    - -
                    -
                    git log -1
                    -
                    -
                    - -
                    -commit 741b0088af5b40588493c23c46d6bab5d0adeb33
                    -Author: Arnaud Legrand <arnaud.legrand@imag.fr>
                    -Date:   Tue Sep 4 12:45:43 2018 +0200
                    -
                    -    Fix a few typos and provide information on jupyter-git plugins.
                    -
                    -
                    - -
                    -
                    git status -u
                    -
                    -
                    - -
                    -On branch master
                    -Your branch is ahead of 'origin/master' by 4 commits.
                    -  (use "git push" to publish your local commits)
                    -
                    -Changes not staged for commit:
                    -  (use "git add <file>..." to update what will be committed)
                    -  (use "git checkout -- <file>..." to discard changes in working directory)
                    -
                    -	modified:   resources.org
                    -
                    -Untracked files:
                    -  (use "git add <file>..." to include in what will be committed)
                    -
                    -	../../module2/ressources/replicable_article/IEEEtran.bst
                    -	../../module2/ressources/replicable_article/IEEEtran.cls
                    -	../../module2/ressources/replicable_article/article.bbl
                    -	../../module2/ressources/replicable_article/article.tex
                    -	../../module2/ressources/replicable_article/data.csv
                    -	../../module2/ressources/replicable_article/figure.pdf
                    -	../../module2/ressources/replicable_article/logo.png
                    -	.#resources.org
                    -
                    -no changes added to commit (use "git add" and/or "git commit -a")
                    -
                    - -

                    -Note: the -u indicates that git should also display the contents of -new directories it did not previously know about. -

                    - -

                    -Then, we often include commands at the end of our notebook indicating -how to commit the results (adding the new files, committing with a -clear message and pushing). E.g., -

                    - -
                    -
                    git add resources.org;
                    -git commit -m "Completing the section on getting Git information"
                    -git push
                    -
                    -
                    - -
                    -[master 514fe2c1 ] Completing the section on getting Git information
                    - 1 file changed, 61 insertions(+)
                    -Counting objects: 25, done.
                    -Delta compression using up to 4 threads.
                    -Compressing objects: 100% (20/20), done.
                    -Writing objects: 100% (25/25), 7.31 KiB | 499.00 KiB/s, done.
                    -Total 25 (delta 11), reused 0 (delta 0)
                    -To ssh://app-learninglab.inria.fr:9418/learning-lab/mooc-rr-ressources.git
                    -   6359f8c..1f8a567  master -> master
                    -
                    - -

                    -Obviously, in this case you need to save the notebook before running -this cell, hence the output of this final command (with the new git -hash) will not be stored in the cell. This is not really a problem and -is the price to pay for running git from within the notebook itself. -

                    -
                    -
                    -
                    -

                    Getting information about Python(3) libraries

                    -
                    -
                    -
                    -

                    Getting information about your system

                    -
                    -

                    -This topic is discussed on StackOverflow. -

                    -
                    -
                    import platform
                    -print(platform.uname())
                    -
                    -
                    - -
                    -uname_result(system='Linux', node='icarus', release='4.15.0-2-amd64', version='#1 SMP Debian 4.15.11-1 (2018-03-20)', machine='x86_64', processor='')
                    -
                    -
                    -
                    -
                    - -
                    -

                    Getting the list of installed packages and their version

                    -
                    -

                    -This topic is discussed on StackOverflow. When using pip (the Python -package installer) within a shell command, it is easy to query the -version of all installed packages (note that on your system, you may -have to use either pip or pip3 depending on how it is named and which -versions of Python are available on your machine -

                    - -

                    -Here is for example how I get this information on my machine: -

                    -
                    -
                    pip3 freeze
                    -
                    -
                    - -
                    -asn1crypto==0.24.0
                    -attrs==17.4.0
                    -bcrypt==3.1.4
                    -beautifulsoup4==4.6.0
                    -bleach==2.1.3
                    -...
                    -pandas==0.22.0
                    -pandocfilters==1.4.2
                    -paramiko==2.4.0
                    -patsy==0.5.0
                    -pexpect==4.2.1
                    -...
                    -traitlets==4.3.2
                    -tzlocal==1.5.1
                    -urllib3==1.22
                    -wcwidth==0.1.7
                    -webencodings==0.5
                    -
                    - -

                    -In a Jupyter notebook, this can easily be done by using the %%sh -magic. Here is for example what you could do and get on the Jupyter -notebooks we deployed for the MOOC (note that here, you should simply -use the pip command): -

                    -
                    -
                    %%sh
                    -pip freeze
                    -
                    -
                    - -
                    -alembic==0.9.9
                    -asn1crypto==0.24.0
                    -attrs==18.1.0
                    -Automat==0.0.0
                    -...
                    -numpy==1.13.3
                    -olefile==0.45.1
                    -packaging==17.1
                    -pamela==0.3.0
                    -pandas==0.22.0
                    -...
                    -webencodings==0.5
                    -widgetsnbextension==3.2.1
                    -xlrd==1.1.0
                    -zope.interface==4.5.0
                    -
                    - -

                    -In the rest of this document, I will assume the correct command is pip -and I will not systematically insert the %%sh magic. -

                    - -

                    -Once you know which packages are installed, you can easily get -additional information about a given package and in particular check -whether it was installed "locally" through pip or whether it is -installed system-wide. Again, in a shell command: -

                    -
                    -
                    pip show pandas
                    -echo "            "
                    -pip show statsmodels
                    -
                    -
                    - -
                    -Name: pandas
                    -Version: 0.22.0
                    -Summary: Powerful data structures for data analysis, time series,and statistics
                    -Home-page: http://pandas.pydata.org
                    -Author: None
                    -Author-email: None
                    -License: BSD
                    -Location: /usr/lib/python3/dist-packages
                    -Requires: 
                    -            
                    -Name: statsmodels
                    -Version: 0.9.0
                    -Summary: Statistical computations and models for Python
                    -Home-page: http://www.statsmodels.org/
                    -Author: None
                    -Author-email: None
                    -License: BSD License
                    -Location: /home/alegrand/.local/lib/python3.6/site-packages
                    -Requires: patsy, pandas
                    -
                    -
                    -
                    -
                    -

                    How to list imported modules?

                    -
                    -

                    -Without resorting to pip (that will list all available packages), you -may want to know which modules are loaded in a Python session as well -as their version. Inspired by StackOverflow, here is a simple -function that lists loaded package (that have a __version__ attribute, -which is unfortunately not completely standard). -

                    - -
                    -
                    def print_imported_modules():
                    -    import sys
                    -    for name, val in sorted(sys.modules.items()):
                    -        if(hasattr(val, '__version__')): 
                    -            print(val.__name__, val.__version__)
                    -        else:
                    -            print(val.__name__, "(unknown version)")
                    -
                    -print("**** Package list in the beginning ****");
                    -print_imported_modules()
                    -print("**** Package list after loading pandas ****");
                    -import pandas
                    -print_imported_modules()
                    -
                    -
                    - -
                    -**** Package list in the beginning ****
                    -**** Package list after loading pandas ****
                    -_csv 1.0
                    -_ctypes 1.1.0
                    -decimal 1.70
                    -argparse 1.1
                    -csv 1.0
                    -ctypes 1.1.0
                    -cycler 0.10.0
                    -dateutil 2.7.3
                    -decimal 1.70
                    -distutils 3.6.5rc1
                    -ipaddress 1.0
                    -json 2.0.9
                    -logging 0.5.1.2
                    -matplotlib 2.1.1
                    -numpy 1.14.5
                    -numpy.core 1.14.5
                    -numpy.core.multiarray 3.1
                    -numpy.core.umath b'0.4.0'
                    -numpy.lib 1.14.5
                    -numpy.linalg._umath_linalg b'0.1.5'
                    -pandas 0.22.0
                    -_libjson 1.33
                    -platform 1.0.8
                    -pyparsing 2.2.0
                    -pytz 2018.5
                    -re 2.2.1
                    -six 1.11.0
                    -urllib.request 3.6
                    -zlib 1.0
                    -
                    -
                    -
                    - -
                    -

                    Saving and restoring an environment with pip

                    -
                    -

                    -The easiest way to go is as follows: -

                    -
                    -
                    pip3 freeze > requirements.txt # to obtain the list of packages with their version
                    -pip3 install -r requirements.txt # to install the previous list of packages, possibly on an other machine
                    -
                    -
                    - -

                    -If you want to have several installed Python environments, you may -want to use Pipenv. I doubt it allows to track correctly FORTRAN or C -dynamic libraries that are wrapped by Python though. -

                    -
                    -
                    -
                    -

                    Installing a new package or a specific version

                    -
                    -

                    -The Jupyter environment we deployed on our servers for the MOOC is -based on the version 4.5.4 of Miniconda and Python 3.6. In this -environment you should simply use the pip command (remember on your -machine, you may have to use pip3). -

                    - -

                    -If I query the current version of statsmodels in a shell command, -here is what I will get. -

                    -
                    -
                    pip show statsmodels
                    -
                    -
                    - -
                    -Name: statsmodels
                    -Version: 0.8.0
                    -Summary: Statistical computations and models for Python
                    -Home-page: http://www.statsmodels.org/
                    -Author: Skipper Seabold, Josef Perktold
                    -Author-email: pystatsmodels@googlegroups.com
                    -License: BSD License
                    -Location: /opt/conda/lib/python3.6/site-packages
                    -Requires: scipy, patsy, pandas
                    -
                    - -

                    -I can then easily upgrade statsmodels: -

                    -
                    -
                    pip install --upgrade statsmodels 
                    -
                    -
                    - -

                    -Then the new version should then be: -

                    -
                    -
                    pip show statsmodels
                    -
                    -
                    - -
                    -Name: statsmodels
                    -Version: 0.9.0
                    -Summary: Statistical computations and models for Python
                    -Home-page: http://www.statsmodels.org/
                    -Author: Skipper Seabold, Josef Perktold
                    -Author-email: pystatsmodels@googlegroups.com
                    -License: BSD License
                    -Location: /opt/conda/lib/python3.6/site-packages
                    -Requires: scipy, patsy, pandas
                    -
                    - -

                    -It is even possible to install a specific (possibly much older) version, e.g.,: -

                    -
                    -
                    pip install statsmodels==0.6.1
                    -
                    -
                    -
                    -
                    -
                    -
                    -

                    Getting information about R libraries

                    -
                    -
                    -
                    -

                    Getting the list imported modules and their version

                    -
                    -

                    -The best way seems to be to rely on the devtools package (if this -package is not installed, you should install it first by running in R -the command install.packages("devtools")). -

                    - -
                    -
                    sessionInfo()
                    -devtools::session_info()
                    -
                    -
                    - -
                    -R version 3.5.1 (2018-07-02)
                    -Platform: x86_64-pc-linux-gnu (64-bit)
                    -Running under: Debian GNU/Linux buster/sid
                    -
                    -Matrix products: default
                    -BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
                    -LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
                    -
                    -locale:
                    - [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C              
                    - [3] LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8    
                    - [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8   
                    - [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
                    - [9] LC_ADDRESS=C               LC_TELEPHONE=C            
                    -[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       
                    -
                    -attached base packages:
                    -[1] stats     graphics  grDevices utils     datasets  methods   base     
                    -
                    -loaded via a namespace (and not attached):
                    -[1] compiler_3.5.1
                    -Session info ------------------------------------------------------------------
                    - setting  value                       
                    - version  R version 3.5.1 (2018-07-02)
                    - system   x86_64, linux-gnu           
                    - ui       X11                         
                    - language (EN)                        
                    - collate  fr_FR.UTF-8                 
                    - tz       Europe/Paris                
                    - date     2018-08-01                  
                    -
                    -Packages ----------------------------------------------------------------------
                    - package   * version date       source        
                    - base      * 3.5.1   2018-07-02 local         
                    - compiler    3.5.1   2018-07-02 local         
                    - datasets  * 3.5.1   2018-07-02 local         
                    - devtools    1.13.6  2018-06-27 CRAN (R 3.5.1)
                    - digest      0.6.15  2018-01-28 CRAN (R 3.5.0)
                    - graphics  * 3.5.1   2018-07-02 local         
                    - grDevices * 3.5.1   2018-07-02 local         
                    - memoise     1.1.0   2017-04-21 CRAN (R 3.5.1)
                    - methods   * 3.5.1   2018-07-02 local         
                    - stats     * 3.5.1   2018-07-02 local         
                    - utils     * 3.5.1   2018-07-02 local         
                    - withr       2.1.2   2018-03-15 CRAN (R 3.5.0)
                    -
                    - -

                    -Some actually advocate that writing a reproducible research compendium -is best done by writing an R package. Those of you willing to have a -clean R dependency management should thus have a look at Packrat. -

                    -
                    -
                    -
                    -

                    Getting the list of installed packages and their version

                    -
                    -

                    -Finally, it is good to know that there is a built-in R command -(installed.packages) allowing to retrieve and list the details of all -packages installed. -

                    -
                    -
                    head(installed.packages())
                    -
                    -
                    - - - - --- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    PackageLibPathVersionPriorityDependsImportsLinkingToSuggestsEnhancesLicenseLicenseisFOSSLicenserestrictsuseOStypeMD5sumNeedsCompilationBuilt 
                    BH/home/alegrand/R/x8664-pc-linux-gnu-library/3.51.66.0-1nilnilnilnilnilnilBSL-1.0nilnilnilnilno3.5.1 
                    Formula/home/alegrand/R/x8664-pc-linux-gnu-library/3.51.2-3nilR (>= 2.0.0), statsnilnilnilnilGPL-2GPL-3nilnilnilnilno3.5.1
                    Hmisc/home/alegrand/R/x8664-pc-linux-gnu-library/3.54.1-1nillattice, survival (>= 2.40-1), Formula, ggplot2 (>= 2.2)methods, latticeExtra, cluster, rpart, nnet, acepack, foreign,           
                    gtable, grid, gridExtra, data.table, htmlTable (>= 1.11.0),                
                    viridis, htmltools, base64encnilchron, rms, mice, tables, knitr, ff, ffbase, plotly (>=              
                    4.5.6)nilGPL (>= 2)nilnilnilnilyes3.5.1        
                    Matrix/home/alegrand/R/x8664-pc-linux-gnu-library/3.51.2-14recommendedR (>= 3.2.0)methods, graphics, grid, stats, utils, latticenilexpm, MASSMatrixModels, graph, SparseM, sfsmiscGPL (>= 2)file LICENCEnilnilnilnilyes3.5.1
                    StanHeaders/home/alegrand/R/x8664-pc-linux-gnu-library/3.52.17.2nilnilnilnilRcppEigen, BHnilBSD3clause + file LICENSEnilnilnilnilyes3.5.1 
                    acepack/home/alegrand/R/x8664-pc-linux-gnu-library/3.51.4.1nilnilnilniltestthatnilMIT + file LICENSEnilnilnilnilyes3.5.1 
                    -
                    -
                    - -
                    -

                    Installing a new package or a specific version

                    -
                    -

                    -This section is mostly a cut and paste from the recent post by Ian -Pylvainen on this topic. It comprises a very clear explanation of how -to proceed. -

                    -
                    - -
                    -

                    Installing a pre-compiled version

                    -
                    -

                    -If you're on a Debian or a Ubuntu system, it may be difficult to -access a specific version without breaking your system. So unless you -are moving to the latest version available in your Linux distribution, -we strongly recommend you to build from source. In this case, you'll -need to make sure you have the necessary toolchain to build packages -from source (e.g., gcc, FORTRAN, etc.). On Windows, this may require -you to install Rtools. -

                    - -

                    -If you're on Windows or OS X and looking for a package for an older -version of R (R 2.1 or below), you can check the CRAN binary -archive. Once you have the URL, you can install it using a command -similar to the example below: -

                    -
                    -
                    packageurl <- "https://cran-archive.r-project.org/bin/windows/contrib/2.13/BBmisc_1.0-58.zip"
                    -install.packages(packageurl, repos=NULL, type="binary")
                    -
                    -
                    -
                    -
                    -
                    -

                    Using devtools

                    -
                    -

                    -The simplest method to install the version you need is to use the -install_version() function of the devtools package (obviously, you -need to install devtools first, which can be done by running in R the -command install.packages("devtools")). For instance: -

                    - -
                    -
                    require(devtools)
                    -install_version("ggplot2", version = "0.9.1", repos = "http://cran.us.r-project.org")
                    -
                    -
                    -
                    -
                    -
                    -

                    Installing from source code

                    -
                    -

                    -Alternatively, you may want to install an older package from source If -devtools fails or if you do not want to depend on it, you can install -it from source via install.packages() directed using the right -URL. This URL can be obtained by browsing the CRAN Package Archive. -

                    - -

                    -Once you have the URL, you can install it using a command similar to -the example below: -

                    -
                    -
                    packageurl <- "http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz"
                    -install.packages(packageurl, repos=NULL, type="source")
                    -
                    -
                    - -

                    -If you know the URL, you can also install from source via the command -line outside of R. For instance (in bash): -

                    -
                    -
                    wget http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_0.9.1.tar.gz
                    -R CMD INSTALL ggplot2_0.9.1.tar.gz
                    -
                    -
                    -
                    -
                    -
                    -

                    Potential issues

                    -
                    -

                    -There are a few potential issues that may arise with installing older -versions of packages: -

                    -
                      -
                    • You may be losing functionality or bug fixes that are only present -in the newer versions of the packages.
                    • -
                    • The older package version needed may not be compatible with the -version of R you have installed. In this case, you will either need -to downgrade R to a compatible version or update your R code to work -with a newer version of the package.
                    • -
                    -
                    -
                    -
                    -
                    -
                    diff --git a/module4/ressources/resources_environment.org b/module4/ressources/resources_environment.org index 176cd69..90828c4 100644 --- a/module4/ressources/resources_environment.org +++ b/module4/ressources/resources_environment.org @@ -6,6 +6,19 @@ #+OPTIONS: num:nil toc:t #+PROPERTY: header-args :eval never-export +* Table of Contents :TOC: +- [[#getting-information-about-your-git-repository][Getting information about your Git repository]] +- [[#getting-information-about-python3-libraries][Getting information about Python(3) libraries]] + - [[#getting-information-about-your-system][Getting information about your system]] + - [[#getting-the-list-of-installed-packages-and-their-version][Getting the list of installed packages and their version]] + - [[#how-to-list-imported-modules][How to list imported modules?]] + - [[#saving-and-restoring-an-environment-with-pip][Saving and restoring an environment with pip]] + - [[#installing-a-new-package-or-a-specific-version][Installing a new package or a specific version]] +- [[#getting-information-about-r-libraries][Getting information about R libraries]] + - [[#getting-the-list-imported-modules-and-their-version][Getting the list imported modules and their version]] + - [[#getting-the-list-of-installed-packages-and-their-version-1][Getting the list of installed packages and their version]] + - [[#installing-a-new-package-or-a-specific-version-1][Installing a new package or a specific version]] + * Getting information about your Git repository When taking notes, it may be difficult to remember which version of the code or of a file was used. This is what version control is useful diff --git a/module4/ressources/resources_environment_fr.org b/module4/ressources/resources_environment_fr.org index 09390a7..958301d 100644 --- a/module4/ressources/resources_environment_fr.org +++ b/module4/ressources/resources_environment_fr.org @@ -6,10 +6,18 @@ #+OPTIONS: num:nil toc:t #+PROPERTY: header-args :eval never-export -* Table des matières -- Obtenir des informations sur votre dépôt Git -- Obtenir des informations sur les librairies Python 3 -- Obtenir des informations sur les packages R +* Table des matières :TOC: +- [[#obtenir-des-informations-sur-votre-dépôt-git][Obtenir des informations sur votre dépôt Git]] +- [[#obtenir-des-informations-sur-les-librairies-python-3][Obtenir des informations sur les librairies Python 3]] + - [[#obtenir-des-informations-sur-votre-système][Obtenir des informations sur votre système]] + - [[#lister-les-packages-installés-et-leur-version][Lister les packages installés et leur version]] + - [[#lister-les-packages-importés-chargés-dans-une-session-python-et-leur-version][Lister les packages importés (chargés dans une session Python) et leur version]] + - [[#sauvegarder-et-restaurer-un-environnement-avec-pip][Sauvegarder et restaurer un environnement avec pip]] + - [[#installer-un-nouveau-package-ou-une-version-spécifique][Installer un nouveau package ou une version spécifique]] +- [[#obtenir-des-informations-sur-les-packages-r][Obtenir des informations sur les packages R]] + - [[#lister-les-packages-installés-et-leur-version-1][Lister les packages installés et leur version]] + - [[#lister-les-packages-importés-chargés-dans-une-session-r-et-leur-version][Lister les packages importés (chargés dans une session R) et leur version]] + - [[#installer-un-nouveau-package-ou-une-version-spécifique-1][Installer un nouveau package ou une version spécifique]] * Obtenir des informations sur votre dépôt Git Lorsqu'on prend des notes, il peut être difficile de se rappeler diff --git a/module4/ressources/resources_refs.html b/module4/ressources/resources_refs.html deleted file mode 100644 index 971aa65..0000000 --- a/module4/ressources/resources_refs.html +++ /dev/null @@ -1,205 +0,0 @@ -
                    -

                    Additional references

                    - - -
                    -

                    "Thoughts" on language/software stability

                    -
                    -

                    -As we explained, the programming language used in an analysis has a -clear influence on the reproducibility of your analysis. It is not a -characteristic of the language itself but rather a consequence of the -development philosophy of the underlying community. For example C is a -very stable language with a very clear specification designed by a -committee (even though some compilers may not respect this norm). -

                    - -

                    -On the other end of the spectrum, Python had a much more organic -development based on a readability philosophy and valuing continuous -improvement over backwards-compatibility. Furthermore, Python is -commonly used as a wrapping language (e.g., to easily use C or FORTRAN -libraries) and has its own packaging system. All these design choices -tend to make reproducibility often a bit painful with Python, even -though the community is slowly taking this into account. The transition from Python 2 to the not fully backwards compatible Python 3 has been a particularly painful process, not least because the two languages are so similar that is it not always easy to figure out if a given script or module is written in Python 2 or Python 3. It isn't even rare to see Python scripts that work under both Python 2 and Python 3, but produce different results due to the change in the behavior of integer division. -

                    - -

                    -R, in comparison is much closer (in terms of developer community) to -languages like SAS, which is heavily used in the pharmaceutical -industry where statistical procedures need to be standardized and rock -solid/stable. R is obviously not immune to evolutions that break old -versions and hinder reproducibility/backward compatibility. Here is a -relatively recent true story about this and some colleagues who worked -on the statistics introductory course with R on FUN reported us -several issues with a few functions (plotmeans from gplots, -survfit from survival, or hclust) whose default parameters had -changed over the years. It is thus probably good practice to give -explicit values for all parameters (which can be cumbersome) instead -of relying on default values, and to restrict your dependencies as much -as possible. -

                    - -

                    -This being said, the R development community is generally quite -careful about stability. We (the authors of this MOOC) believe that open -source (which allows to inspect how computation is done and to -identify both mistakes and sources of non-reproducibility) is more -important than the rock solid stability of SAS, which is proprietary -software. Yet, if you really need to stay with SAS (similar solutions -probably exist for other languages as well), you should know that SAS -can be used within Jupyter using either the Python SASKernel or the -Python SASPy package (step by step explanations about this are given -here). Using such literate programming approach allied with systematic -version and environment control will always help. -

                    -
                    -
                    -
                    -

                    Controlling your software environment

                    -
                    -

                    -As we mentioned in the video sequences, there are several solutions to -control your environment: -

                    -
                      -
                    • The easy (preserve the mess) ones: CDE or ReproZip
                    • -
                    • The more demanding (encourage cleanliness) where you start with a -clean environment and install only what's strictly necessary (and document it): -
                        -
                      • The very well known Docker
                      • -
                      • Singularity or Spack, which are more targeted toward the specific -needs of high performance computing users
                      • -
                      • Guix, Nix that are very clean (perfect?) solutions to this -dependency hell and which we recommend
                      • -
                    • -
                    - -

                    -It may be hard to understand the difference between these different -approaches and decide which one is better in your context. -

                    - -

                    -Here is a webinar where some of these tools are demoed in a -reproducible research context: Controling your environment (by Michael -Mercier and Cristian Ruiz) -

                    - -

                    -You may also want to have a look at the Popper conventions (webinar by -Ivo Gimenez through google hangout) or at the presentation of Konrad -Hinsen on Active Papers (http://www.activepapers.org/). -

                    -
                    -
                    -
                    -

                    Preservation/Archiving

                    -
                    -

                    -Ensuring software is properly archived, i.e, is safely stored so that -it can be accessed in a perennial way, can be quite tricky. If you -have never seen Roberto Di Cosmo presenting the Software Heritage -project, this is a must see. https://www.softwareheritage.org/ -

                    - -

                    -For regular data, we highly recommend using https://www.zenodo.org/ -whenever the data is not sensitive. -

                    -
                    -
                    -
                    -

                    Workflows

                    -
                    -

                    -In the video sequences, we mentioned workflow managers (original application domain in parenthesis): -

                    - - -

                    -You may want to have a look at this webinar: Reproducible Science in -Bio-informatics: Current Status, Solutions and Research Opportunities -(by Sarah Cohen Boulakia, Yvan Le Bras and Jérôme Chopard). -

                    -
                    -
                    - - -
                    -

                    Publication practices

                    -
                    -

                    -You may want to have a look at the following two webinars: -

                    - -
                    -
                    -
                    -

                    Experimentation

                    -
                    -

                    -Experimentation was not covered in this MOOC, although it is an -essential part of science. The main reason is that practices and -constraints can vary so wildly from one domain to another that it could -not be properly covered in a first edition. We would be happy to -gather references you consider as interesting in your domain so do not -hesitate to provide us with such references by using the forum and we -will update this page. -

                    - - -
                    -
                    -
                    -- 2.18.1