Repository: nubank/fklearn (language: python)

Issue:
Fix Spatial LC check
### Status
**READY**

### Todo list
- [x] Documentation
- [x] Tests added and passed

### Background context

Spatial LC wasn't verifying correctly if the upper value of the percentage param was bigger than (as it should - you can't select more than 100% of the IDs). This PR just fix this check.

### Description of the changes proposed in the pull request
Fix the check in Spatial LC and add test.

Flexibilize dependencies, as of 2020-07
### Status
**READY**

### Background context
Some of the bounds are more than a year old already.



Discussion / hints:

Just saw that parso was changed to keep compatibility with jedi
Regarding numba https://github.com/nubank/fklearn/pull/139

> numba to keep compatibility with the previous api with numba.errors module

I think with previous requirements some of them used numba.errors, probably fixed with more flexible requirements
The plan was to allow newer versions of numpy, pandas and sklearn.

For cloudpickle and joblib, I guess I'll change them back, then.

I didn't remove numba, but it seams I I accidentally sorted the file somehow
> Do we have a reason to change cloudpickle? historically it's been an issue to deal with different versions.

Doesn't bumping minor justify breaking pickles from previous versions?
> Doesn't bumping minor justify breaking pickles from previous versions?

Sadly, yes. As we still uses the 0 major versions, things break all the time.

We can create a milestone for Fklearn 2 and put cloudpickle 1 as one of the tasks, this will probably make everything more stable. We also can start to support only Pandas >= 1, <2. We can take a look at things we should deprecate, and break and put everything in the same release

Fix patch:
diff --git a/requirements_tools.txt b/requirements_tools.txt
index 46427684..eb9e731a 100644
--- a/requirements_tools.txt
+++ b/requirements_tools.txt
@@ -1,4 +1,3 @@
 shap>=0.31.0,<=0.34
 swifter>=0.284,<0.300
 distributed>=2.14.0,<2.17.0
-parso<0.8.0,>=0.7.0
diff --git a/scripts/create_venv.sh b/scripts/create_venv.sh
index 2d554546..c5dd62ca 100644
--- a/scripts/create_venv.sh
+++ b/scripts/create_venv.sh
@@ -2,4 +2,11 @@
 
 set -e
 
+cur_dir=$(dirname ${BASH_SOURCE[0]})
+source $cur_dir/helpers.sh
+
 /usr/local/bin/python3 -m venv venv
+
+activate_venv
+
+venv/bin/python3 -m pip install -q 'setuptools==51.3.3'
diff --git a/scripts/helpers.sh b/scripts/helpers.sh
index f74f79db..d7f1d81d 100644
--- a/scripts/helpers.sh
+++ b/scripts/helpers.sh
@@ -2,11 +2,11 @@
 
 set -e
 
-activate_venv(){
-    . venv/bin/activate
+activate_venv() {
+  . venv/bin/activate
 }
 
-install_package(){
+install_package() {
   activate_venv
   venv/bin/python3 -m pip install -qe .$1
 }
diff --git a/scripts/init_pypirc.sh b/scripts/init_pypirc.sh
index c16fb69d..e29ec7bc 100644
--- a/scripts/init_pypirc.sh
+++ b/scripts/init_pypirc.sh
@@ -2,6 +2,6 @@
 
 set -e
 
-echo -e "[pypi]" >> ~/.pypirc
-echo -e "username = $PYPI_USER" >> ~/.pypirc
-echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
+echo -e "[pypi]" >>~/.pypirc
+echo -e "username = $PYPI_USER" >>~/.pypirc
+echo -e "password = $PYPI_PASSWORD" >>~/.pypirc
diff --git a/scripts/lint.sh b/scripts/lint.sh
index 7a3db623..6592081b 100755
--- a/scripts/lint.sh
+++ b/scripts/lint.sh
@@ -7,12 +7,12 @@ source $cur_dir/helpers.sh
 
 activate_venv
 
-venv/bin/python3 -m pip install -q flake8==3.8.0
+venv/bin/python3 -m pip install -q flake8==3.8.4
 venv/bin/python3 -m flake8 \
---ignore=E731,W503 \
---filename=*.py \
---exclude=__init__.py \
---show-source \
---statistics \
---max-line-length=120 \
-src/ tests/
+  --ignore=E731,W503 \
+  --filename=*.py \
+  --exclude=__init__.py \
+  --show-source \
+  --statistics \
+  --max-line-length=120 \
+  src/ tests/


Test patch:
diff --git a/requirements_test.txt b/requirements_test.txt
index 89773ee7..4f604782 100644
--- a/requirements_test.txt
+++ b/requirements_test.txt
@@ -1,7 +1,6 @@
-parso<0.8.0
-pytest>=4.2.1,<5
+pytest>=4.2.1,<7
 pytest-cov>=2.6.1,<3
-pytest-xdist>=1.26.1,<2
+pytest-xdist>=1.26.1,<3
 mypy>=0.670,<1
 codecov>=2.0,<3
-hypothesis>=5.5.4
+hypothesis>=5.5.4,<7