Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp: use a modular approach for tutorial materials #326

Draft
wants to merge 5 commits into
base: legacy
Choose a base branch
from

Conversation

mbercx
Copy link
Member

@mbercx mbercx commented May 15, 2021

This PR is a small showcase of how I would like to restructure the documentation materials. This post has been edited after giving the issue some more thought and discussion with others.

Motivation

The main reasons for adapting the tutorial structure/format are:

  • Because all the tutorials are visible in the sidebar when a user arrived on the landing page, it can be a bit overwhelming for users. @chrisjsewell already gave a helping hand here with the panels, but I think it would be better if the sidebar could be used to organise the tutorial content.

  • Since all the previously organised content is on the master branch, all of it needs to be maintained. This includes any changes in switching sphinx versions or extensions, but also the content somewhat, since users do not always run the tutorials with the code versions specified.

  • Because the tutorial material of a specific event is usually quite connected, it is difficult to piece together material for tutorials of different sizes and different audiences.

  • Since all of the material is written in RestructuredText, testing the material is a painstaking process with a lot of copy pasting that cannot be automated.

Suggested changes

Restructuring the content

The main idea is to organise the material of previous tutorials into standalone modules divided into sections (Fundamentals, calculations, workflows, etc...). Of course, each module will have some prerequisites. To organise these easily, I suggest the following:

  • The "Fundamentals" section is where new users have to start. This currently only includes the "Setup" and "AiiDA Basics" modules.
  • The other sections will have linear requirements on top, i.e. a list of modules that need to be executed in order, but are still modular in the sense that the end of a module would be a good place to stop for an event.
  • In the future, we could also consider less linear modules below the linear ones at the top of a section. An example here would be: Once the user knows how to write a workflow, they may want to either learn about dealing with errors or validating inputs.

The modules well be shown as sphinx-panels, with the content growing progressively more advanced as the user goes down the page. An example can be found here:

https://aiida-tutorials--326.org.readthedocs.build/en/326/sections/calculations/index.html

Switching to MyST Markdown

The tutorials will be written in MyST markdown, so they can be downloaded as Jupyter notebooks that can be easily run by the users and tested (automatically?). Previous content can be fairly easily converted using @chrisjsewell's RestructuredText to MyST Markdown converter.

Adding code-flavoured versions

Over time, we should make the tutorials on the aiida-tutorials page code-agnostic. They should use basic classes like the ArithmeticAddCalculation to demonstrate the AiiDA concepts. However, each module panel can be decorated with little badges on the bottom that link to the corresponding tutorial on the tutorials page of that code (Quantum ESPRESSO, VASP, ...). Check out the showcase example to see what this would look like.

Organising tutorial events

The material in the master branch should be kept up to date with the latest version of aiida-core whenever possible. This will hopefully lead to fewer cases of users trying to execute material from previous versions with the latest version, running into issues.

When we want to organise a tutorial, we just piece together the modules that we want to use, depending on the audience and the length of the tutorial. These will be put in a separate branch of the aiida-tutorials repo, so each organised tutorial will have one branch that is kept as a reference, but no longer needs any maintenance.

Tutorials versus How-to's

One important point that I failed to think about enough initially was the clear separation between "Tutorials" and "How-to's". As is explained here, both serve different purposes, and should be kept separate. My initial suggestion to modularize the tutorial content blurred the lines between tutorial and how-to in a way that we shouldn't. Some examples of important differences:

  • For a module on how to set up a computer, I would be inclined to explain the different ways of doing this (interactively, via a configuration script / for a localhost, remote). This is fine for a "How-to", but a tutorial should focus on one pathway of steps, not confuse the new user with a whole bunch of options.
  • I think a good tutorial will actually combine a bunch of concepts that in my previous structure I was trying to separate into sections/modules. Imagine you want to show a beginning user how to run a calculation with Quantum ESPRESSO (see e.g. this hands-on for the recent QE school). This requires quite a few concepts: Setting up codes/computers, structures, k-points, Dict nodes for the parameters, ... Simply setting up modules as I'm doing here and then putting them together for a tutorial will not make a good tutorial, since it will take too long for the user to actually achieve something.

This doesn't mean that we can't move to slightly more atomic hands-ons for tutorials that are easier to combine in ways that allow you to quickly build the material for a tutorials of different lengths. But I think the material has to be different, since they have different goals. This does mean that we have to maintain both, and that there will be some duplicated content between tutorials and how-to sections, but I fear that is simply unavoidable.

In the latest commit, I've applied this modular approach in the context of tutorials as described above.

@espenfl
Copy link
Contributor

espenfl commented May 18, 2021

This is a great suggestion @mbercx. I support this fully.

* The tutorials will be written in [MyST markdown](https://myst-parser.readthedocs.io/en/latest/), so they can be downloaded as Jupyter notebooks that can be easily run by the users and tested (automatically?). Previous content can be fairly easily converted using @chrisjsewell's [RestructuredText to MyST Markdown converter](https://github.com/executablebooks/rst-to-myst).

I would be a bit hesitant to rely too much on the Jupyter Notebooks, but maybe that is the best approach, given that we already have the notebook functionality embedded. It would certainly be nice for everyone to not have to cut and paste code snippets and that we could check that they actually work and produce the expected result.

There is one thing that I'm still wondering: If the content gets organised into modules like this, they will more closely resemble the format of the "How-to" sections in the main AiiDA documentation. It seems sensible to try and merge this content somehow, so we don't have separate locations where we try to explain the same thing. The question is where to put this content, if we do merge it. Pinging @csadorf on this topic.

For the specific how-to's I see no reason why these things can not be merged. I guess the how-to's would be a subset of the tutorial in this case.

@mbercx
Copy link
Member Author

mbercx commented May 30, 2021

Thanks for your comments @espenfl!

I would be a bit hesitant to rely too much on the Jupyter Notebooks, but maybe that is the best approach, given that we already have the notebook functionality embedded. It would certainly be nice for everyone to not have to cut and paste code snippets and that we could check that they actually work and produce the expected result.

I sort of understand your hesitation of using Jupyter notebooks for everything (but I'm not sure if it has the same root cause as mine ^^). I'm not able to explain it fully, but I'm not sure if it's best if users can just Shift+Enter their way through a notebook during a tutorial. I feel there will be less inclination for them to experiment a bit more with verdi command by looking at the help. Of course, we can build in exercises for them so they have to stop and think a bit more at certain points.

That said, I do favour using MyST markdown for writing our tutorials and documentation in general. Most people will be more familiar with Markdown, so they don't have to learn RestructuredText to start contributing to documentation. I also very much like the idea of making a notebook to explain how to do something, saving it in markdown using jupytext, and then simply moving it into the documentation. And, as we both mentioned, we can move towards testing our documentation whenever the code is updated with continuous integration.

For the specific how-to's I see no reason why these things can not be merged. I guess the how-to's would be a subset of the tutorial in this case.

I've given this some more thought this weekend, and think I have may have committed the sin of muddying the waters between Tutorials and How-to's. As is explained here, both serve different purposes, and should be kept separate. I think my suggestion to modularize the tutorial content may exactly blur the line between tutorial and how-to in a way that we shouldn't. Some examples of important differences:

  • For a module on how to set up a computer, I would be inclined to explain the different ways of doing this (interactively, via a configuration script / for a localhost, remote). This is fine for a "How-to", but a tutorial should focus on one pathway of steps, not confuse the new user with a whole bunch of options.
  • I think a good tutorial will actually combine a bunch of concepts that in my current structure I am trying to separate into sections/modules. Imagine you want to show a beginning user how to run a calculation with Quantum ESPRESSO (see e.g. this hands-on for the recent QE school). This requires quite a few concepts: Setting up codes/computers, structures, k-points, Dict nodes for the parameters, ... Simply setting up modules as I'm doing here and then putting them together for a tutorial will not make a good tutorial, since it will take too long for the user to actually achieve something.

So, I think the showcase I've built here would actually be best used for the "How-to" section on the documentation, rather than the tutorial page. This doesn't mean that we can't move to slightly more atomic hands-ons for tutorials that are easier to combine in ways that allow you to quickly build the material for a tutorials of different lengths. But I think the material has to be different, since they have different goals. This does mean that we have to maintain both, and that there will be some duplicated content between tutorials and how-to sections, but I fear that is simply unavoidable.

@mbercx
Copy link
Member Author

mbercx commented May 31, 2021

I've updated the original post to reflect the latest version of my suggested changes to the tutorial page. Everything you need to read is now contained within that post.

Pinging @ltalirz @giovannipizzi @csadorf for comments.

@ramirezfranciscof
Copy link
Member

ramirezfranciscof commented May 31, 2021

I don't know if this works if I add it as comment or it has to be on the OP, but just to note that this will fix #269

EDIT: Well, apparently it doesn't. @mbercx can you later add it to your OP?

@mbercx
Copy link
Member Author

mbercx commented May 31, 2021

I don't know if this works if I add it as comment or it has to be on the OP, but just to note that this will fix #269

EDIT: Well, apparently it doesn't. @mbercx can you later add it to your OP?

Hmm. I could, but right now this draft PR doesn't really fix it yet. 😅

Plan would be to:

  • Work in tutorial-2021-intro-week branch by opening PR's.
  • When this is final (i.e. after the tutorial), reset --hard this PR to that branch.
  • Add the content of other tutorials we still want to save to separate branches.
  • Merge this PR into master.

@ltalirz
Copy link
Member

ltalirz commented May 31, 2021

Thanks @mbercx!

Let me start by saying that since I'm not the one doing the bulk of the work here, take this as input to consider and to incorporate as you see fit rather than as "change requests".

Organisation of the repo

Using one branch per tutorial vs all tutorials in the master branch: while from the user perspective this is in principle just a different way of navigating the web site (and you may still get requests from people running old tutorials, i.e. I'm not sure whether it absolves you from maintenance), I can see how this is a more useful way of organising content from the developer side and I think it's a good change.
Please mention explicitly on the landing page that people can use the version selector on the right bottom to reach old versions of tutorials (not everyone may see that).

It may be worth checking whether we are linking e.g. from aiida.net to web sites that become inaccessible with this change and see whether they can be fixed (or redirected as we do for the aiida-core docs).

Tutorials vs howtos

  • For a module on how to set up a computer, I would be inclined to explain the different ways of doing this (interactively, via a configuration script / for a localhost, remote). This is fine for a "How-to", but a tutorial should focus on one pathway of steps, not confuse the new user with a whole bunch of options.

As mentioned in the link you included, the main difference between tutorials and howtos is that tutorials are learning-oriented while howtos are problem-solving oriented.
Besides having a linear thread for guiding students through (which indeed is typically the best approach for tutorials), other aspects that come to mind:

  • tutorials can and should spend time on basic explanations of concepts while howtos may restrict this to a minimum if not necessary to solve the problem (perhaps linking to a more detailed reference)
  • tutorials can and should ask questions or pose (artificial) problems to the reader to test their understanding while howtos don't

In past tutorials I found particularly the last aspect somewhat underemphasized (we usually didn't have enough time to get to it) and I think it would be great to put some effort into this for this year's tutorial

code-agnostic and code-flavored versions

You anyhow suggest to keep this for the future, but I think this needs very careful consideration. The vast majority (if not all) of our audience still comes from the atomistic simulation community and it is easy to alienate them if we don't teach them how to use AiiDA for the types of problems they encounter in their daily work.

I can understand the drive towards a code-agnostic approach for the "basic tutorial" in the docs where time is very limited and where we would otherwise need to explain how to install and set up a simulation code etc.
In the context of a longer tutorial, however, where we have the freedom to provide the environment with the necessary simulation codes, I think it is preferable to take advantage of this.

This is not to say that one should not have two versions of the same module with different codes, but this then comes down to a question of maintenance effort, which essentially grows linearly with the number of codes (until we can include the common workflows next year ;-) ).

Switching to MyST Markdown

Sounds fine to me, I'm sure you've thought about it.

Restructuring the content

If I understand correctly, the "atomicity" of the individual modules has now again be relaxed somewhat, i.e. new instantiations of the tutorial would be allowed to do slight rearrangements of the structure, modification of the content etc. ? I believe this freedom will come in very handy.

In terms of the actual top-level structure I have no specific suggestions other than to reintroduce the section numbering if possible. It makes it much easier to check where people are at during a tutorial.

@mbercx
Copy link
Member Author

mbercx commented May 31, 2021

Thanks @ltalirz for your comments! I've responded to some points below.

Please mention explicitly on the landing page that people can use the version selector on the right bottom to reach old versions of tutorials (not everyone may see that).

I would add panels to the most recent tutorials, i.e. the ones we still want users to run. This way we have some control over which tutorials users wind up on, reducing the chance of them running a very old tutorial in the most recent versions. Also note that in case a user is running an old tutorial with the latest versions, we can always just point them to the latest version of the module. So maintaining the tutorials would focus on updating the most recent version (which can be tested automatically over time since we use MyST-NB).

It may be worth checking whether we are linking e.g. from aiida.net to web sites that become inaccessible with this change and see whether they can be fixed (or redirected as we do for the aiida-core docs).

Indeed, good point. I'm not sure if all tutorials materials need to be kept for posterity, though? For ones that I wouldn't add panels for, I guess we can just place them all in a legacy branch.

  • tutorials can and should spend time on basic explanations of concepts while howtos may restrict this to a minimum if not necessary to solve the problem (perhaps linking to a more detailed reference)
  • tutorials can and should ask questions or pose (artificial) problems to the reader to test their understanding while howtos don't
    In past tutorials I found particularly the last aspect somewhat underemphasized (we usually didn't have enough time to get to it) and I think it would be great to put some effort into this for this year's tutorial

I agree most wholeheartedly! Re point 1: I think some parts of the tutorial try to explain a bit too much, but this is mainly the workflows ones, which I'll be working on. Re point 2: We should indeed add more exercises (especially for the writing workflows, again). This was raised by several participant from the 2020 tutorial, and these comments were converted into #334 by @ramirezfranciscof.

You anyhow suggest to keep this for the future, but I think this needs very careful consideration. The vast majority (if not all) of our audience still comes from the atomistic simulation community and it is easy to alienate them if we don't teach them how to use AiiDA for the types of problems they encounter in their daily work.

I agree, and for now the main modules will all remain Quantum ESPRESSO flavoured. "Over time" may be quite a bit of time, and especially for the events we organise for the Psi-k community we should always stick to DFT-code flavoured modules. I think for now I'll move the QE badge into the title, so it's clear that Quantum ESPRESSO flavoured, and add badges in the bottom panel to tutorials from other plugins whenever I find them or the plugin developers request it.

This is not to say that one should not have two versions of the same module with different codes, but this then comes down to a question of maintenance effort, which essentially grows linearly with the number of codes (until we can include the common workflows next year ;-) ).

Hehe 😁 . I was actually considering doing a demo of the common-workflows (or at least a presentation) for this year's tutorial. It's quite impressive to see how easily you can run all these different workflows, so I think it will definitely grab the attention of the participants.

Note that the provision of the code-flavoured tutorials is the responsibility of the plugin developers. I'll take care of the QE ones, of course, but will touch base with e.g. @espenfl on the VASP-flavoured versions of the tutorials. Creating a code-agnostic document that outlines the structure of the tutorial content (see #331) will be important to get the tutorials across different flavours to match as well as possible.

If I understand correctly, the "atomicity" of the individual modules has now again be relaxed somewhat, i.e. new instantiations of the tutorial would be allowed to do slight rearrangements of the structure, modification of the content etc. ? I believe this freedom will come in very handy.

Of course, instances of the tutorial for events can make changes where necessary. The main goal is to have a single main tutorial page that is sorted by sections, and having the content on this page be as modular as possible so it's easier to throw together some modules for a tutorial of a specific size.

@espenfl
Copy link
Contributor

espenfl commented Jun 1, 2021

I've given this some more thought this weekend, and think I have may have committed the sin of muddying the waters between Tutorials and How-to's. As is explained here, both serve different purposes, and should be kept separate. I think my suggestion to modularize the tutorial content may exactly blur the line between tutorial and how-to in a way that we shouldn't. Some examples of important differences:

@mbercx Yes, the formal analysis separating the two is interesting, but needs to be balanced by available resources and practical limitations otherwise. I believe in many cases that there are components in each that can be designed exactly the same, in particular code snippets etc. How those components are used and composed determine if it is a tutorial or a how-to in my view. The context. E.g. one can pick one option to be used in a tutorial, while in the how-to also include additional options and other ways of doing it. This can then also be linked in the tutorial at the given entry point and the user would then be immediately familiar with the context when approaching the how-to.

This does mean that we have to maintain both, and that there will be some duplicated content between tutorials and how-to sections, but I fear that is simply unavoidable.

Absolutely. But let us try to minimize overlap.

@espenfl
Copy link
Contributor

espenfl commented Jun 1, 2021

Note that the provision of the code-flavoured tutorials is the responsibility of the plugin developers. I'll take care of the QE ones, of course, but will touch base with e.g. @espenfl on the VASP-flavoured versions of the tutorials. Creating a code-agnostic document that outlines the structure of the tutorial content (see #331) will be important to get the tutorials across different flavours to match as well as possible.

@mbercx Thanks a lot for working on the more general tutorial and how-to aspects. It is very important work that is easily missed or postponed indefinitely. I will try to contribute. Certainly to the VASP part, but also in general. Please let me know when you need something specific.

@ltalirz
Copy link
Member

ltalirz commented Jun 1, 2021

Note that the provision of the code-flavoured tutorials is the responsibility of the plugin developers. I'll take care of the QE ones, of course, but will touch base with e.g. @espenfl on the VASP-flavoured versions of the tutorials.

I see - I think this is a very nice idea for involving plugin developers who are interested in contributing to the tutorial.
The video presentations that we started were a good first step, but of course that doesn't necessarily get participants started with using their plugin.
Contributing a flavored tutorial module that uses their plugin could be more rewarding, both for the plugin developers and the tutorial audience.

@mbercx
Copy link
Member Author

mbercx commented Jun 1, 2021

E.g. one can pick one option to be used in a tutorial, while in the how-to also include additional options and other ways of doing it. This can then also be linked in the tutorial at the given entry point and the user would then be immediately familiar with the context when approaching the how-to.

@espenfl I agree. We can just have the how-to start with the option used in the tutorial, and then expand. This way we won't have to rewrite content. Linking to the how-to's from the tutorial module is a good idea, but perhaps at the beginning/end of the tutorial. A tutorial often start with what you will learn in the module anyways, maybe each bullet point will correspond to one how-to topic. In fact, maybe we should build the content of tutorial content in the context of how-to's. For example, the "Running your first calculation" module will teach you:

  • How to import a structure
  • How to set up a code
  • How to install pseudopotentials
  • How to set up inputs for a calculation
  • How to analyse outputs of a calculation

Each of these "topics" in the module can correspond to a how-to.

@mbercx Thanks a lot for working on the more general tutorial and how-to aspects. It is very important work that is easily missed or postponed indefinitely. I will try to contribute. Certainly to the VASP part, but also in general. Please let me know when you need something specific.

Thanks! Would be great if we could have VASP-flavoured versions of the running a calculation and running a workflow modules to link to with the badges. For the writing workflows modules, I will probably do this in a code-agnostic way, so you can also reuse these for your tutorials.

Contributing a flavored tutorial module that uses their plugin could be more rewarding, both for the plugin developers and the tutorial audience.

@ltalirz note that my intention was to have the code badges link to a corresponding module in the plugin documentation, so not have all tutorials in this repository. The only change we would do here is add the badges/links to the module panel, see for example the VASP badge here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants