Contributions - usnistgov/NEMO GitHub Wiki

Contributions are welcomed. Please follow the following guidelines when contributing code.

Code style

These guidelines and settings are for PyCharm. Adapt them to whichever IDE you are using.

General

  • Tabs are used in NEMO's codebase.
  • 120 characters limit per line, after which code should be wrapped.

Imports

  • Always use organize imports before checking any code
  • Imports should be sorted (Editor -> Code Style -> Python -> Imports -> Sort imported names)
  • Imports should be chopped down and wrapped in parentheses (Editor -> Code Style -> Python -> Wrapping and Braces -> From Imports Statements -> Chop down if long)
  • All boxes under From Imports Statements should be checked:
    • Align when multiline
    • New line after '('
    • Place '(' on new line
    • Force parentheses if multiline
    • Force trailing comma if multiline

Tests

Always run the tests after changing any code in NEMO, even if the changes seem isolated and don't seem to interfere with the rest.

  • run export PYTHONPATH="$PYTHONPATH:$(pwd)/NEMO/tests"
  • run python manage.py test tests --settings=test_settings