Repository: repobee/repobee

Issue:
Change the default section header to `repobee` instead of `DEFAULTS`
It makes more sense, and is less easy to confuse with `DEFAULT`, which has a special meaning.

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/repobee/repobee/pull/535?src=pr&el=h1) Report
> Merging [#535](https://codecov.io/gh/repobee/repobee/pull/535?src=pr&el=desc) into [master](https://codecov.io/gh/repobee/repobee/commit/03c8971cb3a6ab9276d99af987bcd6139026a373&el=desc) will **decrease** coverage by `3.74%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/repobee/repobee/pull/535/graphs/tree.svg?width=650&height=150&src=pr&token=5vOKgkphZe)](https://codecov.io/gh/repobee/repobee/pull/535?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master     #535      +/-   ##
==========================================
- Coverage   91.92%   88.18%   -3.75%     
==========================================
  Files          47       47              
  Lines        2478     2463      -15     
  Branches      407      405       -2     
==========================================
- Hits         2278     2172     -106     
- Misses        154      241      +87     
- Partials       46       50       +4     
```


| [Impacted Files](https://codecov.io/gh/repobee/repobee/pull/535?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/\_repobee/config.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NvbmZpZy5weQ==) | `100.00% <100.00%> (ø)` | |
| [src/\_repobee/constants.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NvbnN0YW50cy5weQ==) | `100.00% <100.00%> (ø)` | |
| [src/\_repobee/ext/defaults/configwizard.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2V4dC9kZWZhdWx0cy9jb25maWd3aXphcmQucHk=) | `97.29% <100.00%> (ø)` | |
| [src/\_repobee/ext/gitlab.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2V4dC9naXRsYWIucHk=) | `63.86% <0.00%> (-28.56%)` | :arrow_down: |
| [src/\_repobee/cli/parsing.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NsaS9wYXJzaW5nLnB5) | `86.57% <0.00%> (-5.37%)` | :arrow_down: |
| [src/\_repobee/git.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2dpdC5weQ==) | `96.62% <0.00%> (-3.38%)` | :arrow_down: |
| [src/\_repobee/command/repos.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2NvbW1hbmQvcmVwb3MucHk=) | `91.80% <0.00%> (-3.28%)` | :arrow_down: |
| [src/repobee\_plug/cli/\_corecommand.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL3JlcG9iZWVfcGx1Zy9jbGkvX2NvcmVjb21tYW5kLnB5) | `92.30% <0.00%> (-0.20%)` | :arrow_down: |
| [src/\_repobee/ext/defaults/github.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL19yZXBvYmVlL2V4dC9kZWZhdWx0cy9naXRodWIucHk=) | `90.29% <0.00%> (-0.11%)` | :arrow_down: |
| [src/repobee\_plug/\_pluginmeta.py](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree#diff-c3JjL3JlcG9iZWVfcGx1Zy9fcGx1Z2lubWV0YS5weQ==) | `97.93% <0.00%> (-0.05%)` | :arrow_down: |
| ... and [4 more](https://codecov.io/gh/repobee/repobee/pull/535/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/repobee/repobee/pull/535?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/repobee/repobee/pull/535?src=pr&el=footer). Last update [03c8971...9ccaac4](https://codecov.io/gh/repobee/repobee/pull/535?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/docs/configuration.rst b/docs/configuration.rst
index 5d0393f..679b3e8 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -38,7 +38,7 @@ consequence, a single organization).
 
 .. code-block:: bash
 
-    [DEFAULTS]
+    [repobee]
     base_url = https://some-api-v3-url
     user = YOUR_USERNAME
     org_name = ORGANIZATION_NAME
@@ -48,7 +48,7 @@ consequence, a single organization).
 
 .. important::
 
-    If the configuration file exists, it *must* contain the ``[DEFAULTS]``
+    If the configuration file exists, it *must* contain the ``[repobee]``
     header. This is to minimize the risk of misconfiguration by novice users.
 
 **To find out where to place the configuration file (and what to name it)**,
@@ -65,6 +65,6 @@ details.
 .. note::
 
     You can run ``repobee verify-settings`` to verify the basic configuration.
-    This will check the most important settings configurable in ``DEFAULTS``.
+    This will check the most important settings configurable in ``repobee``.
 
 .. _`GitHub access token docs`: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index 268d9d6..9e51b19 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -76,7 +76,7 @@ has defaults for at least the following:
 .. code-block:: bash
    :caption: config.ini
 
-   [DEFAULTS]
+   [repobee]
    base_url = https://some-enterprise-host/api/v3
    user = slarse
    org_name = repobee-demo
@@ -113,7 +113,7 @@ that you got everything correctly.
     [INFO] Found valid config file at /home/slarse/.config/repobee/config.ini
     [INFO]
     ----------------BEGIN CONFIG FILE-----------------
-    [DEFAULTS]
+    [repobee]
     base_url = https://some-enterprise-host/api/v3
     user = slarse
     org_name = repobee-demo
diff --git a/docs/plugins.rst b/docs/plugins.rst
index 2155e44..550a3a0 100644
--- a/docs/plugins.rst
+++ b/docs/plugins.rst
@@ -105,7 +105,7 @@ example of using the builtins_ ``javac`` and ``pylint``.
 
 .. code-block:: bash
 
-    [DEFAULTS]
+    [repobee]
     plugins = javac, pylint
 
 Like with all other configuration values, they are only used if no command line
@@ -198,7 +198,7 @@ the ``[javac]`` section. Example:
 
 .. code-block:: bash
 
-    [DEFAULTS]
+    [repobee]
     plugins = javac
 
     [javac]
@@ -231,7 +231,7 @@ define some defaults:
 
 .. code-block:: bash
 
-    [DEFAULTS]
+    [repobee]
     plugins = junit4
 
     [junit4]
@@ -241,10 +241,10 @@ define some defaults:
 
 .. important::
 
-    If the configuration file exists, it *must* contain the ``[DEFAULTS]``
+    If the configuration file exists, it *must* contain the ``[repobee]``
     header, even if you don't put anything in that section. This is to minimize
     the risk of subtle misconfiguration errors by novice users. If you only
-    want to configure plugins, just add the ``[DEFAULTS]`` header by itself,
+    want to configure plugins, just add the ``[repobee]`` header by itself,
     without options, to meet this requirement.
 
 .. _repobee-junit4: https://github.com/repobee/repobee-junit4
diff --git a/requirements/app.txt b/requirements/app.txt
index 661e660..4c4b556 100644
--- a/requirements/app.txt
+++ b/requirements/app.txt
@@ -2,5 +2,5 @@ appdirs
 daiquiri
 pygithub
 colored
-python-gitlab==1.15.0
+python-gitlab==2.4.0
 pluggy==0.13.1
diff --git a/setup.py b/setup.py
index 7a9a005..91494ce 100644
--- a/setup.py
+++ b/setup.py
@@ -43,7 +43,7 @@ required = [
     "daiquiri",
     "pygithub",
     "colored",
-    "python-gitlab==1.15.0",
+    "python-gitlab==2.4.0",
     "pluggy>=0.13.1",
 ]
 
diff --git a/src/_repobee/config.py b/src/_repobee/config.py
index b3f8eb9..22d02f7 100644
--- a/src/_repobee/config.py
+++ b/src/_repobee/config.py
@@ -81,7 +81,7 @@ def get_plugin_names(config_file: Union[str, pathlib.Path]) -> List[str]:
         return []
     config = _read_config(config_file)
     plugin_string = config.get(
-        constants.DEFAULTS_SECTION_HDR, "plugins", fallback=""
+        constants.CORE_SECTION_HDR, "plugins", fallback=""
     )
     return [name.strip() for name in plugin_string.split(",") if name]
 
@@ -132,7 +132,7 @@ def _read_defaults(config_file: pathlib.Path) -> dict:
     token = os.getenv(constants.TOKEN_ENV)
     if not config_file.is_file():
         return {} if not token else dict(token=token)
-    defaults = dict(_read_config(config_file)[constants.DEFAULTS_SECTION_HDR])
+    defaults = dict(_read_config(config_file)[constants.CORE_SECTION_HDR])
     if token:
         if defaults.get("token"):
             LOGGER.warning(
@@ -150,10 +150,10 @@ def _read_config(config_file: pathlib.Path) -> configparser.ConfigParser:
     except configparser.MissingSectionHeaderError:
         pass  # handled by the next check
 
-    if constants.DEFAULTS_SECTION_HDR not in config_parser:
+    if constants.CORE_SECTION_HDR not in config_parser:
         raise exception.FileError(
             "config file at '{!s}' does not contain the required "
-            "[DEFAULTS] header".format(config_file)
+            "[repobee] header".format(config_file)
         )
 
     return config_parser
diff --git a/src/_repobee/constants.py b/src/_repobee/constants.py
index daf0e59..79ee656 100644
--- a/src/_repobee/constants.py
+++ b/src/_repobee/constants.py
@@ -22,7 +22,7 @@ LOG_DIR = pathlib.Path(
         appname=_repobee._external_package_name, appauthor=_repobee.__author__
     )
 )
-DEFAULTS_SECTION_HDR = "DEFAULTS"
+CORE_SECTION_HDR = "repobee"
 DEFAULT_CONFIG_FILE = CONFIG_DIR / "config.ini"
 assert DEFAULT_CONFIG_FILE.is_absolute()
 
diff --git a/src/_repobee/ext/defaults/configwizard.py b/src/_repobee/ext/defaults/configwizard.py
index eaab7d8..99db987 100644
--- a/src/_repobee/ext/defaults/configwizard.py
+++ b/src/_repobee/ext/defaults/configwizard.py
@@ -56,8 +56,8 @@ def callback(args: argparse.Namespace, api: plug.API) -> None:
     os.makedirs(
         str(constants.DEFAULT_CONFIG_FILE.parent), mode=0o700, exist_ok=True
     )
-    if constants.DEFAULTS_SECTION_HDR not in parser:
-        parser.add_section(constants.DEFAULTS_SECTION_HDR)
+    if constants.CORE_SECTION_HDR not in parser:
+        parser.add_section(constants.CORE_SECTION_HDR)
 
     LOGGER.info("Welcome to the configuration wizard!")
     LOGGER.info("Type defaults for the options when prompted.")
@@ -69,11 +69,11 @@ def callback(args: argparse.Namespace, api: plug.API) -> None:
     LOGGER.info("Current defaults are shown in brackets [].")
     for option in constants.ORDERED_CONFIGURABLE_ARGS:
         prompt = "Enter default for '{}': [{}] ".format(
-            option, parser[constants.DEFAULTS_SECTION_HDR].get(option, "")
+            option, parser[constants.CORE_SECTION_HDR].get(option, "")
         )
         default = input(prompt)
         if default:
-            parser[constants.DEFAULTS_SECTION_HDR][option] = default
+            parser[constants.CORE_SECTION_HDR][option] = default
 
     with open(
         str(constants.DEFAULT_CONFIG_FILE),


Test patch:
diff --git a/tests/integration_tests/README.md b/tests/integration_tests/README.md
index 9ae85dc..d9c1c84 100644
--- a/tests/integration_tests/README.md
+++ b/tests/integration_tests/README.md
@@ -83,7 +83,7 @@ connect to the GitLab instance at `https://gitlab.integrationtest.local`.
 Replace `<TOKEN>` with [this token](token).
 
 ```
-[DEFAULTS]
+[repobee]
 base_url = https://gitlab.integrationtest.local
 token = <TOKEN>
 org_name = repobee-testing
diff --git a/tests/unit_tests/repobee/conftest.py b/tests/unit_tests/repobee/conftest.py
index 32a81c5..896d0be 100644
--- a/tests/unit_tests/repobee/conftest.py
+++ b/tests/unit_tests/repobee/conftest.py
@@ -164,7 +164,7 @@ _config_master_org = "master_org_name = {}".format(constants.MASTER_ORG_NAME)
 def config_missing_option(request, empty_config_mock, students_file):
     missing_option = request.param
 
-    config_contents = ["[DEFAULTS]"]
+    config_contents = ["[repobee]"]
     if not missing_option == "--bu":
         config_contents.append(_config_base)
     if not missing_option == "-o":
@@ -186,7 +186,7 @@ def config_mock(empty_config_mock, students_file):
     """Fixture with a pre-filled config file."""
     config_contents = os.linesep.join(
         [
-            "[DEFAULTS]",
+            "[repobee]",
             "base_url = {}".format(constants.BASE_URL),
             "user = {}".format(constants.USER),
             "org_name = {}".format(constants.ORG_NAME),
diff --git a/tests/unit_tests/repobee/plugin_tests/test_configwizard.py b/tests/unit_tests/repobee/plugin_tests/test_configwizard.py
index 07ec73a..a452941 100644
--- a/tests/unit_tests/repobee/plugin_tests/test_configwizard.py
+++ b/tests/unit_tests/repobee/plugin_tests/test_configwizard.py
@@ -53,9 +53,7 @@ def test_enters_values_if_config_file_exists_and_user_enters_yes(
     confparser.read(str(config_mock))
 
     for key, value in defaults_options.items():
-        assert (
-            confparser[_repobee.constants.DEFAULTS_SECTION_HDR][key] == value
-        )
+        assert confparser[_repobee.constants.CORE_SECTION_HDR][key] == value
 
 
 def test_enters_values_without_continue_prompt_if_no_config_exists(
@@ -73,9 +71,7 @@ def test_enters_values_without_continue_prompt_if_no_config_exists(
     confparser.read(str(config_mock))
 
     for key, value in defaults_options.items():
-        assert (
-            confparser[_repobee.constants.DEFAULTS_SECTION_HDR][key] == value
-        )
+        assert confparser[_repobee.constants.CORE_SECTION_HDR][key] == value
 
 
 def test_skips_empty_values(empty_config_mock, defaults_options):
@@ -99,13 +95,9 @@ def test_skips_empty_values(empty_config_mock, defaults_options):
     confparser = configparser.ConfigParser()
     confparser.read(str(empty_config_mock))
 
-    assert (
-        empty_option not in confparser[_repobee.constants.DEFAULTS_SECTION_HDR]
-    )
+    assert empty_option not in confparser[_repobee.constants.CORE_SECTION_HDR]
     for key, value in defaults_options.items():
-        assert (
-            confparser[_repobee.constants.DEFAULTS_SECTION_HDR][key] == value
-        )
+        assert confparser[_repobee.constants.CORE_SECTION_HDR][key] == value
 
 
 def test_retains_values_that_are_not_specified(config_mock, defaults_options):
@@ -137,7 +129,7 @@ def test_retains_values_that_are_not_specified(config_mock, defaults_options):
     empty_option = list(defaults_options.keys())[3]
     defaults_options[empty_option] = ""
     expected_retained_default = confparser[
-        _repobee.constants.DEFAULTS_SECTION_HDR
+        _repobee.constants.CORE_SECTION_HDR
     ][empty_option]
 
     # act
@@ -152,11 +144,11 @@ def test_retains_values_that_are_not_specified(config_mock, defaults_options):
     parser.read(str(config_mock))
 
     assert (
-        parser[_repobee.constants.DEFAULTS_SECTION_HDR][empty_option]
+        parser[_repobee.constants.CORE_SECTION_HDR][empty_option]
         == expected_retained_default
     )
     for option, value in defaults_options.items():
-        assert parser[_repobee.constants.DEFAULTS_SECTION_HDR][option] == value
+        assert parser[_repobee.constants.CORE_SECTION_HDR][option] == value
     for option, value in plugin_options.items():
         assert parser[plugin_section][option] == value
 
diff --git a/tests/unit_tests/repobee/test_config.py b/tests/unit_tests/repobee/test_config.py
index 7e88fa5..55b0230 100644
--- a/tests/unit_tests/repobee/test_config.py
+++ b/tests/unit_tests/repobee/test_config.py
@@ -30,7 +30,7 @@ class TestGetConfiguredDefaults:
     def test_get_configured_defaults_empty_file(self, empty_config_mock):
         with pytest.raises(exception.FileError) as exc_info:
             config.get_configured_defaults(str(empty_config_mock))
-        assert "does not contain the required [DEFAULTS] header" in str(
+        assert "does not contain the required [repobee] header" in str(
             exc_info.value
         )
 
@@ -61,7 +61,7 @@ class TestGetConfiguredDefaults:
         invalid_key = "not_valid_key"
         config_contents = os.linesep.join(
             [
-                "[{}]".format(_repobee.constants.DEFAULTS_SECTION_HDR),
+                "[{}]".format(_repobee.constants.CORE_SECTION_HDR),
                 "base_url = {}".format(BASE_URL),
                 "user = {}".format(USER),
                 "org_name = {}".format(ORG_NAME),
@@ -98,7 +98,7 @@ class TestGetConfiguredDefaults:
         with pytest.raises(exception.FileError) as exc_info:
             config.get_configured_defaults(str(empty_config_mock))
 
-        assert "does not contain the required [DEFAULTS] header" in str(
+        assert "does not contain the required [repobee] header" in str(
             exc_info.value
         )
 
@@ -126,7 +126,7 @@ class TestGetPluginNames:
     ):
         contents = os.linesep.join(
             [
-                "[{}]".format(_repobee.constants.DEFAULTS_SECTION_HDR),
+                "[{}]".format(_repobee.constants.CORE_SECTION_HDR),
                 "plugins = " + plugins_string,
             ]
         )
@@ -177,7 +177,7 @@ class TestCheckConfigIntegrity:
         empty_config_mock.write(
             os.linesep.join(
                 [
-                    "[{}]".format(_repobee.constants.DEFAULTS_SECTION_HDR),
+                    "[{}]".format(_repobee.constants.CORE_SECTION_HDR),
                     "user = someone",
                     "option = value",
                 ]
@@ -198,7 +198,7 @@ class TestCheckConfigIntegrity:
         empty_config_mock.write(
             os.linesep.join(
                 [
-                    "[{}]".format(_repobee.constants.DEFAULTS_SECTION_HDR),
+                    "[{}]".format(_repobee.constants.CORE_SECTION_HDR),
                     "user = someone",
                     "base_url",
                     "org_name = cool",
diff --git a/tests/unit_tests/repobee/test_main.py b/tests/unit_tests/repobee/test_main.py
index 9c707d9..941c749 100644
--- a/tests/unit_tests/repobee/test_main.py
+++ b/tests/unit_tests/repobee/test_main.py
@@ -406,7 +406,7 @@ def test_non_zero_exit_status_on_exception(
 
 def test_show_config_custom_config():
     config_text = """
-[DEFAULTS]
+[repobee]
 user = some-unlikely-user
 """.strip()
     with tempfile.NamedTemporaryFile() as tmpfile, patch(
diff --git a/tests/unit_tests/repobee_plug/test_pluginmeta.py b/tests/unit_tests/repobee_plug/test_pluginmeta.py
index 2e09683..5753dc9 100644
--- a/tests/unit_tests/repobee_plug/test_pluginmeta.py
+++ b/tests/unit_tests/repobee_plug/test_pluginmeta.py
@@ -436,7 +436,7 @@ class TestDeclarativeCommandExtension:
     @pytest.fixture
     def config_file(self, tmpdir):
         config_file = pathlib.Path(str(tmpdir)) / "config.ini"
-        config_file.write_text("[DEFAULTS]")
+        config_file.write_text("[repobee]")
         return config_file
 
     def test_add_required_option_to_config_show(