Tech stack overview
Kolibri is a web application built primarily using Python on the server-side and JavaScript on the client-side.
Note that since Kolibri is still in development, the APIs are subject to change, and a lot of code is still in flux.
Server
The server is a Django application, and contains only pure-Python (3.6+) dependencies at run-time. It is responsible for:
Interfacing with the database (either SQLite or PostgreSQL)
Authentication and permission middleware
Routing and handling of API calls, using the Django REST Framework
Top-level URL routing between high-level sections of the application
Serving basic HTML wrappers for the UI with data bootstrapped into the page
Serving additional client assets such as fonts and images
Client
The frontend user interface is built using Vue and uses ES6 syntax transpiled by Bublé. The client is responsible for:
Compositing and rendering the UI
Managing client-side state using Vuex
Interacting with the server through the API
Developer docs
Documentation is formatted using reStructuredText and the output is compiled by Sphinx and hosted on Read the Docs.
Additionally, information about the design and implementation of Kolibri might be found on Google Drive, Github, Trello, Slack, InVision, mailing lists, office whiteboards, and lurking in the fragmented collective consciousness of our team and contributors.
Build infrastructure
We use a combination of both Node.js and Python scripts to transform our source code as-written to the code that is run in a browser. This process involves webpack, plus a number of both custom and third-party extensions.
Preparation of client-side resources involves:
ES6 to ES5
Transforming Vue.js component files (*.vue) into JS and CSS
SCSS to CSS
Auto-prefixing CSS
Bundling multiple JS dependencies into single files
Minifying and compressing code
Bundle resources such as fonts and images
Generating source maps
Providing mechanisms for decoupled “Kolibri plugins” to interact with each other and asynchronously load dependencies
The Makefile contains the top-level commands for building Python distributions, in particular wheel files (make dist
) and pex files (make pex
).
The builds are automated using buildkite, whose top-level configuration lives in the Kolibri repo. Other platform distributions such as Windows, Debian, and Android are built from the wheel files and maintained in their own repositories.
Automated testing
We use a number of mechanisms to help encourage code quality and consistency. Most of these are run automatically on Github pull requests, and developers should run them locally too.
pre-commit is run locally on
git commit
and enforces a variety of code conventionsWe use EditorConfig to help developers set their editor preferences
tox is used to run our test suites under a range of Python and Node environment versions
sphinx-build -b linkcheck
checks the validity of documentation linkspytest runs our Python unit tests. We also leverage the Django test framework.
In addition to building client assets, webpack runs linters on client-side code: ESLint for ES6 JavaScript, Stylelint for SCSS, and HTMLHint for HTML and Vue.js components.
Client-side code is tested using Jest
We have Sentry clients integrated (off by default) for automated error reporting