You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
updated line length in code contrib section (#348)
* updated line length in code contrib section
- fix#347
- add note on black
* trimmed trailing whitespace
* revert back to 79 chars as default
* encouraged use of darker instead of black
* Update doc/source/contributing_code.rst
Co-authored-by: Lily Wang <[email protected]>
---------
Co-authored-by: Lily Wang <[email protected]>
Copy file name to clipboardExpand all lines: doc/source/contributing_code.rst
+18-3Lines changed: 18 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -397,8 +397,8 @@ Code formatting in Python
397
397
398
398
MDAnalysis is a project with a long history and many contributors; it hasn't used a consistent coding style. Since version 0.11.0, we are trying to update all the code to conform with `PEP8`_. Our strategy is to update the style every time we touch an old function and thus switch to `PEP8`_ continuously.
399
399
400
-
**Important requirements (from PEP8):**
401
-
- keep line length to **79 characters or less**; break long lines sensibly
400
+
**Important requirements (from PEP8)**:
401
+
- keep line length to **79 characters or less**; break long lines sensibly although for readability we may allow longer lines
402
402
- indent with **spaces** and use **4 spaces per level**
403
403
- naming:
404
404
@@ -408,6 +408,7 @@ MDAnalysis is a project with a long history and many contributors; it hasn't use
408
408
We recommend that you use a Python Integrated Development Environment (IDE) (`PyCharm`_ and others) or external tools like `flake8`_ for code linting. For integration of external tools with emacs and vim, check out `elpy`_ (emacs) and `python-mode`_ (vim).
409
409
410
410
To apply the code formatting in an automated way, you can also use code formatters. External tools include `autopep8`_ and `yapf`_. Most IDEs either have their own code formatter or will work with one of the above through plugins.
411
+
See :ref:`format-darker` for notes on maintaining code style compliance with existing tools.
MDAnalysis does *not* currently use the popular `black`_ code formatter across the whole project, therefore please consider the following rules:
522
+
523
+
* **Do not run** ``black`` on an existing file that you are editing. This makes the diff for the PR very difficult to read. Instead use ``darker`` as explained above to only reformat your changes.
524
+
* You *may* run ``black`` on a *new file* that you are adding to the code base.
525
+
526
+
For an ongoing discussion (which you are welcome to join) see `issue #2450`_.
0 commit comments