Published: Jun 1, 2025 by Ava Dean
Project info
SIKE (Scrape-off layer Impurities with Kinetic Electrons) is a simple atomic kinetics solver for impurity species relevant to magnetic fusion plasmas. It is intended to study the effect of non-Maxwellian electron distributions on mean ionisation, radiative loss rates, amongst other properties.
The health check on the project identified that the code was written to a high standard and was well structured. It had
a well written pyproject.toml file, as well as a good test suite that had reasonable code coverage. To improve upon
this, we started by adding optional dependencies of packages and a uv.lock file using the UV package and project
manager for Python. The use of UV allows for completely reproducible environments for future development of the
project, as well as a simple way to manage dependencies. A .gitignore file was also added to the project following
the example template provided by Github. A comprehensive overview of coding style choices and potential
issues was performed using the ruff linter. The large amount of code changes required the use of a
.git-blame-ignore-revs file to ensure the code history reflected the authors of the original code rather than tidy ups
performed by the linter. Docstrings were added and improved throughout the code to ensure their compatibility with
Sphinx. The documentation itself was then put onto Read the Docs.
A good portion of time was spent improving and extending the test suite. This included the use of pytest-cov to
generate coverage reports, as well as a variety of pytest’s built-in features, such as @pytest.mark.parametrize and
@pytest.skipif. These allowed for more concisely written tests, as well as the ability to skip tests based on
whether the user had downloaded external atomic data via a provided script. Regression tests were also implemented using
the Syrupy package to ensure the code continued to produce the same results as development continued. The
numerical nature of the code did provide obstacles to writing robust regression tests, as results may differ slightly
between runs due to floating point precision, internal algorithms that depend on tolerance parameters, and controlled
random initial conditions. Workflows were also added for the test suite and linter to run automatically on pull
requests.
Overall, this project was an excellent learning experience, as almost all aspects either heavily improved upon or added to my skills as a developer. Many of the tools and practices used will be invaluable in the future.