Repository: nilearn/nilearn

Issue:
Bundle dependencies in `setup.py` or `info.py` file
<!--Provide a brief description what you would like changes and why.-->
I think it would be beneficial to combine the requirements-[*].txt files into a single file, with flags for the different dependency groups.

<!--Please fill in the following information, to the best of your ability.-->
### Benefits to the change

Installation for developers would be simplified, since `nilearn` and its developer-specific dependencies could be installed in one step (e.g., `pip install -e .[all]` or `pip install -e .[test,doc]`). 

From a maintenance perspective, it may also be easier to manage one file instead of three.

We could put the requirements in the `setup.cfg` file ([as in `pybids`](https://github.com/bids-standard/pybids/blob/00ee1ecd2d986f150b95710072d019414769a35e/setup.cfg#L22-L68)), the `setup.py` file, or a new `info.py` file ([as in `tedana`](https://github.com/ME-ICA/tedana/blob/ab7afd80defafc86a4e4f27bd88dd2b32e499adb/tedana/info.py#L27-L62)).

### Pseudocode for the new behavior, if applicable

Current steps for developer installation:

```bash
git clone git@github.com:<your_username>/nilearn.git
conda create -n nilearn
conda activate nilearn
pip install . -e
pip install -r requirements-dev.txt
```

New steps:

```bash
git clone git@github.com:<your_username>/nilearn.git
conda create -n nilearn
conda activate nilearn
pip install .[dev] -e
```


Discussion:
+1. I see no issue with that suggestion.
Does anyone have a preference on where the requirements should go? I'm leaning toward using the `setup.cfg` based on @\effigies' packaging recommendations (https://gist.github.com/effigies/9bbb424535d6a1d838d6325191c0a736).
No strong feeling on that. @NicolasGensollen WDYT ?
In general, it is better practice if dependencies are inspectable without
executing code.

I have some hope that the project.toml (PEP518) might be useful. However,
I have never tried using it, so I don't know what is the situation of the
technological pile, but I hope that it can be useful.


At the moment, I think that pyproject.toml can only store the dependencies for the actual build, but my understanding may be out of date. If I'm correct, then setup.cfg sounds most in line with what you're saying, since it's a config file and not a script, unlike setup.py or info.py. Does that sound good?
>No strong feeling on that. @NicolasGensollen WDYT ?

No strong feeling either. I had a look at various well known packages, and I have the feeling that there are as many strategies as packages to handle this... 
I'm OK with Taylor's suggestion of relying on `setup.cfg`, it seems like a clean way of doing it.

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -344,8 +344,7 @@
         'repo': 'nilearn.github.io',
         'binderhub_url': 'https://mybinder.org',
         'branch': 'main',
-        'dependencies': ['../requirements-build-docs.txt',
-                         'binder/requirements.txt'],
+        'dependencies': ['binder/requirements.txt'],
         'notebooks_dir': 'examples'
     }
 }
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,8 +1,5 @@
 #! /usr/bin/env python
 
-descr = """A set of python modules for neuroimaging..."""
-
-import sys
 import os
 
 from setuptools import setup, find_packages
@@ -24,25 +21,6 @@ def load_version():
     return globals_dict
 
 
-def is_installing():
-    # Allow command-lines such as "python setup.py build install"
-    install_commands = set(['install', 'develop'])
-    return install_commands.intersection(set(sys.argv))
-
-
-def list_required_packages():
-    required_packages = []
-    required_packages_orig = ['%s>=%s' % (mod, meta['min_version'])
-                              for mod, meta
-                              in _VERSION_GLOBALS['REQUIRED_MODULE_METADATA']
-                              ]
-    for package in required_packages_orig:
-        if package.startswith('sklearn'):
-            package = package.replace('sklearn', 'scikit-learn')
-        required_packages.append(package)
-    return required_packages
-
-
 # Make sources available using relative paths from this file's directory.
 os.chdir(os.path.dirname(os.path.abspath(__file__)))
 
@@ -60,10 +38,6 @@ def list_required_packages():
 
 
 if __name__ == "__main__":
-    if is_installing():
-        module_check_fn = _VERSION_GLOBALS['_check_module_dependencies']
-        module_check_fn(is_nilearn_installing=True)
-
     setup(name=DISTNAME,
           maintainer=MAINTAINER,
           maintainer_email=MAINTAINER_EMAIL,
@@ -113,6 +87,4 @@ def list_required_packages():
               'nilearn.glm.tests': ['*.nii.gz', '*.npz'],
               'nilearn.reporting.glm_reporter_templates': ['*.html'],
           },
-          install_requires=list_required_packages(),
-          python_requires='>=3.6',
           )


Test patch: