diff --git a/.travis.yml b/.travis.yml index 2351e186..3e15883e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,9 @@ script: - ./build-travis.sh - cd build/test/ - ./run_all_test.sh - - cd ../python-package/test/ - - python test_python.py test_data_conversion.py + - cd ../python-package + - sudo python setup.py install + - cd test/ + - sudo pip install scikit-learn cython pandas + - python test_python.py + - python test_data_conversion.py diff --git a/appveyor.yml b/appveyor.yml index 47e8a113..07118c75 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,15 +1,41 @@ image: Visual Studio 2017 build_script: - mkdir build_win && - cd build_win && - cmake -G "Visual Studio 15 Win64" ../ && - MSBuild xLearn.sln /p:Configuration=Release && - cd python-package && - C:\\Python36-x64\\Scripts\\pip install wheel numpy scipy scikit-learn cython && - C:\\Python36-x64\\python.exe setup.py bdist_wheel --python-tag py3 + - cmd: mkdir build_win + - cmd: cd build_win + - cmd: cmake -G "Visual Studio 15 Win64" ../ + - cmd: MSBuild xLearn.sln /p:Configuration=Release + - cmd: cd python-package + - cmd: C:\Python36-x64\Scripts\pip install wheel cython + - cmd: C:\Python36-x64\python.exe setup.py bdist_wheel --universal --plat-name win_amd64 test_script: - cd ..\test && - .\run_all_test.bat + - cmd: cd ..\test + - cmd: .\run_all_test.bat + - cmd: cd ..\python-package\test + - cmd: dir /b ..\dist\*.whl>whlname + - cmd: set/p pkage=>> import xlearn as xl @@ -99,5 +114,5 @@ You will see the following message if the installation is successful: :: > <| |___| __/ (_| | | | | | | /_/\_\_____/\___|\__,_|_| |_| |_| - xLearn -- 0.42 Version -- + xLearn -- 0.43 Version -- ------------------------------------------------------------------------- diff --git a/python-package/setup.py b/python-package/setup.py index 60ad26d8..790bb845 100644 --- a/python-package/setup.py +++ b/python-package/setup.py @@ -39,6 +39,10 @@ # this will use MANIFEST.in during install where we specify additional files, # this is the golden line include_package_data=True, + install_requires=[ + "numpy", + "scipy" + ], data_files=[('xlearn', LIB_PATH)], license='Apache-2.0', classifiers=['License :: OSI Approved :: Apache Software License'], diff --git a/python-package/setup_pip.py b/python-package/setup_pip.py index 567774ce..564cba67 100644 --- a/python-package/setup_pip.py +++ b/python-package/setup_pip.py @@ -120,6 +120,10 @@ def run(self): # this will use MANIFEST.in during install where we specify additional files, # this is the golden line include_package_data=True, + install_requires=[ + "numpy", + "scipy" + ], # move data to MANIFEST.in license='Apache-2.0', classifiers=['License :: OSI Approved :: Apache Software License'], diff --git a/python-package/xlearn/base.py b/python-package/xlearn/base.py index 914cfd22..0d70de63 100644 --- a/python-package/xlearn/base.py +++ b/python-package/xlearn/base.py @@ -100,3 +100,17 @@ def c_str(string): Hello, world! """ return ctypes.c_char_p(string.encode('utf-8')) + +"""pandas""" +try: + from pandas import Series, DataFrame +except ImportError: + class Series(object): + """Dummy class for pandas.Series.""" + + pass + + class DataFrame(object): + """Dummy class for pandas.DataFrame.""" + + pass diff --git a/python-package/xlearn/data.py b/python-package/xlearn/data.py index eef587cd..37aba623 100644 --- a/python-package/xlearn/data.py +++ b/python-package/xlearn/data.py @@ -16,7 +16,7 @@ import os, ctypes from numpy import ndarray -from pandas import DataFrame, Series +from .base import DataFrame, Series import numpy as np from .base import _LIB, XLearnHandle from .base import _check_call, c_str diff --git a/python-package/xlearn/xlearn.py b/python-package/xlearn/xlearn.py index 43fbe9ab..b3cfeaee 100644 --- a/python-package/xlearn/xlearn.py +++ b/python-package/xlearn/xlearn.py @@ -17,7 +17,7 @@ import os import ctypes from numpy import ndarray -from pandas import DataFrame +from .base import Series, DataFrame import numpy as np from .base import _LIB, XLearnHandle from .base import _check_call, c_str diff --git a/src/base/mman.h b/src/base/mman.h index b3e74880..2ca21af5 100644 --- a/src/base/mman.h +++ b/src/base/mman.h @@ -22,6 +22,8 @@ #ifndef _SYS_MMAN_H_ #define _SYS_MMAN_H_ +#pragma warning(disable : 4996) + // All the headers include this file. #define NOMINMAX #define WIN32_LEAN_AND_MEAN diff --git a/src/base/unistd.h b/src/base/unistd.h index 5ca097c2..e64f68a1 100644 --- a/src/base/unistd.h +++ b/src/base/unistd.h @@ -22,6 +22,9 @@ */ #ifndef PS_WINDOWS_UNISTD_H_ #define PS_WINDOWS_UNISTD_H_ + +#pragma warning(disable : 4996) + #include #include // #include "getopt.h" /* getopt at: https://gist.github.com/ashelly/7776712 */ diff --git a/src/base/utsname.h b/src/base/utsname.h index f32cda4e..d3139605 100644 --- a/src/base/utsname.h +++ b/src/base/utsname.h @@ -39,6 +39,8 @@ #ifndef UTSNAME_H_ #define UTSNAME_H_ +#pragma warning(disable : 4996) + #define WIN32_LEAN_AND_MEAN #include #include diff --git a/windows/xLearn.sln b/windows/xLearn.sln new file mode 100644 index 00000000..d1065718 --- /dev/null +++ b/windows/xLearn.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.168 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xlearn_train", "xlearn_train\xlearn_train.vcxproj", "{FD705045-26E1-4204-AEF2-621368DAFE45}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xlearn_predict", "xlearn_predict\xlearn_predict.vcxproj", "{F892F54F-DA03-4C29-AB09-0F7966CCDA31}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xlearn_api", "xlearn_api\xlearn_api.vcxproj", "{70B829CF-DDA3-485E-A910-CD8B2DDECA80}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FD705045-26E1-4204-AEF2-621368DAFE45}.Debug|x64.ActiveCfg = Debug|x64 + {FD705045-26E1-4204-AEF2-621368DAFE45}.Debug|x64.Build.0 = Debug|x64 + {FD705045-26E1-4204-AEF2-621368DAFE45}.Debug|x86.ActiveCfg = Debug|Win32 + {FD705045-26E1-4204-AEF2-621368DAFE45}.Debug|x86.Build.0 = Debug|Win32 + {FD705045-26E1-4204-AEF2-621368DAFE45}.Release|x64.ActiveCfg = Release|x64 + {FD705045-26E1-4204-AEF2-621368DAFE45}.Release|x64.Build.0 = Release|x64 + {FD705045-26E1-4204-AEF2-621368DAFE45}.Release|x86.ActiveCfg = Release|Win32 + {FD705045-26E1-4204-AEF2-621368DAFE45}.Release|x86.Build.0 = Release|Win32 + {F892F54F-DA03-4C29-AB09-0F7966CCDA31}.Debug|x64.ActiveCfg = Debug|x64 + {F892F54F-DA03-4C29-AB09-0F7966CCDA31}.Debug|x64.Build.0 = Debug|x64 + {F892F54F-DA03-4C29-AB09-0F7966CCDA31}.Debug|x86.ActiveCfg = Debug|Win32 + {F892F54F-DA03-4C29-AB09-0F7966CCDA31}.Debug|x86.Build.0 = Debug|Win32 + {F892F54F-DA03-4C29-AB09-0F7966CCDA31}.Release|x64.ActiveCfg = Release|x64 + {F892F54F-DA03-4C29-AB09-0F7966CCDA31}.Release|x64.Build.0 = Release|x64 + {F892F54F-DA03-4C29-AB09-0F7966CCDA31}.Release|x86.ActiveCfg = Release|Win32 + {F892F54F-DA03-4C29-AB09-0F7966CCDA31}.Release|x86.Build.0 = Release|Win32 + {70B829CF-DDA3-485E-A910-CD8B2DDECA80}.Debug|x64.ActiveCfg = Debug|x64 + {70B829CF-DDA3-485E-A910-CD8B2DDECA80}.Debug|x64.Build.0 = Debug|x64 + {70B829CF-DDA3-485E-A910-CD8B2DDECA80}.Debug|x86.ActiveCfg = Debug|Win32 + {70B829CF-DDA3-485E-A910-CD8B2DDECA80}.Debug|x86.Build.0 = Debug|Win32 + {70B829CF-DDA3-485E-A910-CD8B2DDECA80}.Release|x64.ActiveCfg = Release|x64 + {70B829CF-DDA3-485E-A910-CD8B2DDECA80}.Release|x64.Build.0 = Release|x64 + {70B829CF-DDA3-485E-A910-CD8B2DDECA80}.Release|x86.ActiveCfg = Release|Win32 + {70B829CF-DDA3-485E-A910-CD8B2DDECA80}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A264F9F9-595E-4008-8E04-A7FACAF5BC3E} + EndGlobalSection +EndGlobal diff --git a/windows/xlearn_api/xlearn_api.vcxproj b/windows/xlearn_api/xlearn_api.vcxproj new file mode 100644 index 00000000..9f0023b3 --- /dev/null +++ b/windows/xlearn_api/xlearn_api.vcxproj @@ -0,0 +1,206 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {70B829CF-DDA3-485E-A910-CD8B2DDECA80} + xlearnapi + 10.0.17763.0 + + + + DynamicLibrary + true + v141 + MultiByte + + + DynamicLibrary + false + v141 + true + MultiByte + + + DynamicLibrary + true + v141 + MultiByte + + + DynamicLibrary + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + Ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + Disabled + true + true + + + Ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + Disabled + true + true + + + Ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + Ws2_32.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/xlearn_api/xlearn_api.vcxproj.filters b/windows/xlearn_api/xlearn_api.vcxproj.filters new file mode 100644 index 00000000..9ed10030 --- /dev/null +++ b/windows/xlearn_api/xlearn_api.vcxproj.filters @@ -0,0 +1,225 @@ + + + + + {1ba43176-8b02-4790-a713-c707dc1abed6} + + + {21d81980-7c5a-4983-96ad-509795c0e9a0} + + + {ee6c1683-16be-4ca8-97ec-5f4e50d2c388} + + + {95f8d793-241a-48da-8c5c-0c50bde04730} + + + {5aae936c-ebfe-45be-a64e-63284e4daeb5} + + + {31098655-17e4-430b-9288-dbc3535809f5} + + + {23ad8980-5673-4e45-91a2-1b71630c3cc0} + + + {3eb1a849-005c-44aa-b6cf-21293e4efa85} + + + {fc5e839f-531b-4e19-b4df-cb6235fe54b2} + + + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\c_api + + + src\c_api + + + src\data + + + src\data + + + src\data + + + src\distributed + + + src\loss + + + src\loss + + + src\loss + + + src\loss + + + src\reader + + + src\reader + + + src\reader + + + src\score + + + src\score + + + src\score + + + src\score + + + src\solver + + + src\solver + + + src\solver + + + src\solver + + + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\c_api + + + src\c_api + + + src\data + + + src\distributed + + + src\loss + + + src\loss + + + src\loss + + + src\loss + + + src\reader + + + src\reader + + + src\reader + + + src\score + + + src\score + + + src\score + + + src\score + + + src\solver + + + src\solver + + + src\solver + + + src\solver + + + \ No newline at end of file diff --git a/windows/xlearn_predict/xlearn_predict.vcxproj b/windows/xlearn_predict/xlearn_predict.vcxproj new file mode 100644 index 00000000..45ceff99 --- /dev/null +++ b/windows/xlearn_predict/xlearn_predict.vcxproj @@ -0,0 +1,207 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {F892F54F-DA03-4C29-AB09-0F7966CCDA31} + xlearnpredict + 10.0.17763.0 + + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + + Level3 + Disabled + true + true + + + Ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + Disabled + true + true + + + Ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + Ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + Ws2_32.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/xlearn_predict/xlearn_predict.vcxproj.filters b/windows/xlearn_predict/xlearn_predict.vcxproj.filters new file mode 100644 index 00000000..f7d55f17 --- /dev/null +++ b/windows/xlearn_predict/xlearn_predict.vcxproj.filters @@ -0,0 +1,228 @@ + + + + + {4a227512-09e4-4769-b5fd-8cdcbe72f720} + + + {5f7b595a-40ce-4bb5-8ad6-d3b2b28b7e44} + + + {562e4cc3-3785-4a36-a590-b0fb94d885d6} + + + {2590c0d0-fc6a-4c4d-9013-9e4f0c4bc50c} + + + {0925ac12-9624-42fe-9e04-4bfe457fe894} + + + {d14fd247-3cfd-4094-a5f7-e07ac29b357d} + + + {8c72aaec-70bb-40c4-bba6-8a04e504c744} + + + {eed23268-c395-4d76-875a-517980b62b19} + + + {058de33b-8111-473a-8029-39d844074111} + + + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\c_api + + + src\c_api + + + src\data + + + src\data + + + src\data + + + src\distributed + + + src\loss + + + src\loss + + + src\loss + + + src\loss + + + src\reader + + + src\reader + + + src\reader + + + src\score + + + src\score + + + src\score + + + src\score + + + src\solver + + + src\solver + + + src\solver + + + src\solver + + + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\c_api + + + src\c_api + + + src\data + + + src\distributed + + + src\loss + + + src\loss + + + src\loss + + + src\loss + + + src\reader + + + src\reader + + + src\reader + + + src\score + + + src\score + + + src\score + + + src\score + + + src\solver + + + src\solver + + + src\solver + + + src\solver + + + src\solver + + + \ No newline at end of file diff --git a/windows/xlearn_train/xlearn_train.vcxproj b/windows/xlearn_train/xlearn_train.vcxproj new file mode 100644 index 00000000..44f6376a --- /dev/null +++ b/windows/xlearn_train/xlearn_train.vcxproj @@ -0,0 +1,207 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {FD705045-26E1-4204-AEF2-621368DAFE45} + xlearntrain + 10.0.17763.0 + + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\; + + + + Level3 + Disabled + true + true + + + Ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + Disabled + true + true + + + Ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + Ws2_32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + true + true + true + + + true + true + Ws2_32.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/windows/xlearn_train/xlearn_train.vcxproj.filters b/windows/xlearn_train/xlearn_train.vcxproj.filters new file mode 100644 index 00000000..fcd4959c --- /dev/null +++ b/windows/xlearn_train/xlearn_train.vcxproj.filters @@ -0,0 +1,228 @@ + + + + + {0592b733-930d-4743-a186-b60f53c0983d} + + + {20af0d27-8b40-4a4d-bd6f-85273c63ffe2} + + + {a04ac42b-343e-438c-a94d-87a133dd2b4b} + + + {04a15749-dc8e-433c-96e3-fd1aa6e36f62} + + + {2ce9d0b6-d8a3-41c6-9109-cf2faf226be9} + + + {a3669496-2948-48e1-81f9-523e8b774ccc} + + + {1481e781-12d5-42f4-8a8a-ef35eade6979} + + + {78ee8558-1e50-4d53-a09c-42872ee8102c} + + + {47c80e64-02e6-4e24-9c64-0de50d0f3e9c} + + + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\c_api + + + src\c_api + + + src\data + + + src\data + + + src\data + + + src\distributed + + + src\loss + + + src\loss + + + src\loss + + + src\loss + + + src\reader + + + src\reader + + + src\reader + + + src\score + + + src\score + + + src\score + + + src\score + + + src\solver + + + src\solver + + + src\solver + + + src\solver + + + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\base + + + src\c_api + + + src\c_api + + + src\data + + + src\distributed + + + src\loss + + + src\loss + + + src\loss + + + src\loss + + + src\reader + + + src\reader + + + src\reader + + + src\score + + + src\score + + + src\score + + + src\score + + + src\solver + + + src\solver + + + src\solver + + + src\solver + + + src\solver + + + \ No newline at end of file