Skip to content

Code conventions

Oscar Esteban edited this page Apr 3, 2017 · 2 revisions

General conventions:

Writing nipype workflows:

Deviations from PEP8:

  • Line width: 99 characters

Python 2 compatibility

In general, fmriprep has dropped support for Python 2. But we will keep some good practices to make it easier for potential contributors to send PRs with compatibility code:

  • New files: declare the utf-8 encoding in the header:
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
    # vi: set ft=python sts=4 ts=4 sw=4 et:
    
  • New files: first import should be from __future__:
    from __future__ import print_function, division, absolute_import, unicode_literals
    
Clone this wiki locally