Languages

Rationales and context about the languages decisions around Josev design.

Python

Some parts of Josev current version are written in Python. Although Python is not widely used in the embedded industry due to its performance and dynamically typed philosophy, we have implemented mechanisms created by the community to reduce the drawbacks of the language. Within this project we use:

  • Asynchronous programming, which reduces multitasking complexity while giving a great performance.

  • A strict data structure contract between every application, by using Pydantic for validation of every request or response.

  • We follow and enforce PEP8 for code style with tools like black and flake8.

  • We enforce static type checking using mypy.

  • We use python 3.10 in our stack. Python 3.10 has a significant speedup of 1.25x in comparison with its previous version. This was due to a big improvement in the Cython project, the engine behind Python.

Python was a great tool to speedup our development, but performance bottlenecks, package size and distribution complexity to embedded targets has caused us to look for other solutions. We are actively moving away from Python on Josev.

Rust

Several microservices of Josev Pro are currently written in Rust. Rust is a system level programming language, with a very strong memory safe ownership model, with an equivalent performance as C/C++ and with a comfortable and less complex code style than other low level languages.

We opted to employ Rust for the Efficient XML Interchange (EXI) codec due to its considerably faster performance compared to other open-source implementations extensively used in the industry. Additionally, Rust was chosen for both SLAC and the smart charging service to enhance performance and minimize package size.

Our commitment entails iteratively and progressively replacing our Python codebase with Rust improved versions.