Repository: InsightLab/PyMove (language: python)

Issue:
added makefile, updated setup.py
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
-   [ ] Bug fix (non-breaking change which fixes an issue)
-   [ ] New feature (non-breaking change which adds functionality)
-   [ ] Breaking change (fix or feature that would cause existing functionality to change)
-   [ ] I have read the **CONTRIBUTING** document.
-   [ ] My code follows the code style of this project (see `.code-style.md`).
-   [ ] All new and existing tests passed (see `.testing.md`).
-   [ ] I have added tests to cover my changes.
-   [ ] My change requires a change to the documentation.
-   [ ] I have updated the documentation accordingly (see `.documentation.md`).

## Description

-   What is the current behavior? (You can also link to an open issue here)
    <!--- Discuss the new functionality or bug --->

-   What is the new behavior (if this is a feature change)?
    Added Makefile



Discussion / hints:

Fix patch:
diff --git a/.code-style.md b/.code-style.md
index 33df254d..702c406c 100644
--- a/.code-style.md
+++ b/.code-style.md
@@ -20,6 +20,11 @@ We following the [Numpy](https://numpydoc.readthedocs.io/en/latest/format.html)
 
 ---
 
+## flake8
+
+Flake8 is a python linter that helps to keep the code up to PEP standards.
+To lint the code, run: `make lint`
+
 ## Pre-Commit
 
 Next we'll explain the steps to use the pre-commit hooks.
diff --git a/.documentation.md b/.documentation.md
index e24e44a0..06fab1d2 100644
--- a/.documentation.md
+++ b/.documentation.md
@@ -82,7 +82,7 @@ and finish!
 To generate the .html files, just access the docs folder, just run the
 following command:
 
-`make html`
+`make doc`
 
 #### 2.4. Hospedando docs in [Readthedocs](https://readthedocs.org/)
 
diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml
index 23bd13af..91721b10 100644
--- a/.github/workflows/code_coverage.yml
+++ b/.github/workflows/code_coverage.yml
@@ -17,8 +17,8 @@ jobs:
         python-version: 3.7
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade "pip<20"
-        pip install -r requirements-dev.txt
+        python -m pip install --upgrade pip
+        pip install pytest coverage geopandas .
     - name: Coverage
       run: |
         coverage run -m pytest
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 24769413..2edfa1a5 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -17,8 +17,8 @@ jobs:
         python-version: 3.7
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade "pip<20"
-        pip install -r requirements-dev.txt
+        python -m pip install --upgrade pip
+        pip install flake8 pep8-naming pytest geopandas .
     - name: Lint and Test
       run: |
         flake8
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 96e80d33..c3223aaf 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
 repos:
 -   repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v2.5.0
+    rev: v3.4.0
     hooks:
     -   id: double-quote-string-fixer
     -   id: trailing-whitespace
@@ -16,14 +16,14 @@ repos:
     - id: autoflake
       args: ['--in-place', '--remove-all-unused-imports', '--ignore-init-module-imports']
 -   repo: https://github.com/asottile/seed-isort-config
-    rev: v1.9.3
+    rev: v2.2.0
     hooks:
     - id: seed-isort-config
 -   repo: https://github.com/pre-commit/mirrors-isort
-    rev: v4.3.21
+    rev: v5.7.0
     hooks:
     - id: isort
 -   repo: https://gitlab.com/pycqa/flake8
-    rev: 3.7.9
+    rev: 3.8.4
     hooks:
     - id: flake8
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..a0fc9bf1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+help:
+	@echo "available commands"
+	@echo " - dev    : install dev environment"
+	@echo " - clean  : clean temporary folders and files"
+	@echo " - test   : runs all unit tests"
+	@echo " - lint   : checks code style"
+	@echo " - doc    : creates documentation in html"
+
+dev:
+	pip install -r requirements-dev.txt
+	pre-commit install
+
+clean:
+	rm -rf `find . -type d -name .pytest_cache`
+	rm -rf `find . -type d -name __pycache__`
+	rm -rf `find . -type d -name .ipynb_checkpoints`
+	rm -rf docs/_build
+	rm -f .coverage
+
+test: clean
+	coverage run -m pytest
+	coverage report
+
+lint: clean
+	flake8
+
+doc: clean
+	make -C docs html
diff --git a/README.md b/README.md
index 28a7fc95..a963f550 100644
--- a/README.md
+++ b/README.md
@@ -208,7 +208,7 @@ Requirements: Anaconda Python distribution installed and accessible
     -   `git pull origin developer`
 
 5.  Install pymove in developer mode
-    -   `pip install -r requirements-dev.txt`
+    -   `make dev`
 
 ### For windows users
 
diff --git a/pymove/preprocessing/filters.py b/pymove/preprocessing/filters.py
index 44e23a47..8c8bfa5b 100644
--- a/pymove/preprocessing/filters.py
+++ b/pymove/preprocessing/filters.py
@@ -17,8 +17,8 @@
 )
 
 if TYPE_CHECKING:
-    from pymove.core.pandas import PandasMoveDataFrame
     from pymove.core.dask import DaskMoveDataFrame
+    from pymove.core.pandas import PandasMoveDataFrame
 
 
 def get_bbox_by_radius(
diff --git a/pymove/preprocessing/segmentation.py b/pymove/preprocessing/segmentation.py
index 4756fb23..e20bfb04 100644
--- a/pymove/preprocessing/segmentation.py
+++ b/pymove/preprocessing/segmentation.py
@@ -18,8 +18,8 @@
 from pymove.utils.log import progress_bar, timer_decorator
 
 if TYPE_CHECKING:
-    from pymove.core.pandas import PandasMoveDataFrame
     from pymove.core.dask import DaskMoveDataFrame
+    from pymove.core.pandas import PandasMoveDataFrame
 
 
 @timer_decorator
diff --git a/pymove/preprocessing/stay_point_detection.py b/pymove/preprocessing/stay_point_detection.py
index 67d3dc74..899ca3e6 100644
--- a/pymove/preprocessing/stay_point_detection.py
+++ b/pymove/preprocessing/stay_point_detection.py
@@ -19,8 +19,8 @@
 from pymove.utils.log import timer_decorator
 
 if TYPE_CHECKING:
-    from pymove.core.pandas import PandasMoveDataFrame
     from pymove.core.dask import DaskMoveDataFrame
+    from pymove.core.pandas import PandasMoveDataFrame
 
 
 def create_or_update_datetime_in_format_cyclical(
diff --git a/pymove/semantic/semantic.py b/pymove/semantic/semantic.py
index 39d0c6a0..d93d9f35 100644
--- a/pymove/semantic/semantic.py
+++ b/pymove/semantic/semantic.py
@@ -19,8 +19,8 @@
 from pymove.utils.log import timer_decorator
 
 if TYPE_CHECKING:
-    from pymove.core.pandas import PandasMoveDataFrame
     from pymove.core.dask import DaskMoveDataFrame
+    from pymove.core.pandas import PandasMoveDataFrame
 
 
 def _end_create_operation(
diff --git a/pymove/utils/conversions.py b/pymove/utils/conversions.py
index d16c7eb4..c308d8a9 100644
--- a/pymove/utils/conversions.py
+++ b/pymove/utils/conversions.py
@@ -16,8 +16,8 @@
 )
 
 if TYPE_CHECKING:
-    from pymove.core.pandas import PandasMoveDataFrame
     from pymove.core.dask import DaskMoveDataFrame
+    from pymove.core.pandas import PandasMoveDataFrame
 
 
 def lat_meters(lat: float) -> float:
diff --git a/pymove/visualization/matplotlib.py b/pymove/visualization/matplotlib.py
index 8801a702..3bcd72a9 100644
--- a/pymove/visualization/matplotlib.py
+++ b/pymove/visualization/matplotlib.py
@@ -16,8 +16,8 @@
 )
 
 if TYPE_CHECKING:
-    from pymove.core.pandas import PandasMoveDataFrame
     from pymove.core.dask import DaskMoveDataFrame
+    from pymove.core.pandas import PandasMoveDataFrame
 
 
 def show_object_id_by_date(
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 0ab143ba..1624de41 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -2,6 +2,7 @@
 pre-commit
 bump2version
 flake8
+pep8-naming
 pytest
 coverage
 geopandas
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..ebe72608
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,20 @@
+branca
+dask[dataframe]
+folium>=0.10.1
+geohash2
+geojson
+holidays
+IPython
+ipywidgets
+joblib
+matplotlib
+mplleaflet
+numpy
+pandas>=1.1.0
+psutil
+python-dateutil
+pytz
+scikit-learn
+scipy
+shapely
+tqdm
diff --git a/setup.cfg b/setup.cfg
index f4a7aa15..a2f876df 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -9,7 +9,7 @@ exclude =
 multi_line_output = 3
 include_trailing_comma = True
 line_length = 90
-known_third_party = IPython,branca,dask,dateutil,folium,geohash2,geopandas,holidays,ipywidgets,joblib,matplotlib,numpy,pandas,psutil,scipy,shapely,sklearn,tqdm
+known_third_party = IPython,branca,dask,dateutil,folium,geohash2,geopandas,holidays,ipywidgets,joblib,matplotlib,numpy,pandas,psutil,scipy,setuptools,shapely,sklearn,tqdm
 
 
 [aliases]
@@ -19,8 +19,6 @@ test = pytest
 addopts =
 	--ignore examples
 	--ignore build_tools
-	--ignore pymove/utils/datetime
-	--ignore pymove/utils/maths
 	--disable-pytest-warnings
 	--capture sys
 
diff --git a/setup.py b/setup.py
index 335942b0..a7b72772 100644
--- a/setup.py
+++ b/setup.py
@@ -1,36 +1,11 @@
-try:
-    from setuptools import setup
-except ImportError:
-    from distutils.core import setup
+from setuptools import find_packages, setup
 
-# Get the long description from the README file
-try:
-    long_description = open('README.md', 'r').read()
-except Exception as e:
-    raise e
+with open('README.md', 'r') as f:
+    LONG_DESCRIPTION = f.read()
+
+with open('requirements.txt') as f:
+    DEPENDENCIES = f.readlines()
 
-DEPENDENCIES = [
-    'branca',
-    'dask[dataframe]',
-    'folium>=0.10.1',
-    'geohash2',
-    'geojson',
-    'holidays',
-    'IPython',
-    'ipywidgets',
-    'joblib',
-    'matplotlib',
-    'mplleaflet',
-    'numpy',
-    'pandas>=1.1.0',
-    'psutil',
-    'python-dateutil',
-    'pytz',
-    'scikit-learn',
-    'scipy',
-    'shapely',
-    'tqdm',
-]
 setup(
     name='pymove',
     version='2.6.1',
@@ -40,22 +15,10 @@
     python_requires='>=3.6',
     description='A lib python to processing and visualization '
                 'of trajectories and other spatial-temporal data',
-    long_description=long_description,
+    long_description=LONG_DESCRIPTION,
     long_description_content_type='text/markdown',
     url='https://github.com/InsightLab/PyMove',
-    packages=[
-        'pymove',
-        'pymove.core',
-        'pymove.models',
-        'pymove.models.pattern_mining',
-        'pymove.preprocessing',
-        'pymove.query',
-        'pymove.semantic',
-        'pymove.tests',
-        'pymove.uncertainty',
-        'pymove.utils',
-        'pymove.visualization',
-    ],
+    packages=find_packages(exclude=['*.tests']),
     classifiers=[
         'Development Status :: 5 - Production/Stable',
         'Programming Language :: Python :: 3',


Test patch:
diff --git a/.github/workflows/lint_and_test.yml b/.github/workflows/lint_and_test.yml
index 86f8d355..2d65e168 100644
--- a/.github/workflows/lint_and_test.yml
+++ b/.github/workflows/lint_and_test.yml
@@ -13,8 +13,8 @@ jobs:
         python-version: 3.7
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade "pip<20"
-        pip install -r requirements-dev.txt
+        python -m pip install --upgrade pip
+        pip install flake8 pep8-naming .
     - name: Lint
       working-directory: ${{ github.workspace }}
       run: |
@@ -30,9 +30,9 @@ jobs:
         python-version: 3.7
     - name: Install dependencies
       run: |
-        python -m pip install --upgrade "pip<20"
-        pip install -r requirements-dev.txt
+        python -m pip install --upgrade pip
+        pip install pytest geopandas .
     - name: Test
       working-directory: ${{ github.workspace }}
       run: |
-        pytest
+        pytest --verbose