Skip to content

Coding Style

Evan Carlin edited this page Sep 23, 2021 · 4 revisions

Below are notes on coding style we follow when working on Sirepo.

The style we use is constantly evolving as we learn more about the problem we are solving and the languages we are using. If you see something that does not conform to the style here it is likely that our style has evolved and it is time to refactor that code!

Python

Our Python style inherits from the pykern coding style.

Imports

Do not use aliases for imports (ex. import numpy as np). Aliases cause confusion about where an import originates from and the non-aliased name is clearer.

We no longer support py2 so if you see from __future__ you can remove them.

JavaScript

Strings

We support ES6 so use template strings when you see fit. In the case of multiline strings they are preffered over our older syntax of `['foo', 'bar'].join('').

Clone this wiki locally