<commit_before>.. _using-git:


Contributing to *mne-python* source code
========================================

We are open to all types of contributions, from bugfixes to functionality
enhancements. mne-python_ is meant to be maintained by a community of labs,
and as such, we seek enhancements that will likely benefit a large proportion
of the users who use the package.

*Before starting new code*, we highly recommend opening an issue on
`mne-python GitHub`_ to discuss potential changes. Getting on the same
page as the maintainers about changes or enhancements before too much
coding is done saves everyone time and effort!

What you will need
------------------

#. A good python editor: Spyder_ IDE is suitable for those migrating from
   Matlab. EPD_ and Anaconda_ both ship Spyder and all its dependencies. For
   Mac users, TextMate_ and `Sublime Text`_ are good choices. `Sublime Text`_
   is available on all three major platforms. As always, Vim or Emacs will
   suffice as well.

#. Basic scientific tools in python: numpy_, scipy_, matplotlib_

#. Development related tools: nosetests_, coverage_, nose-timer_, mayavi_, sphinx_,
   pep8_, and pyflakes_

#. Other useful packages: pysurfer_, nitime_, pandas_, PIL_, PyDICOM_,
   joblib_, nibabel_, and scikit-learn_

#. `MNE command line utilities`_ and Freesurfer_ are optional but will allow you
   to make the best out of MNE. Yet they will require a Unix (Linux or Mac OS)
   system. If you are on Windows, you can install these applications inside a
   Unix virtual machine.

General code guidelines
-----------------------

* We highly recommend using a code editor that uses both `pep8`_ and
  `pyflakes`_, such as `spyder`_. Standard python style guidelines are
  followed, with very few exceptions.

  You can also manually check pyflakes and pep8 warnings as::

       pip install pyflakes
       pip install pep8
       pyflakes path/to/module.py
       pep8 path/to/module.py

  AutoPEP8 can then help you fix some of the easy redundant errors::

       pip install autopep8
       autopep8 path/to/pep8.py

* mne-python adheres to the same docstring formatting as seen on
  `numpy style`_.
  New public functions should have all variables defined.

* New functionality should be covered by appropriate tests, e.g. a method in
  ``mne/evoked.py`` should have a corresponding test in
  ``mne/tests/test_evoked.py``. You can use the ``coverage`` module in
  conjunction with ``nosetests`` (nose can automatically determine the code
  coverage if ``coverage`` is installed) to see how well new code is covered.
  The ambition is to achieve around 85% coverage with tests.

* After changes have been made, **ensure all tests pass**. This can be done
  by running the following from the ``mne-python`` root directory::

     make

  To run individual tests, you can also run any of the following::

     make clean
     make inplace
     make test-doc
     make inplace
     nosetests

  To explicitly download and extract the `mne-python sample dataset`_ (~320 MB)
  run::

     make testing-data

  Alternativly::

     python -c "import mne; mne.datasets.testing.data_path(verbose=True)"

  downloads the test data as well. Having a complete sample dataset is
  necessary for running some of the tests and nearly all of the examples.

  You can also run ``nosetests -x`` to have nose stop as soon as a failed
  test is found, or run e.g., ``nosetests mne/tests/test_event.py`` to run
  a specific test. In addition, one can run individual tests from python::<commit_msg>tiny rephrase<commit_after>.. _using-git:


Contributing to *mne-python* source code
========================================

We are open to all types of contributions, from bugfixes to functionality
enhancements. mne-python_ is meant to be maintained by a community of labs,
and as such, we seek enhancements that will likely benefit a large proportion
of the users who use the package.

*Before starting new code*, we highly recommend opening an issue on
`mne-python GitHub`_ to discuss potential changes. Getting on the same
page as the maintainers about changes or enhancements before too much
coding is done saves everyone time and effort!

What you will need
------------------

#. A good python editor: Spyder_ IDE is suitable for those migrating from
   Matlab. EPD_ and Anaconda_ both ship Spyder and all its dependencies. For
   Mac users, TextMate_ and `Sublime Text`_ are good choices. `Sublime Text`_
   is available on all three major platforms. As always, Vim or Emacs will
   suffice as well.

#. Basic scientific tools in python: numpy_, scipy_, matplotlib_

#. Development related tools: nosetests_, coverage_, nose-timer_, mayavi_, sphinx_,
   pep8_, and pyflakes_

#. Other useful packages: pysurfer_, nitime_, pandas_, PIL_, PyDICOM_,
   joblib_, nibabel_, and scikit-learn_

#. `MNE command line utilities`_ and Freesurfer_ are optional but will allow you
   to make the best out of MNE. Yet they will require a Unix (Linux or Mac OS)
   system. If you are on Windows, you can install these applications inside a
   Unix virtual machine.

General code guidelines
-----------------------

* We highly recommend using a code editor that uses both `pep8`_ and
  `pyflakes`_, such as `spyder`_. Standard python style guidelines are
  followed, with very few exceptions.

  You can also manually check pyflakes and pep8 warnings as::

       pip install pyflakes
       pip install pep8
       pyflakes path/to/module.py
       pep8 path/to/module.py

  AutoPEP8 can then help you fix some of the easy redundant errors::

       pip install autopep8
       autopep8 path/to/pep8.py

* mne-python adheres to the same docstring formatting as seen on
  `numpy style`_.
  New public functions should have all variables defined.

* New functionality should be covered by appropriate tests, e.g. a method in
  ``mne/evoked.py`` should have a corresponding test in
  ``mne/tests/test_evoked.py``. You can use the ``coverage`` module in
  conjunction with ``nosetests`` (nose can automatically determine the code
  coverage if ``coverage`` is installed) to see how well new code is covered.
  The ambition is to achieve around 85% coverage with tests.

* After changes have been made, **ensure all tests pass**. This can be done
  by running the following from the ``mne-python`` root directory::

     make

  To run individual tests, you can also run any of the following::

     make clean
     make inplace
     make test-doc
     make inplace
     nosetests

  To explicitly download and extract the mne-python testing dataset (~320 MB)
  run::

     make testing-data

  Alternatively::

     python -c "import mne; mne.datasets.testing.data_path(verbose=True)"

  downloads the test data as well. Having a complete testing dataset is
  necessary for running the tests. To run the examples you'll need
  the `mne-python sample dataset`_ which is automatically downloaded
  when running an example for the first time.

  You can also run ``nosetests -x`` to have nose stop as soon as a failed
  test is found, or run e.g., ``nosetests mne/tests/test_event.py`` to run
  a specific test. In addition, one can run individual tests from python::
{'fraction_non_alphanumeric': 0.07840688315292811, 'fraction_numerical': 0.0038856508465167916, 'mean_word_length': 3.4987515605493136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7361823', 'n_tokens_mistral': 2040, 'n_tokens_neox': 1953, 'n_words': 1000}