-
Notifications
You must be signed in to change notification settings - Fork 0
Coding SOP
Standards and guidelines for writing code in the Voytek lab.
New python code should be written in Python3 (current version 3.6) unless there is specific reason to use an older version.
The guidelines mentioned below are also covered in more depth in the shablona template, which also provides a standardized template to organizing code.
Code should be written to abide by PEP8. Use of a lintr is recommended to ensure PEP8 compliance.
Code must be documented! Use numpy docs.
As a first pass, code should include 'smoke tests' - that is, simple test that ensure the code at least run, but does not necessarily extensively test all features nor the validity of all outputs.
More mature code should include 'unit tests', in which each separable unit of code is tested, both for execution, and for the validity of the outputs. This will likely include using synthetic data, on which the appropriate results can be known.
Tests in Python should use pytest.
Before releasing a module or update, run through the API checklist, and check for compliance: http://python.apichecklist.com
To avoid package bloat, new features should preferentially be integrated with existing modules, rather than as separate entities. For example, code operating on time-series neural data should be merged with neurodsp, unless there is a clear reason to instead have a stand-alone tool.
New features to existing packages, or new packages, should include tutorials, in the form of Jupyter notebooks, demonstrating the use of the tool.
If code is to be more formally released, it should be indexed on PYPI - a guide on how to do so is available here.
Keep the README up to date, it should always specify:
- continuous integration coverage and module status
- install instructions
- dependencies (including python version)
- examples of code use and outputs
If and when relevant / possible, choose to use standardized data formats. For EEG/MEG/ECoG, this means the BIDS, and relevant extensions, and for other electrophys / local field potential data, consider neurodata without borders. Wherever possible / relevant, tools developed should have I/O orientied to these formats in particular.