Skip to content

Coding Conventions

Hendrik Roch edited this page Nov 6, 2024 · 6 revisions

All modules in this package follow distinct formatting structure which is summarized in the following:

Nomenclature

  • Class members: Names of class members end with an underscore, e.g. .mass_
  • Setter methods: Names of methods that assign values to members start with 'set', e.g. .set_mass()
  • Getter methods: Names of methods to get members have the same name as the member without an underscore at the end, e.g. .mass()

Returning Values

  • If not otherwise explicitely stated, all methods that return multiple values return them as numpy array

Typing

  • SPARKX transitions to static typing. As Python is inherently non-statically typed, we use type hints and return hints and use a linter. This will become an automatic action in the future

To run mypy on your entire project, follow these steps:

Install mypy (if not already installed):

pip install mypy

Navigate to your project directory:

cd /path/to/your/project

Run mypy:

mypy src/sparkx --ignore-missing-imports --show-error-codes --disallow-untyped-defs --disallow-untyped-calls