We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
MAINT: Switch to setuptools_scm
See for example

https://github.com/LABSN/tdtpy/pull/20

It basically does the `.dev` and versions for us automatically based on tags.

I think we *do* want to write `_version.py` in order to avoid people needing `setuptools_scm` (and new-ish setuptools or whatever) for our released versions. This is how `tdtpy` does it above. But I haven't totally thought it through...

We could maybe also transition to a `pyproject.toml` while we're at it.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2011-2020 Alexandre Gramfort
4 # <alexandre.gramfort@inria.fr>
5 
6 import os
7 import os.path as op
8 
9 from setuptools import setup
10 
11 
12 def parse_requirements_file(fname):
13     requirements = list()
14     with open(fname, 'r') as fid:
15         for line in fid:
16             req = line.strip()
17             if req.startswith('#'):
18                 continue
19             # strip end-of-line comments
20             req = req.split('#', maxsplit=1)[0].strip()
21             requirements.append(req)
22     return requirements
23 
24 
25 # get the version (don't import mne here, so dependencies are not needed)
26 version = None
27 with open(op.join('mne', '_version.py'), 'r') as fid:
28     for line in (line.strip() for line in fid):
29         if line.startswith('__version__'):
30             version = line.split('=')[1].strip().strip('\'')
31             break
32 if version is None:
33     raise RuntimeError('Could not determine version')
34 
35 
36 DISTNAME = 'mne'
37 DESCRIPTION = 'MNE-Python project for MEG and EEG data analysis.'
38 MAINTAINER = 'Alexandre Gramfort'
39 MAINTAINER_EMAIL = 'alexandre.gramfort@inria.fr'
40 URL = 'https://mne.tools/dev/'
41 LICENSE = 'BSD-3-Clause'
42 DOWNLOAD_URL = 'http://github.com/mne-tools/mne-python'
43 VERSION = version
44 
45 
46 def package_tree(pkgroot):
47     """Get the submodule list."""
48     # Adapted from VisPy
49     path = op.dirname(__file__)
50     subdirs = [op.relpath(i[0], path).replace(op.sep, '.')
51                for i in os.walk(op.join(path, pkgroot))
52                if '__init__.py' in i[2]]
53     return sorted(subdirs)
54 
55 
56 if __name__ == "__main__":
57     if op.exists('MANIFEST'):
58         os.remove('MANIFEST')
59 
60     with open('README.rst', 'r') as fid:
61         long_description = fid.read()
62 
63     # data_dependencies is empty, but let's leave them so that we don't break
64     # people's workflows who did `pip install mne[data]`
65     install_requires = parse_requirements_file('requirements_base.txt')
66     data_requires = []
67     hdf5_requires = parse_requirements_file('requirements_hdf5.txt')
68     test_requires = (parse_requirements_file('requirements_testing.txt') +
69                      parse_requirements_file('requirements_testing_extra.txt'))
70     setup(name=DISTNAME,
71           maintainer=MAINTAINER,
72           include_package_data=True,
73           maintainer_email=MAINTAINER_EMAIL,
74           description=DESCRIPTION,
75           license=LICENSE,
76           url=URL,
77           version=VERSION,
78           download_url=DOWNLOAD_URL,
79           long_description=long_description,
80           long_description_content_type='text/x-rst',
81           zip_safe=False,  # the package can run out of an .egg file
82           classifiers=['Intended Audience :: Science/Research',
83                        'Intended Audience :: Developers',
84                        'License :: OSI Approved',
85                        'Programming Language :: Python',
86                        'Topic :: Software Development',
87                        'Topic :: Scientific/Engineering',
88                        'Operating System :: Microsoft :: Windows',
89                        'Operating System :: POSIX',
90                        'Operating System :: Unix',
91                        'Operating System :: MacOS',
92                        'Programming Language :: Python :: 3',
93                        ],
94           keywords='neuroscience neuroimaging MEG EEG ECoG fNIRS brain',
95           project_urls={
96               'Documentation': 'https://mne.tools/',
97               'Source': 'https://github.com/mne-tools/mne-python/',
98               'Tracker': 'https://github.com/mne-tools/mne-python/issues/',
99           },
100           platforms='any',
101           python_requires='>=3.7',
102           install_requires=install_requires,
103           extras_require={
104               'data': data_requires,
105               'hdf5': hdf5_requires,
106               'test': test_requires,
107           },
108           packages=package_tree('mne'),
109           package_data={'mne': [
110               op.join('data', 'eegbci_checksums.txt'),
111               op.join('data', '*.sel'),
112               op.join('data', 'icos.fif.gz'),
113               op.join('data', 'coil_def*.dat'),
114               op.join('data', 'helmets', '*.fif.gz'),
115               op.join('data', 'FreeSurferColorLUT.txt'),
116               op.join('data', 'image', '*gif'),
117               op.join('data', 'image', '*lout'),
118               op.join('data', 'fsaverage', '*.fif'),
119               op.join('channels', 'data', 'layouts', '*.lout'),
120               op.join('channels', 'data', 'layouts', '*.lay'),
121               op.join('channels', 'data', 'montages', '*.sfp'),
122               op.join('channels', 'data', 'montages', '*.txt'),
123               op.join('channels', 'data', 'montages', '*.elc'),
124               op.join('channels', 'data', 'neighbors', '*.mat'),
125               op.join('datasets', 'sleep_physionet', 'SHA1SUMS'),
126               op.join('datasets', '_fsaverage', '*.txt'),
127               op.join('datasets', '_infant', '*.txt'),
128               op.join('datasets', '_phantom', '*.txt'),
129               op.join('html', '*.js'),
130               op.join('html', '*.css'),
131               op.join('html_templates', 'repr', '*.jinja'),
132               op.join('html_templates', 'report', '*.jinja'),
133               op.join('icons', '*.svg'),
134               op.join('icons', '*.png'),
135               op.join('io', 'artemis123', 'resources', '*.csv'),
136               op.join('io', 'edf', 'gdf_encodes.txt')
137           ]},
138           entry_points={'console_scripts': [
139               'mne = mne.commands.utils:main',
140           ]})
141
```

Path: `mne/_version.py`
Content:
```
1 """The version number."""
2 # Authors: Eric Larson <larson.eric.d@gmail.com>
3 #
4 # License: BSD-3-Clause
5 
6 __version__ = '1.4.dev0'
7
```

Path: `mne/__init__.py`
Content:
```
1 """MNE software for MEG and EEG data analysis."""
2 
3 # PEP0440 compatible formatted version, see:
4 # https://www.python.org/dev/peps/pep-0440/
5 #
6 # Generic release markers:
7 #   X.Y
8 #   X.Y.Z   # For bugfix releases
9 #
10 # Admissible pre-release markers:
11 #   X.YaN   # Alpha release
12 #   X.YbN   # Beta release
13 #   X.YrcN  # Release Candidate
14 #   X.Y     # Final release
15 #
16 # Dev branch marker is: 'X.Y.devN' where N is an integer.
17 #
18 
19 from ._version import __version__
20 
21 # have to import verbose first since it's needed by many things
22 from .utils import (set_log_level, set_log_file, verbose, set_config,
23                     get_config, get_config_path, set_cache_dir,
24                     set_memmap_min_size, grand_average, sys_info, open_docs,
25                     use_log_level)
26 from .io.pick import (pick_types, pick_channels,
27                       pick_channels_regexp, pick_channels_forward,
28                       pick_types_forward, pick_channels_cov,
29                       pick_channels_evoked, pick_info,
30                       channel_type, channel_indices_by_type)
31 from .io.base import concatenate_raws
32 from .io.meas_info import create_info, Info
33 from .io.proj import Projection
34 from .io.kit import read_epochs_kit
35 from .io.eeglab import read_epochs_eeglab
36 from .io.reference import (set_eeg_reference, set_bipolar_reference,
37                            add_reference_channels)
38 from .io.what import what
39 from .bem import (make_sphere_model, make_bem_model, make_bem_solution,
40                   read_bem_surfaces, write_bem_surfaces, write_head_bem,
41                   read_bem_solution, write_bem_solution)
42 from .cov import (read_cov, write_cov, Covariance, compute_raw_covariance,
43                   compute_covariance, whiten_evoked, make_ad_hoc_cov)
44 from .event import (read_events, write_events, find_events, merge_events,
45                     pick_events, make_fixed_length_events, concatenate_events,
46                     find_stim_steps, AcqParserFIF, count_events)
47 from ._freesurfer import (head_to_mni, head_to_mri, read_talxfm,
48                           get_volume_labels_from_aseg, read_freesurfer_lut,
49                           vertex_to_mni, read_lta)
50 from .forward import (read_forward_solution, apply_forward, apply_forward_raw,
51                       average_forward_solutions, Forward,
52                       write_forward_solution, make_forward_solution,
53                       convert_forward_solution, make_field_map,
54                       make_forward_dipole, use_coil_def)
55 from .source_estimate import (read_source_estimate,
56                               SourceEstimate, VectorSourceEstimate,
57                               VolSourceEstimate, VolVectorSourceEstimate,
58                               MixedSourceEstimate, MixedVectorSourceEstimate,
59                               grade_to_tris,
60                               spatial_src_adjacency,
61                               spatial_tris_adjacency,
62                               spatial_dist_adjacency,
63                               spatial_inter_hemi_adjacency,
64                               spatio_temporal_src_adjacency,
65                               spatio_temporal_tris_adjacency,
66                               spatio_temporal_dist_adjacency,
67                               extract_label_time_course, stc_near_sensors)
68 from .surface import (read_surface, write_surface, decimate_surface, read_tri,
69                       get_head_surf, get_meg_helmet_surf, dig_mri_distances,
70                       warp_montage_volume, get_montage_volume_labels)
71 from .morph_map import read_morph_map
72 from .morph import (SourceMorph, read_source_morph, grade_to_vertices,
73                     compute_source_morph)
74 from .source_space import (read_source_spaces,
75                            write_source_spaces, setup_source_space,
76                            setup_volume_source_space, SourceSpaces,
77                            add_source_space_distances, morph_source_spaces,
78                            get_volume_labels_from_src)
79 from .annotations import (Annotations, read_annotations, annotations_from_events,
80                           events_from_annotations)
81 from .epochs import (BaseEpochs, Epochs, EpochsArray, read_epochs,
82                      concatenate_epochs, make_fixed_length_epochs)
83 from .evoked import (Evoked, EvokedArray, read_evokeds, write_evokeds,
84                      combine_evoked)
85 from .label import (read_label, label_sign_flip,
86                     write_label, stc_to_label, grow_labels, Label, split_label,
87                     BiHemiLabel, read_labels_from_annot, write_labels_to_annot,
88                     random_parcellation, morph_labels, labels_to_stc)
89 from .misc import parse_config, read_reject_parameters
90 from .coreg import (create_default_subject, scale_bem, scale_mri, scale_labels,
91                     scale_source_space)
92 from .transforms import (read_trans, write_trans,
93                          transform_surface_to, Transform)
94 from .proj import (read_proj, write_proj, compute_proj_epochs,
95                    compute_proj_evoked, compute_proj_raw, sensitivity_map)
96 from .dipole import read_dipole, Dipole, DipoleFixed, fit_dipole
97 from .channels import (equalize_channels, rename_channels, find_layout,
98                        read_vectorview_selection)
99 from .report import Report, open_report
100 
101 from .io import (read_epochs_fieldtrip, read_evoked_besa,
102                  read_evoked_fieldtrip, read_evokeds_mff)
103 from .rank import compute_rank
104 
105 from . import beamformer
106 from . import channels
107 from . import chpi
108 from . import commands
109 from . import coreg
110 from . import cuda
111 from . import datasets
112 from . import dipole
113 from . import epochs
114 from . import event
115 from . import io
116 from . import filter
117 from . import gui
118 from . import inverse_sparse
119 from . import minimum_norm
120 from . import preprocessing
121 from . import simulation
122 from . import stats
123 from . import surface
124 from . import time_frequency
125 from . import viz
126 from . import decoding
127 from . import export
128 
129 # initialize logging
130 set_log_level(None, False)
131 set_log_file()
132
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mne/__init__.py b/mne/__init__.py
--- a/mne/__init__.py
+++ b/mne/__init__.py
@@ -16,7 +16,14 @@
 # Dev branch marker is: 'X.Y.devN' where N is an integer.
 #
 
-from ._version import __version__
+try:
+    from importlib.metadata import version
+    __version__ = version("mne")
+except Exception:
+    try:
+        from ._version import __version__
+    except ImportError:
+        __version__ = '0.0.0'
 
 # have to import verbose first since it's needed by many things
 from .utils import (set_log_level, set_log_file, verbose, set_config,
diff --git a/mne/_version.py b/mne/_version.py
deleted file mode 100644
--- a/mne/_version.py
+++ /dev/null
@@ -1,6 +0,0 @@
-"""The version number."""
-# Authors: Eric Larson <larson.eric.d@gmail.com>
-#
-# License: BSD-3-Clause
-
-__version__ = '1.4.dev0'
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,17 +22,6 @@
     return requirements
 
 
-# get the version (don't import mne here, so dependencies are not needed)
-version = None
-with open(op.join('mne', '_version.py'), 'r') as fid:
-    for line in (line.strip() for line in fid):
-        if line.startswith('__version__'):
-            version = line.split('=')[1].strip().strip('\'')
-            break
-if version is None:
-    raise RuntimeError('Could not determine version')
-
-
 DISTNAME = 'mne'
 DESCRIPTION = 'MNE-Python project for MEG and EEG data analysis.'
 MAINTAINER = 'Alexandre Gramfort'
@@ -40,7 +29,6 @@
 URL = 'https://mne.tools/dev/'
 LICENSE = 'BSD-3-Clause'
 DOWNLOAD_URL = 'http://github.com/mne-tools/mne-python'
-VERSION = version
 
 
 def package_tree(pkgroot):
@@ -74,7 +62,6 @@
           description=DESCRIPTION,
           license=LICENSE,
           url=URL,
-          version=VERSION,
           download_url=DOWNLOAD_URL,
           long_description=long_description,
           long_description_content_type='text/x-rst',
@@ -100,6 +87,11 @@
           platforms='any',
           python_requires='>=3.7',
           install_requires=install_requires,
+          setup_requires=["setuptools>=45", "setuptools_scm>=6.2"],
+          use_scm_version={
+              "write_to": "mne/_version.py",
+              "version_scheme": "release-branch-semver",
+          },
           extras_require={
               'data': data_requires,
               'hdf5': hdf5_requires,

{"golden_diff": "diff --git a/mne/__init__.py b/mne/__init__.py\n--- a/mne/__init__.py\n+++ b/mne/__init__.py\n@@ -16,7 +16,14 @@\n # Dev branch marker is: 'X.Y.devN' where N is an integer.\n #\n \n-from ._version import __version__\n+try:\n+    from importlib.metadata import version\n+    __version__ = version(\"mne\")\n+except Exception:\n+    try:\n+        from ._version import __version__\n+    except ImportError:\n+        __version__ = '0.0.0'\n \n # have to import verbose first since it's needed by many things\n from .utils import (set_log_level, set_log_file, verbose, set_config,\ndiff --git a/mne/_version.py b/mne/_version.py\ndeleted file mode 100644\n--- a/mne/_version.py\n+++ /dev/null\n@@ -1,6 +0,0 @@\n-\"\"\"The version number.\"\"\"\n-# Authors: Eric Larson <larson.eric.d@gmail.com>\n-#\n-# License: BSD-3-Clause\n-\n-__version__ = '1.4.dev0'\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -22,17 +22,6 @@\n     return requirements\n \n \n-# get the version (don't import mne here, so dependencies are not needed)\n-version = None\n-with open(op.join('mne', '_version.py'), 'r') as fid:\n-    for line in (line.strip() for line in fid):\n-        if line.startswith('__version__'):\n-            version = line.split('=')[1].strip().strip('\\'')\n-            break\n-if version is None:\n-    raise RuntimeError('Could not determine version')\n-\n-\n DISTNAME = 'mne'\n DESCRIPTION = 'MNE-Python project for MEG and EEG data analysis.'\n MAINTAINER = 'Alexandre Gramfort'\n@@ -40,7 +29,6 @@\n URL = 'https://mne.tools/dev/'\n LICENSE = 'BSD-3-Clause'\n DOWNLOAD_URL = 'http://github.com/mne-tools/mne-python'\n-VERSION = version\n \n \n def package_tree(pkgroot):\n@@ -74,7 +62,6 @@\n           description=DESCRIPTION,\n           license=LICENSE,\n           url=URL,\n-          version=VERSION,\n           download_url=DOWNLOAD_URL,\n           long_description=long_description,\n           long_description_content_type='text/x-rst',\n@@ -100,6 +87,11 @@\n           platforms='any',\n           python_requires='>=3.7',\n           install_requires=install_requires,\n+          setup_requires=[\"setuptools>=45\", \"setuptools_scm>=6.2\"],\n+          use_scm_version={\n+              \"write_to\": \"mne/_version.py\",\n+              \"version_scheme\": \"release-branch-semver\",\n+          },\n           extras_require={\n               'data': data_requires,\n               'hdf5': hdf5_requires,\n", "issue": "MAINT: Switch to setuptools_scm\nSee for example\r\n\r\nhttps://github.com/LABSN/tdtpy/pull/20\r\n\r\nIt basically does the `.dev` and versions for us automatically based on tags.\r\n\r\nI think we *do* want to write `_version.py` in order to avoid people needing `setuptools_scm` (and new-ish setuptools or whatever) for our released versions. This is how `tdtpy` does it above. But I haven't totally thought it through...\r\n\r\nWe could maybe also transition to a `pyproject.toml` while we're at it.\n", "before_files": [{"content": "#!/usr/bin/env python\n\n# Copyright (C) 2011-2020 Alexandre Gramfort\n# <alexandre.gramfort@inria.fr>\n\nimport os\nimport os.path as op\n\nfrom setuptools import setup\n\n\ndef parse_requirements_file(fname):\n    requirements = list()\n    with open(fname, 'r') as fid:\n        for line in fid:\n            req = line.strip()\n            if req.startswith('#'):\n                continue\n            # strip end-of-line comments\n            req = req.split('#', maxsplit=1)[0].strip()\n            requirements.append(req)\n    return requirements\n\n\n# get the version (don't import mne here, so dependencies are not needed)\nversion = None\nwith open(op.join('mne', '_version.py'), 'r') as fid:\n    for line in (line.strip() for line in fid):\n        if line.startswith('__version__'):\n            version = line.split('=')[1].strip().strip('\\'')\n            break\nif version is None:\n    raise RuntimeError('Could not determine version')\n\n\nDISTNAME = 'mne'\nDESCRIPTION = 'MNE-Python project for MEG and EEG data analysis.'\nMAINTAINER = 'Alexandre Gramfort'\nMAINTAINER_EMAIL = 'alexandre.gramfort@inria.fr'\nURL = 'https://mne.tools/dev/'\nLICENSE = 'BSD-3-Clause'\nDOWNLOAD_URL = 'http://github.com/mne-tools/mne-python'\nVERSION = version\n\n\ndef package_tree(pkgroot):\n    \"\"\"Get the submodule list.\"\"\"\n    # Adapted from VisPy\n    path = op.dirname(__file__)\n    subdirs = [op.relpath(i[0], path).replace(op.sep, '.')\n               for i in os.walk(op.join(path, pkgroot))\n               if '__init__.py' in i[2]]\n    return sorted(subdirs)\n\n\nif __name__ == \"__main__\":\n    if op.exists('MANIFEST'):\n        os.remove('MANIFEST')\n\n    with open('README.rst', 'r') as fid:\n        long_description = fid.read()\n\n    # data_dependencies is empty, but let's leave them so that we don't break\n    # people's workflows who did `pip install mne[data]`\n    install_requires = parse_requirements_file('requirements_base.txt')\n    data_requires = []\n    hdf5_requires = parse_requirements_file('requirements_hdf5.txt')\n    test_requires = (parse_requirements_file('requirements_testing.txt') +\n                     parse_requirements_file('requirements_testing_extra.txt'))\n    setup(name=DISTNAME,\n          maintainer=MAINTAINER,\n          include_package_data=True,\n          maintainer_email=MAINTAINER_EMAIL,\n          description=DESCRIPTION,\n          license=LICENSE,\n          url=URL,\n          version=VERSION,\n          download_url=DOWNLOAD_URL,\n          long_description=long_description,\n          long_description_content_type='text/x-rst',\n          zip_safe=False,  # the package can run out of an .egg file\n          classifiers=['Intended Audience :: Science/Research',\n                       'Intended Audience :: Developers',\n                       'License :: OSI Approved',\n                       'Programming Language :: Python',\n                       'Topic :: Software Development',\n                       'Topic :: Scientific/Engineering',\n                       'Operating System :: Microsoft :: Windows',\n                       'Operating System :: POSIX',\n                       'Operating System :: Unix',\n                       'Operating System :: MacOS',\n                       'Programming Language :: Python :: 3',\n                       ],\n          keywords='neuroscience neuroimaging MEG EEG ECoG fNIRS brain',\n          project_urls={\n              'Documentation': 'https://mne.tools/',\n              'Source': 'https://github.com/mne-tools/mne-python/',\n              'Tracker': 'https://github.com/mne-tools/mne-python/issues/',\n          },\n          platforms='any',\n          python_requires='>=3.7',\n          install_requires=install_requires,\n          extras_require={\n              'data': data_requires,\n              'hdf5': hdf5_requires,\n              'test': test_requires,\n          },\n          packages=package_tree('mne'),\n          package_data={'mne': [\n              op.join('data', 'eegbci_checksums.txt'),\n              op.join('data', '*.sel'),\n              op.join('data', 'icos.fif.gz'),\n              op.join('data', 'coil_def*.dat'),\n              op.join('data', 'helmets', '*.fif.gz'),\n              op.join('data', 'FreeSurferColorLUT.txt'),\n              op.join('data', 'image', '*gif'),\n              op.join('data', 'image', '*lout'),\n              op.join('data', 'fsaverage', '*.fif'),\n              op.join('channels', 'data', 'layouts', '*.lout'),\n              op.join('channels', 'data', 'layouts', '*.lay'),\n              op.join('channels', 'data', 'montages', '*.sfp'),\n              op.join('channels', 'data', 'montages', '*.txt'),\n              op.join('channels', 'data', 'montages', '*.elc'),\n              op.join('channels', 'data', 'neighbors', '*.mat'),\n              op.join('datasets', 'sleep_physionet', 'SHA1SUMS'),\n              op.join('datasets', '_fsaverage', '*.txt'),\n              op.join('datasets', '_infant', '*.txt'),\n              op.join('datasets', '_phantom', '*.txt'),\n              op.join('html', '*.js'),\n              op.join('html', '*.css'),\n              op.join('html_templates', 'repr', '*.jinja'),\n              op.join('html_templates', 'report', '*.jinja'),\n              op.join('icons', '*.svg'),\n              op.join('icons', '*.png'),\n              op.join('io', 'artemis123', 'resources', '*.csv'),\n              op.join('io', 'edf', 'gdf_encodes.txt')\n          ]},\n          entry_points={'console_scripts': [\n              'mne = mne.commands.utils:main',\n          ]})\n", "path": "setup.py"}, {"content": "\"\"\"The version number.\"\"\"\n# Authors: Eric Larson <larson.eric.d@gmail.com>\n#\n# License: BSD-3-Clause\n\n__version__ = '1.4.dev0'\n", "path": "mne/_version.py"}, {"content": "\"\"\"MNE software for MEG and EEG data analysis.\"\"\"\n\n# PEP0440 compatible formatted version, see:\n# https://www.python.org/dev/peps/pep-0440/\n#\n# Generic release markers:\n#   X.Y\n#   X.Y.Z   # For bugfix releases\n#\n# Admissible pre-release markers:\n#   X.YaN   # Alpha release\n#   X.YbN   # Beta release\n#   X.YrcN  # Release Candidate\n#   X.Y     # Final release\n#\n# Dev branch marker is: 'X.Y.devN' where N is an integer.\n#\n\nfrom ._version import __version__\n\n# have to import verbose first since it's needed by many things\nfrom .utils import (set_log_level, set_log_file, verbose, set_config,\n                    get_config, get_config_path, set_cache_dir,\n                    set_memmap_min_size, grand_average, sys_info, open_docs,\n                    use_log_level)\nfrom .io.pick import (pick_types, pick_channels,\n                      pick_channels_regexp, pick_channels_forward,\n                      pick_types_forward, pick_channels_cov,\n                      pick_channels_evoked, pick_info,\n                      channel_type, channel_indices_by_type)\nfrom .io.base import concatenate_raws\nfrom .io.meas_info import create_info, Info\nfrom .io.proj import Projection\nfrom .io.kit import read_epochs_kit\nfrom .io.eeglab import read_epochs_eeglab\nfrom .io.reference import (set_eeg_reference, set_bipolar_reference,\n                           add_reference_channels)\nfrom .io.what import what\nfrom .bem import (make_sphere_model, make_bem_model, make_bem_solution,\n                  read_bem_surfaces, write_bem_surfaces, write_head_bem,\n                  read_bem_solution, write_bem_solution)\nfrom .cov import (read_cov, write_cov, Covariance, compute_raw_covariance,\n                  compute_covariance, whiten_evoked, make_ad_hoc_cov)\nfrom .event import (read_events, write_events, find_events, merge_events,\n                    pick_events, make_fixed_length_events, concatenate_events,\n                    find_stim_steps, AcqParserFIF, count_events)\nfrom ._freesurfer import (head_to_mni, head_to_mri, read_talxfm,\n                          get_volume_labels_from_aseg, read_freesurfer_lut,\n                          vertex_to_mni, read_lta)\nfrom .forward import (read_forward_solution, apply_forward, apply_forward_raw,\n                      average_forward_solutions, Forward,\n                      write_forward_solution, make_forward_solution,\n                      convert_forward_solution, make_field_map,\n                      make_forward_dipole, use_coil_def)\nfrom .source_estimate import (read_source_estimate,\n                              SourceEstimate, VectorSourceEstimate,\n                              VolSourceEstimate, VolVectorSourceEstimate,\n                              MixedSourceEstimate, MixedVectorSourceEstimate,\n                              grade_to_tris,\n                              spatial_src_adjacency,\n                              spatial_tris_adjacency,\n                              spatial_dist_adjacency,\n                              spatial_inter_hemi_adjacency,\n                              spatio_temporal_src_adjacency,\n                              spatio_temporal_tris_adjacency,\n                              spatio_temporal_dist_adjacency,\n                              extract_label_time_course, stc_near_sensors)\nfrom .surface import (read_surface, write_surface, decimate_surface, read_tri,\n                      get_head_surf, get_meg_helmet_surf, dig_mri_distances,\n                      warp_montage_volume, get_montage_volume_labels)\nfrom .morph_map import read_morph_map\nfrom .morph import (SourceMorph, read_source_morph, grade_to_vertices,\n                    compute_source_morph)\nfrom .source_space import (read_source_spaces,\n                           write_source_spaces, setup_source_space,\n                           setup_volume_source_space, SourceSpaces,\n                           add_source_space_distances, morph_source_spaces,\n                           get_volume_labels_from_src)\nfrom .annotations import (Annotations, read_annotations, annotations_from_events,\n                          events_from_annotations)\nfrom .epochs import (BaseEpochs, Epochs, EpochsArray, read_epochs,\n                     concatenate_epochs, make_fixed_length_epochs)\nfrom .evoked import (Evoked, EvokedArray, read_evokeds, write_evokeds,\n                     combine_evoked)\nfrom .label import (read_label, label_sign_flip,\n                    write_label, stc_to_label, grow_labels, Label, split_label,\n                    BiHemiLabel, read_labels_from_annot, write_labels_to_annot,\n                    random_parcellation, morph_labels, labels_to_stc)\nfrom .misc import parse_config, read_reject_parameters\nfrom .coreg import (create_default_subject, scale_bem, scale_mri, scale_labels,\n                    scale_source_space)\nfrom .transforms import (read_trans, write_trans,\n                         transform_surface_to, Transform)\nfrom .proj import (read_proj, write_proj, compute_proj_epochs,\n                   compute_proj_evoked, compute_proj_raw, sensitivity_map)\nfrom .dipole import read_dipole, Dipole, DipoleFixed, fit_dipole\nfrom .channels import (equalize_channels, rename_channels, find_layout,\n                       read_vectorview_selection)\nfrom .report import Report, open_report\n\nfrom .io import (read_epochs_fieldtrip, read_evoked_besa,\n                 read_evoked_fieldtrip, read_evokeds_mff)\nfrom .rank import compute_rank\n\nfrom . import beamformer\nfrom . import channels\nfrom . import chpi\nfrom . import commands\nfrom . import coreg\nfrom . import cuda\nfrom . import datasets\nfrom . import dipole\nfrom . import epochs\nfrom . import event\nfrom . import io\nfrom . import filter\nfrom . import gui\nfrom . import inverse_sparse\nfrom . import minimum_norm\nfrom . import preprocessing\nfrom . import simulation\nfrom . import stats\nfrom . import surface\nfrom . import time_frequency\nfrom . import viz\nfrom . import decoding\nfrom . import export\n\n# initialize logging\nset_log_level(None, False)\nset_log_file()\n", "path": "mne/__init__.py"}], "after_files": [{"content": "#!/usr/bin/env python\n\n# Copyright (C) 2011-2020 Alexandre Gramfort\n# <alexandre.gramfort@inria.fr>\n\nimport os\nimport os.path as op\n\nfrom setuptools import setup\n\n\ndef parse_requirements_file(fname):\n    requirements = list()\n    with open(fname, 'r') as fid:\n        for line in fid:\n            req = line.strip()\n            if req.startswith('#'):\n                continue\n            # strip end-of-line comments\n            req = req.split('#', maxsplit=1)[0].strip()\n            requirements.append(req)\n    return requirements\n\n\nDISTNAME = 'mne'\nDESCRIPTION = 'MNE-Python project for MEG and EEG data analysis.'\nMAINTAINER = 'Alexandre Gramfort'\nMAINTAINER_EMAIL = 'alexandre.gramfort@inria.fr'\nURL = 'https://mne.tools/dev/'\nLICENSE = 'BSD-3-Clause'\nDOWNLOAD_URL = 'http://github.com/mne-tools/mne-python'\n\n\ndef package_tree(pkgroot):\n    \"\"\"Get the submodule list.\"\"\"\n    # Adapted from VisPy\n    path = op.dirname(__file__)\n    subdirs = [op.relpath(i[0], path).replace(op.sep, '.')\n               for i in os.walk(op.join(path, pkgroot))\n               if '__init__.py' in i[2]]\n    return sorted(subdirs)\n\n\nif __name__ == \"__main__\":\n    if op.exists('MANIFEST'):\n        os.remove('MANIFEST')\n\n    with open('README.rst', 'r') as fid:\n        long_description = fid.read()\n\n    # data_dependencies is empty, but let's leave them so that we don't break\n    # people's workflows who did `pip install mne[data]`\n    install_requires = parse_requirements_file('requirements_base.txt')\n    data_requires = []\n    hdf5_requires = parse_requirements_file('requirements_hdf5.txt')\n    test_requires = (parse_requirements_file('requirements_testing.txt') +\n                     parse_requirements_file('requirements_testing_extra.txt'))\n    setup(name=DISTNAME,\n          maintainer=MAINTAINER,\n          include_package_data=True,\n          maintainer_email=MAINTAINER_EMAIL,\n          description=DESCRIPTION,\n          license=LICENSE,\n          url=URL,\n          download_url=DOWNLOAD_URL,\n          long_description=long_description,\n          long_description_content_type='text/x-rst',\n          zip_safe=False,  # the package can run out of an .egg file\n          classifiers=['Intended Audience :: Science/Research',\n                       'Intended Audience :: Developers',\n                       'License :: OSI Approved',\n                       'Programming Language :: Python',\n                       'Topic :: Software Development',\n                       'Topic :: Scientific/Engineering',\n                       'Operating System :: Microsoft :: Windows',\n                       'Operating System :: POSIX',\n                       'Operating System :: Unix',\n                       'Operating System :: MacOS',\n                       'Programming Language :: Python :: 3',\n                       ],\n          keywords='neuroscience neuroimaging MEG EEG ECoG fNIRS brain',\n          project_urls={\n              'Documentation': 'https://mne.tools/',\n              'Source': 'https://github.com/mne-tools/mne-python/',\n              'Tracker': 'https://github.com/mne-tools/mne-python/issues/',\n          },\n          platforms='any',\n          python_requires='>=3.7',\n          install_requires=install_requires,\n          setup_requires=[\"setuptools>=45\", \"setuptools_scm>=6.2\"],\n          use_scm_version={\n              \"write_to\": \"mne/_version.py\",\n              \"version_scheme\": \"release-branch-semver\",\n          },\n          extras_require={\n              'data': data_requires,\n              'hdf5': hdf5_requires,\n              'test': test_requires,\n          },\n          packages=package_tree('mne'),\n          package_data={'mne': [\n              op.join('data', 'eegbci_checksums.txt'),\n              op.join('data', '*.sel'),\n              op.join('data', 'icos.fif.gz'),\n              op.join('data', 'coil_def*.dat'),\n              op.join('data', 'helmets', '*.fif.gz'),\n              op.join('data', 'FreeSurferColorLUT.txt'),\n              op.join('data', 'image', '*gif'),\n              op.join('data', 'image', '*lout'),\n              op.join('data', 'fsaverage', '*.fif'),\n              op.join('channels', 'data', 'layouts', '*.lout'),\n              op.join('channels', 'data', 'layouts', '*.lay'),\n              op.join('channels', 'data', 'montages', '*.sfp'),\n              op.join('channels', 'data', 'montages', '*.txt'),\n              op.join('channels', 'data', 'montages', '*.elc'),\n              op.join('channels', 'data', 'neighbors', '*.mat'),\n              op.join('datasets', 'sleep_physionet', 'SHA1SUMS'),\n              op.join('datasets', '_fsaverage', '*.txt'),\n              op.join('datasets', '_infant', '*.txt'),\n              op.join('datasets', '_phantom', '*.txt'),\n              op.join('html', '*.js'),\n              op.join('html', '*.css'),\n              op.join('html_templates', 'repr', '*.jinja'),\n              op.join('html_templates', 'report', '*.jinja'),\n              op.join('icons', '*.svg'),\n              op.join('icons', '*.png'),\n              op.join('io', 'artemis123', 'resources', '*.csv'),\n              op.join('io', 'edf', 'gdf_encodes.txt')\n          ]},\n          entry_points={'console_scripts': [\n              'mne = mne.commands.utils:main',\n          ]})\n", "path": "setup.py"}, {"content": null, "path": "mne/_version.py"}, {"content": "\"\"\"MNE software for MEG and EEG data analysis.\"\"\"\n\n# PEP0440 compatible formatted version, see:\n# https://www.python.org/dev/peps/pep-0440/\n#\n# Generic release markers:\n#   X.Y\n#   X.Y.Z   # For bugfix releases\n#\n# Admissible pre-release markers:\n#   X.YaN   # Alpha release\n#   X.YbN   # Beta release\n#   X.YrcN  # Release Candidate\n#   X.Y     # Final release\n#\n# Dev branch marker is: 'X.Y.devN' where N is an integer.\n#\n\ntry:\n    from importlib.metadata import version\n    __version__ = version(\"mne\")\nexcept Exception:\n    try:\n        from ._version import __version__\n    except ImportError:\n        __version__ = '0.0.0'\n\n# have to import verbose first since it's needed by many things\nfrom .utils import (set_log_level, set_log_file, verbose, set_config,\n                    get_config, get_config_path, set_cache_dir,\n                    set_memmap_min_size, grand_average, sys_info, open_docs,\n                    use_log_level)\nfrom .io.pick import (pick_types, pick_channels,\n                      pick_channels_regexp, pick_channels_forward,\n                      pick_types_forward, pick_channels_cov,\n                      pick_channels_evoked, pick_info,\n                      channel_type, channel_indices_by_type)\nfrom .io.base import concatenate_raws\nfrom .io.meas_info import create_info, Info\nfrom .io.proj import Projection\nfrom .io.kit import read_epochs_kit\nfrom .io.eeglab import read_epochs_eeglab\nfrom .io.reference import (set_eeg_reference, set_bipolar_reference,\n                           add_reference_channels)\nfrom .io.what import what\nfrom .bem import (make_sphere_model, make_bem_model, make_bem_solution,\n                  read_bem_surfaces, write_bem_surfaces, write_head_bem,\n                  read_bem_solution, write_bem_solution)\nfrom .cov import (read_cov, write_cov, Covariance, compute_raw_covariance,\n                  compute_covariance, whiten_evoked, make_ad_hoc_cov)\nfrom .event import (read_events, write_events, find_events, merge_events,\n                    pick_events, make_fixed_length_events, concatenate_events,\n                    find_stim_steps, AcqParserFIF, count_events)\nfrom ._freesurfer import (head_to_mni, head_to_mri, read_talxfm,\n                          get_volume_labels_from_aseg, read_freesurfer_lut,\n                          vertex_to_mni, read_lta)\nfrom .forward import (read_forward_solution, apply_forward, apply_forward_raw,\n                      average_forward_solutions, Forward,\n                      write_forward_solution, make_forward_solution,\n                      convert_forward_solution, make_field_map,\n                      make_forward_dipole, use_coil_def)\nfrom .source_estimate import (read_source_estimate,\n                              SourceEstimate, VectorSourceEstimate,\n                              VolSourceEstimate, VolVectorSourceEstimate,\n                              MixedSourceEstimate, MixedVectorSourceEstimate,\n                              grade_to_tris,\n                              spatial_src_adjacency,\n                              spatial_tris_adjacency,\n                              spatial_dist_adjacency,\n                              spatial_inter_hemi_adjacency,\n                              spatio_temporal_src_adjacency,\n                              spatio_temporal_tris_adjacency,\n                              spatio_temporal_dist_adjacency,\n                              extract_label_time_course, stc_near_sensors)\nfrom .surface import (read_surface, write_surface, decimate_surface, read_tri,\n                      get_head_surf, get_meg_helmet_surf, dig_mri_distances,\n                      warp_montage_volume, get_montage_volume_labels)\nfrom .morph_map import read_morph_map\nfrom .morph import (SourceMorph, read_source_morph, grade_to_vertices,\n                    compute_source_morph)\nfrom .source_space import (read_source_spaces,\n                           write_source_spaces, setup_source_space,\n                           setup_volume_source_space, SourceSpaces,\n                           add_source_space_distances, morph_source_spaces,\n                           get_volume_labels_from_src)\nfrom .annotations import (Annotations, read_annotations, annotations_from_events,\n                          events_from_annotations)\nfrom .epochs import (BaseEpochs, Epochs, EpochsArray, read_epochs,\n                     concatenate_epochs, make_fixed_length_epochs)\nfrom .evoked import (Evoked, EvokedArray, read_evokeds, write_evokeds,\n                     combine_evoked)\nfrom .label import (read_label, label_sign_flip,\n                    write_label, stc_to_label, grow_labels, Label, split_label,\n                    BiHemiLabel, read_labels_from_annot, write_labels_to_annot,\n                    random_parcellation, morph_labels, labels_to_stc)\nfrom .misc import parse_config, read_reject_parameters\nfrom .coreg import (create_default_subject, scale_bem, scale_mri, scale_labels,\n                    scale_source_space)\nfrom .transforms import (read_trans, write_trans,\n                         transform_surface_to, Transform)\nfrom .proj import (read_proj, write_proj, compute_proj_epochs,\n                   compute_proj_evoked, compute_proj_raw, sensitivity_map)\nfrom .dipole import read_dipole, Dipole, DipoleFixed, fit_dipole\nfrom .channels import (equalize_channels, rename_channels, find_layout,\n                       read_vectorview_selection)\nfrom .report import Report, open_report\n\nfrom .io import (read_epochs_fieldtrip, read_evoked_besa,\n                 read_evoked_fieldtrip, read_evokeds_mff)\nfrom .rank import compute_rank\n\nfrom . import beamformer\nfrom . import channels\nfrom . import chpi\nfrom . import commands\nfrom . import coreg\nfrom . import cuda\nfrom . import datasets\nfrom . import dipole\nfrom . import epochs\nfrom . import event\nfrom . import io\nfrom . import filter\nfrom . import gui\nfrom . import inverse_sparse\nfrom . import minimum_norm\nfrom . import preprocessing\nfrom . import simulation\nfrom . import stats\nfrom . import surface\nfrom . import time_frequency\nfrom . import viz\nfrom . import decoding\nfrom . import export\n\n# initialize logging\nset_log_level(None, False)\nset_log_file()\n", "path": "mne/__init__.py"}]}