Skip to content

Latest commit

 

History

History
167 lines (136 loc) · 6.72 KB

code_guidelines.rst

File metadata and controls

167 lines (136 loc) · 6.72 KB

Code guidelines

Formatters and linters automatically enforce a specific code style and quality. They help you to focus on your actual task - the coding - without having to think about the code style.

When writing Python code for this project, please

Note

The listed formatters and linters offer plugins for many popular text editors and integrated development environments (IDEs). When using these plugins, your code is formatted and linted on the fly, so you don't have to run the commands yourself.

Note

If you have :ref:`set up pre-commit <set-up-pre-commit-label>`, the above formatters and linters check your code before every commit.

  • When writing a new script, make use of the script templates in the :file:`scripts/templates` directory.
  • If you import objects from other scripts into your current script, only import from scripts in the same directory. But generally try to avoid importing objects from other scripts. Better move the object you want to import from another script into the core package.
  • When writing a script, use :mod:`argparse` as command-line interface.
  • When dealing with a lot of data like MD trajectories, performance (speed and memory usage) counts. Make a good compromise between performance and code readability. As a guideline, scripts should be able to run on an average desktop PC.