Repository: jiawlu/OSM2GMNS (language: python)

Issue:
field of name should be moved to the last column of file poi.csv, to avoid CSV parsing issues.
the issue occurred in ASU POI data set. 


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml
new file mode 100644
index 0000000..0ce6632
--- /dev/null
+++ b/.github/workflows/python-package.yml
@@ -0,0 +1,40 @@
+# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
+
+name: Python package
+
+on:
+  push:
+    branches: [ "master" ]
+  pull_request:
+    branches: [ "master" ]
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        python-version: ["3.10", "3.11", "3.12"]
+
+    steps:
+    - uses: actions/checkout@v3
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v3
+      with:
+        python-version: ${{ matrix.python-version }}
+    - name: Install dependencies
+      run: |
+        python -m pip install --upgrade pip
+        python -m pip install flake8 pytest pyufunc
+        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+    - name: Lint with flake8
+      run: |
+        # stop the build if there are Python syntax errors or undefined names
+        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
+        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
+        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
+    - name: Test with pytest
+      run: |
+        pytest
diff --git a/.gitignore b/.gitignore
index b1a0129..e7c4946 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
 *.vscode/*
 *.pyc
+.pypirc
+setup.py
 
 # Byte-compiled / optimized / DLL files
 *__pycache__/*
diff --git a/README.rst b/README.rst
index 70a934d..a71181b 100644
--- a/README.rst
+++ b/README.rst
@@ -77,7 +77,7 @@ Generate multi-resolution networks from an osm file
 
 
 Get relation id of a place of interest and download the corresponding osm file
-====================================
+=====================================================================================================================
 You can use the following code to get the relation id of a place of interest and download the corresponding osm file.
 
 .. code:: python
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 210261f..e240a07 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -51,9 +51,11 @@
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
 #
-html_theme = 'sphinx_rtd_theme'
+# html_theme = 'sphinx_rtd_theme'
+# html_theme = 'bootstrap'
+
 
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
-html_static_path = ['_static']
\ No newline at end of file
+# html_static_path = ['_static']
\ No newline at end of file
diff --git a/docs/source/functions.rst b/docs/source/functions.rst
index 2d68822..70a095e 100644
--- a/docs/source/functions.rst
+++ b/docs/source/functions.rst
@@ -29,4 +29,9 @@ osm2gmns.movement
 
 osm2gmns.multiresolutionnet
 ==================================================
-.. autofunction:: osm2gmns.multiresolutionnet.build_mrnet.buildMultiResolutionNets
\ No newline at end of file
+.. autofunction:: osm2gmns.multiresolutionnet.build_mrnet.buildMultiResolutionNets
+
+
+osm2gmns.func_lib
+==================================================
+.. autofunction:: osm2gmns.func_lib.getOSMRelationID
\ No newline at end of file
diff --git a/docs/source/quick-start.rst b/docs/source/quick-start.rst
index 01355a3..bddba2d 100644
--- a/docs/source/quick-start.rst
+++ b/docs/source/quick-start.rst
@@ -14,7 +14,7 @@ osm files to extract useful network information. As a result, the first step is
 Thanks to the open-source nature of OpenStreetMap, there are lots of APIs and mirror sites that we can use to
 download osm map data. We list several popular sites here for users to choose.
 
-0) osm2gmns built-in class: OSM_RelationID_Finder
+0) osm2gmns built-in function: getOSMRelationID
 Get the relation id of a place of interest, eg. "Arizona State University", "Arizona, United States", "Tempe, AZ"...
 
 -- code-block:: python
diff --git a/osm2gmns/__init__.py b/osm2gmns/__init__.py
index 48ce719..f5cf187 100644
--- a/osm2gmns/__init__.py
+++ b/osm2gmns/__init__.py
@@ -14,7 +14,7 @@
 import osm2gmns.settings as og_settings
 
 
-__version__ = '0.7.4'
+__version__ = '0.7.5'
 print(f'osm2gmns, {__version__}')
 
 __all__ = [
diff --git a/requirements.txt b/requirements.txt
index b141ff6..a76e7d2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,7 @@
-matplotlib==3.7.2
-numpy==1.24.3
-osmium==3.7.0
-Requests==2.31.0
-Shapely==2.0.2
+numpy>=1.26.4
+osmium>=3.7.0
+pyufunc>=0.2.1
+Requests>=2.31.0
+setuptools>=68.2.2
+Shapely>=2.0.3
+matplotlib>=3.8.2
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 7010bbd..754934f 100644
--- a/setup.py
+++ b/setup.py
@@ -1,17 +1,32 @@
 import setuptools
 
+try:
+    # if have requirements.txt file inside the folder
+    with open("requirements.txt", "r", encoding="utf-8") as f:
+        modules_needed = [i.strip() for i in f.readlines()]
+except Exception:
+    modules_needed = []
+
+with open("README.rst", "r", encoding="utf-8") as f:
+    _long_description = f.read()
+
 setuptools.setup(
     name='osm2gmns',
-    version='0.7.4',
+    version='0.7.6',
     author='Jiawei Lu, Xuesong Zhou',
     author_email='jiaweil9@asu.edu, xzhou74@asu.edu',
     url='https://github.com/jiawlu/OSM2GMNS',
-    description='convert map data from OpenStreetMap to network files in GMNS format',
-    long_description=open('README_pypi.rst').read(),
+    description="convert map data from OpenStreetMap to network files in GMNS format",
+    long_description=_long_description,
+    long_description_content_type="text/x-rst",
     license='GPLv3+',
     packages=setuptools.find_packages(),
-    python_requires=">=3.6.0",
-    install_requires=['shapely >= 2.0.1', 'osmium >= 3.1.3', 'numpy'],
+    python_requires=">=3.10",
     classifiers=['License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
-                 'Programming Language :: Python :: 3']
+                 'Programming Language :: Python :: 3',
+                 'Programming Language :: Python :: 3.10',
+                 'Programming Language :: Python :: 3.11',
+                 'Programming Language :: Python :: 3.12'
+                 ],
+    install_requires=modules_needed,
 )


Test patch:
diff --git a/tests/test_relation_id_finder.py b/tests/test_relation_id_finder.py
index 475a137..5dad3f7 100644
--- a/tests/test_relation_id_finder.py
+++ b/tests/test_relation_id_finder.py
@@ -6,12 +6,12 @@
 ##############################################################
 
 
-from osm2gmns.func_lib.extract_relation_id import OSM_RelationID_Finder
+from osm2gmns.func_lib.extract_relation_id import OSMRelationIDFinder
 
 
 def test_rel_id_web_search_exists():
 
-    rel_identifier = OSM_RelationID_Finder("Arizona State University")
+    rel_identifier = OSMRelationIDFinder("Arizona State University")
     rel_id = rel_identifier.rel_id
     print(type(rel_id))
     assert isinstance(rel_id, int)
@@ -19,6 +19,6 @@ def test_rel_id_web_search_exists():
 
 def test_rel_id_web_search_not_exists():
 
-    rel_identifier = OSM_RelationID_Finder("TTTTTTEEEEEESSSSSTTTTT")
+    rel_identifier = OSMRelationIDFinder("TTTTTTEEEEEESSSSSTTTTT")
     rel_id = rel_identifier.rel_id
     assert rel_id is None