Repository: PolusAI/nyxus (language: python)

Issue:
update build script



Discussion / hints:

Fix patch:
diff --git a/.github/LinuxWheelBuilder b/.github/LinuxWheelBuilder
deleted file mode 100644
index 9d76bdd6..00000000
--- a/.github/LinuxWheelBuilder
+++ /dev/null
@@ -1,8 +0,0 @@
-FROM quay.io/pypa/manylinux2010_x86_64
-RUN yum -y install libtiff-devel
-RUN mkdir /io
-COPY * /io/
-WORKDIR  /io
-RUN ls
-RUN chmod +x build-wheels.sh
-CMD sh build-wheels.sh
\ No newline at end of file
diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml
new file mode 100644
index 00000000..d47669ce
--- /dev/null
+++ b/.github/workflows/build_wheels.yml
@@ -0,0 +1,81 @@
+name: Build Wheels
+
+on:
+  workflow_dispatch:
+  pull_request:
+
+jobs:
+  build_wheels:
+    name: Build wheels on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+    env:
+      MACOSX_DEPLOYMENT_TARGET: "10.15"
+    strategy:
+      matrix:
+        os: [ubuntu-latest, macos-10.15]
+        cibw_archs: ["auto"]
+
+    steps:
+      - uses: actions/checkout@v2
+        name: Check out
+        with:
+          submodules: recursive      
+
+      - uses: actions/setup-python@v3
+        name: Install Python
+        with:
+          python-version: '3.8'
+
+
+
+      - name: Install cibuildwheel
+        run: |
+          python -m pip install cibuildwheel==2.1.1
+
+      - name: Build wheels for CPython 3.9
+        run: |
+          python -m cibuildwheel --output-dir dist
+        env:
+          CIBW_BUILD: "cp39-*"
+          CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
+          CIBW_MANYLINUX_I686_IMAGE: manylinux2010
+          CIBW_BEFORE_BUILD_MACOS: brew install libtiff llvm libomp
+          CIBW_ENVIRONMENT_MACOS: PATH="$(brew --prefix llvm)/bin:$PATH" CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib" CXX=${COMPILER}
+          CIBW_BEFORE_BUILD_LINUX: yum -y install libtiff-devel
+          CIBW_ARCHS: ${{ matrix.cibw_archs }}
+
+      - name: Build wheels for CPython 3.8
+        run: |
+          python -m cibuildwheel --output-dir dist
+        env:
+          CIBW_BUILD: "cp38-*"
+          CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
+          CIBW_MANYLINUX_I686_IMAGE: manylinux2010
+          CIBW_BEFORE_BUILD_MACOS: brew install libtiff llvm libomp
+          CIBW_ENVIRONMENT_MACOS: PATH="$(brew --prefix llvm)/bin:$PATH" CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib" CXX=${COMPILER}
+          CIBW_BEFORE_BUILD_LINUX: yum -y install libtiff-devel
+          CIBW_ARCHS: ${{ matrix.cibw_archs }}
+
+      - name: Build wheels for CPython 3.7
+        run: |
+          python -m cibuildwheel --output-dir dist
+        env:
+          CIBW_BUILD: "cp37-*"
+          CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
+          CIBW_MANYLINUX_I686_IMAGE: manylinux2010
+          CIBW_BEFORE_BUILD_MACOS: brew install libtiff llvm libomp
+          CIBW_ENVIRONMENT_MACOS: PATH="$(brew --prefix llvm)/bin:$PATH" CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib" CXX=${COMPILER}
+          CIBW_BEFORE_BUILD_LINUX: yum -y install libtiff-devel
+          CIBW_ARCHS: ${{ matrix.cibw_archs }}
+
+      - name: Build wheels for CPython 3.6
+        run: |
+          python -m cibuildwheel --output-dir dist
+        env:
+          CIBW_BUILD: "cp36-*"
+          CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
+          CIBW_MANYLINUX_I686_IMAGE: manylinux2010
+          CIBW_BEFORE_BUILD_MACOS: brew install libtiff llvm libomp
+          CIBW_ENVIRONMENT_MACOS: PATH="$(brew --prefix llvm)/bin:$PATH" CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib" CXX=${COMPILER}
+          CIBW_BEFORE_BUILD_LINUX: yum -y install libtiff-devel
+          CIBW_ARCHS: ${{ matrix.cibw_archs }}
\ No newline at end of file
diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml
index 13a02691..b6eef1e2 100644
--- a/.github/workflows/publish_pypi.yml
+++ b/.github/workflows/publish_pypi.yml
@@ -6,30 +6,88 @@ on:
 
   workflow_dispatch:
 
-env:
-  BUILD_TYPE: Release
-
 jobs:
-  Publish:
-    runs-on: ubuntu-latest
+  build_wheels:
+    name: Build wheels on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+    env:
+      MACOSX_DEPLOYMENT_TARGET: "10.15"
+    strategy:
+      matrix:
+        os: [ubuntu-latest, macos-10.15]
+        cibw_archs: ["auto"]
 
     steps:
-    - uses: actions/checkout@v2
-      with:
-        submodules: recursive      
-
-    - name: Create ManyLinux Docker
-      run: docker build . -f .github/LinuxWheelBuilder  -t linuxbuilder
-
-    - name: Build ManyLinux Wheels 
-      run: docker run -v $(pwd):/io  linuxbuilder:latest
-    
-    - name: Install Dependencies
-      run: python -m pip install --upgrade twine requests
-
-    - name: Publish to PyPi
-      run: python -m twine upload dist/*
-      env:
-        TWINE_USERNAME: __token__
-        TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
-        TWINE_REPOSITORY: testpypi
\ No newline at end of file
+      - uses: actions/checkout@v2
+        name: Check out
+        with:
+          submodules: recursive      
+
+      - uses: actions/setup-python@v3
+        name: Install Python
+        with:
+          python-version: '3.8'
+
+
+
+      - name: Install cibuildwheel
+        run: |
+          python -m pip install cibuildwheel==2.1.1
+
+      - name: Build wheels for CPython 3.9
+        run: |
+          python -m cibuildwheel --output-dir dist
+        env:
+          CIBW_BUILD: "cp39-*"
+          CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
+          CIBW_MANYLINUX_I686_IMAGE: manylinux2010
+          CIBW_BEFORE_BUILD_MACOS: brew install libtiff llvm libomp
+          CIBW_ENVIRONMENT_MACOS: PATH="$(brew --prefix llvm)/bin:$PATH" CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib" CXX=${COMPILER}
+          CIBW_BEFORE_BUILD_LINUX: yum -y install libtiff-devel
+          CIBW_ARCHS: ${{ matrix.cibw_archs }}
+
+      - name: Build wheels for CPython 3.8
+        run: |
+          python -m cibuildwheel --output-dir dist
+        env:
+          CIBW_BUILD: "cp38-*"
+          CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
+          CIBW_MANYLINUX_I686_IMAGE: manylinux2010
+          CIBW_BEFORE_BUILD_MACOS: brew install libtiff llvm libomp
+          CIBW_ENVIRONMENT_MACOS: PATH="$(brew --prefix llvm)/bin:$PATH" CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib" CXX=${COMPILER}
+          CIBW_BEFORE_BUILD_LINUX: yum -y install libtiff-devel
+          CIBW_ARCHS: ${{ matrix.cibw_archs }}
+
+      - name: Build wheels for CPython 3.7
+        run: |
+          python -m cibuildwheel --output-dir dist
+        env:
+          CIBW_BUILD: "cp37-*"
+          CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
+          CIBW_MANYLINUX_I686_IMAGE: manylinux2010
+          CIBW_BEFORE_BUILD_MACOS: brew install libtiff llvm libomp
+          CIBW_ENVIRONMENT_MACOS: PATH="$(brew --prefix llvm)/bin:$PATH" CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib" CXX=${COMPILER}
+          CIBW_BEFORE_BUILD_LINUX: yum -y install libtiff-devel
+          CIBW_ARCHS: ${{ matrix.cibw_archs }}
+
+      - name: Build wheels for CPython 3.6
+        run: |
+          python -m cibuildwheel --output-dir dist
+        env:
+          CIBW_BUILD: "cp36-*"
+          CIBW_MANYLINUX_X86_64_IMAGE: manylinux2010
+          CIBW_MANYLINUX_I686_IMAGE: manylinux2010
+          CIBW_BEFORE_BUILD_MACOS: brew install libtiff llvm libomp
+          CIBW_ENVIRONMENT_MACOS: PATH="$(brew --prefix llvm)/bin:$PATH" CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include" LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib" CXX=${COMPILER}
+          CIBW_BEFORE_BUILD_LINUX: yum -y install libtiff-devel
+          CIBW_ARCHS: ${{ matrix.cibw_archs }}
+
+      - name: Install Dependencies
+        run: python -m pip install --upgrade twine requests
+        
+      - name: Publish to PyPi
+        run: python -m twine upload dist/*.whl
+        env:
+          TWINE_USERNAME: __token__
+          TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
+          TWINE_REPOSITORY: testpypi
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e5381b0..1165de9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,16 +20,12 @@ option(RUN_GTEST "Downloads google unit test API and runs google test scripts to
 set(RUN_GTEST ON)
 
 #==== Pybind11
-find_package(Python COMPONENTS Interpreter Development)
 add_subdirectory(lib/pybind11)
 
 include_directories(
 	lib/pybind11/include/
-	${Python_INCLUDE_DIRS}
 )
 
-message(STATUS "PYTHON HEADERS: ${Python_INCLUDE_DIRS}")
-
 find_package(OpenMP COMPONENTS C CXX)
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake-modules")
@@ -124,7 +120,7 @@ pybind11_add_module(backend
 	src/nyx/python/new_bindings_py.cpp
 )
 
-target_compile_definitions(backend PRIVATE WITH_PYTHON_H)
+#target_compile_definitions(backend PRIVATE WITH_PYTHON_H)
 
 # VERSION_INFO is defined by setup.py and passed into the C++ code as a define (VERSION_INFO) here.
 target_compile_definitions(backend PRIVATE VERSION_INFO=${VERSION_INFO})
@@ -141,16 +137,13 @@ endif()
 
 target_link_libraries(backend PRIVATE ${Nyxus_LIBRARIES})
 
-if (NOT APPLE)
-	target_link_libraries(backend PRIVATE ${Python_LIBRARIES})
-else ()
+if (APPLE)
 	set_target_properties(backend PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
 endif()
 
 
 if(BUILD_CLI)
 	target_link_libraries(nyxus PRIVATE ${Nyxus_LIBRARIES})
-	target_link_libraries(nyxus PRIVATE ${Python_LIBRARIES})
 endif()
 
 ## Running Tests
@@ -181,4 +174,4 @@ if (RUN_GTEST)
 	#	enable_testing()
 	add_subdirectory(tests)
 	message(STATUS "GTEST downloaded and imported")
-endif (RUN_GTEST)
+endif (RUN_GTEST)
\ No newline at end of file
diff --git a/src/nyx/feature_method.cpp b/src/nyx/feature_method.cpp
index fe1a2220..737c7485 100644
--- a/src/nyx/feature_method.cpp
+++ b/src/nyx/feature_method.cpp
@@ -5,6 +5,8 @@ FeatureMethod::FeatureMethod(const std::string& _featureinfo)
 	feature_info = _featureinfo;
 }
 
+FeatureMethod::~FeatureMethod(){}
+
 void FeatureMethod::provide_features (const std::initializer_list<Nyxus::AvailableFeatures>& F)
 {
 	for (auto f : F)
diff --git a/src/nyx/feature_method.h b/src/nyx/feature_method.h
index 7b0ca1f2..8caedf5e 100644
--- a/src/nyx/feature_method.h
+++ b/src/nyx/feature_method.h
@@ -13,6 +13,8 @@ class FeatureMethod
 
 	FeatureMethod (const std::string& _featureinfo = __FILE__);
 
+	virtual ~FeatureMethod();
+	
 	//=== Trivial ROI
 	// Calculate the feature for one ROI using cached data and probably caching data
 	virtual void calculate (LR& r) = 0;


Test patch:
diff --git a/.github/workflows/build_and_test_mac.yml b/.github/workflows/build_and_test_mac.yml
new file mode 100644
index 00000000..6f528fea
--- /dev/null
+++ b/.github/workflows/build_and_test_mac.yml
@@ -0,0 +1,77 @@
+name: Build And Run Test on Mac
+
+on:
+  push:
+    branches: [ main ]
+  pull_request: 
+  workflow_dispatch:
+
+env:
+  BUILD_TYPE: Release
+  COMPILER: /usr/local/opt/llvm/bin/clang++
+  CFLAGS: -I /usr/local/include -I/usr/local/opt/llvm/include 
+  CXXFLAGS: -I /usr/local/include -I/usr/local/opt/llvm/include 
+  LDFLAGS: -L /usr/local/lib -L/usr/local/opt/llvm/lib 
+  CXX: /usr/local/opt/llvm/bin/clang++
+
+
+jobs:
+  Build_and_Run_GTest:
+    name: Build and Run GoogleTest
+    runs-on: macos-10.15
+
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        submodules: recursive
+        
+    - name: Install PreReq
+      run: brew install libtiff libomp
+
+    - name: Update Path
+      run: |
+        echo "brew --prefix llvm)/bin" >> $GITHUB_PATH
+
+    - name: Configure CMake
+      run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CLI=ON
+
+    - name: Build
+      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 2
+
+    - name: Run GTest Suite
+      working-directory: ${{github.workspace}}/build
+      # Execute tests.  
+      run: ./tests/runAllTests  -C ${{env.BUILD_TYPE}}
+      
+
+  Build_And_Run_UnitTest:
+    name: Build and Run Unit Tests
+    runs-on: macos-10.15
+
+    steps:
+    - uses: actions/checkout@v2
+      with:
+        submodules: recursive
+        
+    - name: Install PreReq
+      run: brew install libtiff libomp
+
+    - name: Update Path
+      run: |
+        echo "brew --prefix llvm)/bin" >> $GITHUB_PATH
+
+    - name: Setup Python
+      uses: actions/setup-python@v2
+      with:
+        python-version: "3.x"
+
+    - name: Install Dependencies
+      run: python3 -m pip install --upgrade wheel numpy pandas
+
+    - name: Install Nyxus
+      working-directory: ${{github.workspace}}
+      run: python3 setup.py install
+
+    - name: Run Unit Tests
+      working-directory: ${{github.workspace}}
+      run: python3 -m unittest discover tests/python/
\ No newline at end of file
diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test_ubuntu.yml
similarity index 78%
rename from .github/workflows/build_and_test.yml
rename to .github/workflows/build_and_test_ubuntu.yml
index e060a5b8..d1aa3a45 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test_ubuntu.yml
@@ -1,15 +1,17 @@
-name: Build And Run Test
+name: Build And Run Test on Ubuntu
 
 on:
   push:
     branches: [ main ]
   pull_request: 
+  workflow_dispatch:
 
 env:
   BUILD_TYPE: Release
 
 jobs:
-  build_and_run_GTest:
+  Build_and_Run_GTest:
+    name: Build and Run GoogleTest
     runs-on: ubuntu-latest
 
     steps:
@@ -32,7 +34,8 @@ jobs:
       run: ./tests/runAllTests  -C ${{env.BUILD_TYPE}}
       
 
-  build_and_run_PyTest:
+  Build_and_Run_UnitTest:
+    name: Build and Run Unit Tests
     runs-on: ubuntu-latest
 
     steps:
@@ -43,19 +46,18 @@ jobs:
     - name: Install LibTiff
       run: sudo apt install libtiff-dev
       
-    # Setup Python for PyTest
     - name: Setup Python
       uses: actions/setup-python@v2
       with:
         python-version: "3.x"
 
     - name: Install Dependencies
-      run: python -m pip install --upgrade wheel numpy pandas pytest
+      run: python -m pip install --upgrade wheel numpy pandas
 
     - name: Install Nyxus
       working-directory: ${{github.workspace}}
       run: python3 setup.py install
 
-    - name: Run PyTest
+    - name: Run Unit Tests
       working-directory: ${{github.workspace}}
-      run: pytest tests/python/
\ No newline at end of file
+      run: python3 -m unittest discover tests/python/
\ No newline at end of file
diff --git a/tests/python/__init__.py b/tests/python/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/python/test_dummy.py b/tests/python/test_dummy.py
deleted file mode 100644
index abb07d27..00000000
--- a/tests/python/test_dummy.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from numpy import True_
-
-
-def test_dummy():
-    assert True
\ No newline at end of file
diff --git a/tests/python/test_nyxus.py b/tests/python/test_nyxus.py
new file mode 100644
index 00000000..a5966074
--- /dev/null
+++ b/tests/python/test_nyxus.py
@@ -0,0 +1,7 @@
+import nyxus
+import unittest
+
+class TestNyxus(unittest.TestCase):
+
+    def test_import_module(self):
+        self.assertEqual(nyxus.__name__ , "nyxus")
\ No newline at end of file