Repository: mne-tools/mne-python

Issue:
Rename `master` branch
Hello,

amid the global [BLM protests](https://en.wikipedia.org/wiki/Black_Lives_Matter), it seems a number of free/open-source software projects are now [reconsidering](https://www.zdnet.com/article/github-to-replace-master-with-alternative-term-to-avoid-slavery-references/) the naming of their main source-code management branch, historically called `master` in `git`. Microsoft seems to be [actively working](https://twitter.com/natfriedman/status/1271253144442253312) on bringing out-of-the-box support for other naming schemes to GitHub.

Despite its widespread use in the contexts of software development and hardware interfaces, the term "master" **may** be considered offensive by some. While one could argue that this perception entirely disregards context, I would argue that nothing is lost by dropping the name. I would consider moving to a different name as a token of support for the struggles of ethnic minorities and marginalized people; and it would be a public display of some (granted, cheap, but still visible) efforts to actively embrace an inclusive community. Lastly I would argue that our Code of Conduct actually doesn't leave us much of a choice anyway, as it clearly [states](https://github.com/mne-tools/.github/blob/master/CODE_OF_CONDUCT.md#our-standards) we vow to use "welcoming and inclusive language". Now if the `master` term has been identified to be non-inclusive – regardless of whether **we** feel that this is true or not – it should be dropped.

Looking forward to reading your thoughts on this!

Best wishes,

–Richard



Discussion:
By all means change it if it makes people happy. GitHub will soon default to `main` anyway. However, I think that in this case the term master has nothing to do with master/slave (yes I know the BitKeeper background, but in a plain Git repo there is a master branch but no slave branch(es)). Same for blacklisting/whitelisting, which actually originates from the term black book (which were actual black books).

I'd only caution to wait until we know all implications of that name change. I've read that it can be non-trivial in some cases (e.g. it seems to be hard-coded for the docs), so let's do it only after GitHub releases detailed instructions how to do it.
Hi @cbrnr 
> However, I think that in this case the term master has nothing to do with master/slave (yes I know the BitKeeper background, but in a plain Git repo there is a master branch but no slave branch(es)). Same for blacklisting/whitelisting, which actually originates from the term black book (which were actual black books).

Yes I do agree, my perception is similar. But others seem to disagree, and I don't mind making a small change if that can help make them feel more welcome ☺️

> I'd only caution to wait until we know all implications of that name change. I've read that it can be non-trivial in some cases (e.g. it seems to be hard-coded for the docs), so let's do it only after GitHub releases detailed instructions how to do it.

Yes absolutely, just wanted to raise this question now to get a small discussion going / get an idea of what others think.


Internally I don't think this change would be too difficult, but we should wait until GitHub makes it easy to redirect branch names to do this (last I looked it was not possible to redirect individual branches, only entire repos). Projects that rely on using `https://github.com/mne-tools/mne-python/zipball/master` or similar should have an opportunity to change to the new naming rather than just having things suddenly break.
I am tempted to follow here. If core projects that are models for us do
this then we could follow.

Not directly related but I should probably rename the `time_viewer` selected as reference in `LinkViewer`:

https://github.com/mne-tools/mne-python/blob/master/mne/viz/_brain/_timeviewer.py#L1221-L1222
> Not directly related but I should probably rename the `time_viewer` selected as reference in `LinkViewer`:
> 
> https://github.com/mne-tools/mne-python/blob/master/mne/viz/_brain/_timeviewer.py#L1221-L1222

Heh. Do we have a good alternative? `main`, perhaps?
`main` or just simply `reference` should do the trick?
> `main` or just simply `reference` should do the trick?

How about
```python
        controller = self.time_viewers[0]  # select the first time viewer, which controls the scene
        value = controller.time_call.slider_rep.GetValue()
```
Feel free to rename, but master without slaves should be fine (because masters can also have apprentices).
Thanks all for the suggestions, I decided to rename into `leader` because it suits the behaviour perfectly. And sorry for the noise on the issue.
The Linux kernel developers just [decided](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=49decddd39e5f6132ccd7d9fdc3d7c470b0061bb) the use the following terms:

```
+For symbol names and documentation, avoid introducing new usage of
+'master / slave' (or 'slave' independent of 'master') and 'blacklist /
+whitelist'.
+
+Recommended replacements for 'master / slave' are:
+    '{primary,main} / {secondary,replica,subordinate}'
+    '{initiator,requester} / {target,responder}'
+    '{controller,host} / {device,worker,proxy}'
+    'leader / follower'
+    'director / performer'
+
+Recommended replacements for 'blacklist/whitelist' are:
+    'denylist / allowlist'
+    'blocklist / passlist'
+
+Exceptions for introducing new usage is to maintain a userspace ABI/API,
+or when updating code for an existing (as of 2020) hardware or protocol
+specification that mandates those terms. For new specifications
+translate specification usage of the terminology to the kernel coding
+standard where possible.
```
See https://github.com/github/renaming/
Just for reference, the VS Code Python Extension is chiming in now, too:
https://github.com/microsoft/vscode-python/issues/13645
Should we go for it? https://docs.github.com/en/github/administering-a-repository/renaming-a-branch
> Should we go for it? https://docs.github.com/en/github/administering-a-repository/renaming-a-branch

I just came here to ask the same, so: yes, let's do that!!
have you done with any other project ? with one with many forks like mne?

Let's not experiment with the mne-python repo

>


Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -99,7 +99,7 @@
 # The encoding of source files.
 # source_encoding = 'utf-8-sig'
 
-# The master toctree document.
+# The main toctree document.
 master_doc = 'index'
 
 # General information about the project.
diff --git a/mne/utils/docs.py b/mne/utils/docs.py
--- a/mne/utils/docs.py
+++ b/mne/utils/docs.py
@@ -2365,7 +2365,7 @@ def linkcode_resolve(domain, info):
         linespec = ""
 
     if 'dev' in mne.__version__:
-        kind = 'master'
+        kind = 'main'
     else:
         kind = 'maint/%s' % ('.'.join(mne.__version__.split('.')[:2]))
     return "http://github.com/mne-tools/mne-python/blob/%s/mne/%s%s" % (


Test patch:
diff --git a/mne/tests/test_morph.py b/mne/tests/test_morph.py
--- a/mne/tests/test_morph.py
+++ b/mne/tests/test_morph.py
@@ -778,7 +778,7 @@ def test_volume_labels_morph(tmpdir, sl, n_real, n_mri, n_orig):
     n_got_real = np.in1d(
         aseg_img.ravel(), [lut[name] for name in use_label_names]).sum()
     assert n_got_real == n_real
-    # - This was 291 on `master` before gh-5590
+    # - This was 291 on `main` before gh-5590
     # - Refactoring transforms it became 279 with a < 1e-8 change in vox_mri_t
     # - Dropped to 123 once nearest-voxel was used in gh-7653
     # - Jumped back up to 330 with morphing fixes actually correctly
@@ -791,7 +791,7 @@ def test_volume_labels_morph(tmpdir, sl, n_real, n_mri, n_orig):
             src[0]['interpolator'] = None
         img = stc.as_volume(src, mri_resolution=False)
         n_on = np.array(img.dataobj).astype(bool).sum()
-        # was 20 on `master` before gh-5590
+        # was 20 on `main` before gh-5590
         # then 44 before gh-7653, which took it back to 20
         assert n_on == n_orig
     # without the interpolator, this should fail
diff --git a/mne/utils/tests/test_fetching.py b/mne/utils/tests/test_fetching.py
--- a/mne/utils/tests/test_fetching.py
+++ b/mne/utils/tests/test_fetching.py
@@ -10,7 +10,7 @@
 @pytest.mark.timeout(60)
 @requires_good_network
 @pytest.mark.parametrize('url', (
-    'https://raw.githubusercontent.com/mne-tools/mne-python/master/README.rst',
+    'https://raw.githubusercontent.com/mne-tools/mne-python/main/README.rst',
 ))
 def test_fetch_file(url, tmpdir):
     """Test URL retrieval."""