Skip to content
Diego A. Bayona edited this page Feb 20, 2022 · 3 revisions

Contribute to UNCode

Here you will learn how to start contributing to UNCode and how our development process is. This guide is only focused on how to add or modify the application web, thus, only about modifications in the main repository.

See the understand UNCode page, where are explained the packages that compose the main repository. Most of these packages are not going to be modified, they have been proofed to correctly work without bugs. The main place where most of development is in the frontend package. As here are all pages and frontend related files.

The UNCode's frontend is developed using the framework Web.py, and pages use its tools, such as template, to correctly render the HTML and provide security. Most of added changes on UNCode, with respect INGInious' base code, are plugins, our development is mostly focused on extending INGInious only via plugins. This in order to have the plugin decoupled from the base code, this makes easier the maintenance as in the base code as in the plugins. In case you want to add a new plugin, check the tutorial.

Note: for all repositories it is necessary to create a Pull Request with the suggested changes, with a descriptive name. Make sure to sign the Contributor License Agreement (CLA) and see all checks pass, some might also review your code. Check the CONTRIBUTING file for the specific repository you want to contribute to.

Frontend package

Here we explain some important files and how the frontend is organized

  • pages folder contains python code with all the logic for the different pages on UNCode.
  • static stores static files such as js and css, make sure to do not modify this files. In case you need to do some modifications, do it via a plugin.
  • templates are HTML files with the templates the pages use to render. These templates may also contain python code using the web.py syntax for templates.
  • app.py, this file initializes the web application, and all initial settings are set. This is good file to check to understand a bit how the different files ensemble.
  • courses.py, this contains a class WebAppCourse which extends from the common package to add new methods and functionalities.
  • plugin_manager.py, contains the class PluginManager to manage the plugins and provide them with some useful methods to create plugins. Pay attention to this class as this will help you out to learn how to create a plugin.
  • submission_manager, with the class WebAppSubmissionManager, manages all submissions from students. This might be helpful for some features and queries.
  • WebAppTask class is in tasks.py file, this is similar to WebAppCorse, which extends from common to extend methods. Helpful to access the tasks' data.
  • TemplateHelper in template_helper.py, with the methods provided here you will be able to correctly render the HTML templates, send parameters to templates, and in general ensemble correctly the templates.
  • UserManager class in user_manager.py, which manages users' data and sessions.

These are pretty much some folders and classes that will help you to understand UNCode to start contributing. After you do the corresponding modifications, there are some few steps to accomplish.

Testing

Test your modifications and always try to add testing for new functionalities, this can be unit tests or functional tests. Check the tests/ folder to guide your on how to do this. To run the tests, run next command:

python setup.py test

Minify static files

Minify static files, so the production server takes into account the changes. See the minify statis files documentation to learn how to do this. Remember that doing this is mandatory.

Internationalization (i18n)

UNCode already supports internationalization (i18n), that means that frontend messages can be translated in several languages. Currently we support 5 languages: Spanish (es), English (en), German (de), French (fr) and Portuguese (pt). However, not all messages and texts are translated for all languages as this must be done manually. To manage i18n, UNCode uses pybabel, and more exactly, the function gettext, to do the corresponding translations. See the i18n documentation to see how to do this.

This is a mandatory step as messages need to be updated for the corresponding languages, and always try to translate the messages

Clone this wiki locally