Repository: modin-project/modin
Pull request: FIX-#2147: return interval for python micro version - *.*.X
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>

<!--
Thank you for your contribution! 
Please review the contributing docs: https://modin.readthedocs.io/en/latest/contributing.html
if you have questions about contributing.
-->

## What do these changes do?
For RPyC to work correctly, the micro part of the python version may not match, so we can specify an interval from which the conda will choose the appropriate one. (for example 3.7.*)

<!-- Please give a short brief about these changes. -->

- [x] commit message follows format outlined [here](https://modin.readthedocs.io/en/latest/contributing.html)
- [x] passes `flake8 modin`
- [x] passes `black --check modin`
- [x] signed commit with `git commit -s` <!-- you can amend your commit with a signature via `git commit -amend -s` -->
- [x] Resolves #2147 <!-- issue must be created for each patch -->
- [ ] tests added and passing


Problem statement:
"conda install python==3.7.9 -c conda-forge" failed when the cluster is created
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**:
- **Modin version** (`modin.__version__`):
- **Python version**:
- **Code we can use to reproduce**:

<!--
You can obtain the Modin version with

python -c "import modin; print(modin.__version__)"
-->

### Describe the problem
<!-- Describe the problem clearly here. -->

### Source code / logs
<!-- Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem. -->

Hints from issue discussion:

Commit message: FIX-#2147: return interval for python micro version - *.*.X

Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>

Patch to review:
diff --git a/modin/experimental/cloud/rayscale.py b/modin/experimental/cloud/rayscale.py
index e17af01fe20..a268a9d7d19 100644
--- a/modin/experimental/cloud/rayscale.py
+++ b/modin/experimental/cloud/rayscale.py
@@ -146,7 +146,7 @@ def _conda_requirements(self):
 
         reqs = []
 
-        reqs.append(f"python=={self._get_python_version()}")
+        reqs.extend(self._get_python_version())
 
         if self.add_conda_packages:
             reqs.extend(self.add_conda_packages)
@@ -167,7 +167,7 @@ def _get_python_version():
         major = sys.version_info.major
         minor = sys.version_info.minor
         micro = sys.version_info.micro
-        return f"{major}.{minor}.{micro}"
+        return [f"python>{major}.{minor}", f"python<={major}.{minor}.{micro}"]
 
     @staticmethod
     def __save_config(config):
diff --git a/modin/experimental/cloud/test/test_cloud.py b/modin/experimental/cloud/test/test_cloud.py
index 30398a2b7a4..57de58fd08d 100644
--- a/modin/experimental/cloud/test/test_cloud.py
+++ b/modin/experimental/cloud/test/test_cloud.py
@@ -33,7 +33,8 @@ def test_update_conda_requirements(setup_commands_source):
     major = sys.version_info.major
     minor = sys.version_info.minor
     micro = sys.version_info.micro
-    python_version = f"python=={major}.{minor}.{micro}"
+    python_version_lower = f"python>{major}.{minor}"
+    python_version_higher = f"python<={major}.{minor}.{micro}"
 
     with mock.patch(
         "modin.experimental.cloud.rayscale._bootstrap_config", lambda config: config
@@ -46,6 +47,7 @@ def test_update_conda_requirements(setup_commands_source):
         setup_commands_source
     )
 
-    assert python_version in setup_commands_result
+    assert python_version_lower in setup_commands_result
+    assert python_version_higher in setup_commands_result
     assert "scikit-learn>=0.23" in setup_commands_result
     assert "{{CONDA_PACKAGES}}" not in setup_commands_result


Code review comments:
diff_hunk: @@ -33,7 +33,8 @@ def test_update_conda_requirements(setup_commands_source):
     major = sys.version_info.major
     minor = sys.version_info.minor
     micro = sys.version_info.micro
-    python_version = f"python=={major}.{minor}.{micro}"
+    python_version_lower = f"python>{major}.{minor}"
+    python_version_higher = f"python<={major}.{minor}.{micro}"
path: modin/experimental/cloud/test/test_cloud.py
text: @user1:
maybe we should mock `sys.version_info` to some fixed bogus value like `7.12.45` and check for that string?

@author:
ready

diff_hunk: @@ -167,7 +167,7 @@ def _get_python_version():
         major = sys.version_info.major
         minor = sys.version_info.minor
         micro = sys.version_info.micro
-        return f"{major}.{minor}.{micro}"
+        return [f"python>{major}.{minor}", f"python<={major}.{minor}.{micro}"]
path: modin/experimental/cloud/rayscale.py
text: @user1:
```suggestion
        return [f"python>={major}.{minor}", f"python<={major}.{minor}.{micro}"]
```
otherwise might break on `x.y.0` version

Another option is requiring just `{major}.{minor}`, omitting `{micro}` altogether

@author:
If I specify the python version as `python==3.7`, then the conda tries to install the minimum available version- `3.7.0`. So just commit your suggestions.