Repository navigation
Description
[This is a thesis topic. Please don't start working on this -- school work has to be done individually.]
Currently, the content of naucse.python.cz is rendered from HTML and Markdown files and Jupyter Notebooks into a static HTML website. Only this git repository is used as the source of data. This is problematic because only trusted users can add or modify course content; others must use GitHub pull requests and wait until someone trusted merges the change. This doesn't work well for course materials, where teachers often need to do last-minute changes.
Implement support for the following workflow:
- The teacher forks the naucse.python.cz repository, and optionally creates a new branch.
- The teacher creates a Pull Request with their course metadata, including the forked repository URL and branch information.
- The metadata gets merged to the base repo.
- The teacher adds a webhook to their repository (this should also be possible in an automated fashion).
- On each push to the forked repository, the changed parts of the materials get rerendered on the naucse.python.cz website. Note that both content and code in the forked repository might be changed.
- Later, the teacher may or may not submit a Pull Request with their changes, and possibly remove the forked repo URL to indicate the course should be rendered from this repository from this point forward.
To implement this, create a tool that efficiently* and securely** renders a HTML fragment given a repository URL, branch, and page name. Then, extend naucse.python.cz to optionally use this tool for rendering (see Page.render_html() in model.py).
* Forks will usually contain identical code, and most of the source materials will be identical. Cache individual rendered fragments across repositories to avoid duplicate work.
** Code in forks is untrusted. Provide proper isolation to prevent exploits by malicious users. (However, if two forks share identical code, they may be able to poison each other's cache.)
When naucse.python.cz is run locally, the serve and freeze commands should function as they do currently. Specifically, the code is assumed to be trusted, so no isolation is needed. No non-Python dependencies (e.g. Docker/Vagrant) should be needed. (This can be achieved by not running the tool at all, although the caching would be nice.)
In case the rendering results in an error (e.g. the page is not found, invalid template syntax, etc.), the tool should return an indication of the problem. Then, naucse.python.cz should display a warning and, if available, a version of the page from the master branch of the main repository.
The workflow should be described in Czech on naucse.python.cz, possibly as a (meta)course.
Activity
hroncok commentedon Sep 7, 2017
[Thesis topic approved 🎉]
Implemented most of pyvec#175
Implemented most of pyvec#175
hroncok commentedon Apr 28, 2018
I think this is finished.