Skip to content

Commit

Permalink
Merge pull request #249 from etveritas/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
aksnzhy authored Apr 19, 2019
2 parents e211a5a + eda2ea6 commit 2c039b6
Show file tree
Hide file tree
Showing 18 changed files with 1,442 additions and 16 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 35 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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=<whlname
- cmd: set pkagepath=..\dist\%pkage%
- cmd: C:\Python27-x64\Scripts\pip install %pkagepath%
- cmd: C:\Python27-x64\Scripts\pip install wheel scikit-learn cython
- cmd: C:\Python27-x64\python.exe test_data_conversion.py
- cmd: C:\Python27-x64\python.exe test_python.py
- cmd: C:\Python37-x64\Scripts\pip install %pkagepath%
- cmd: C:\Python37-x64\Scripts\pip install wheel scikit-learn cython
- cmd: C:\Python37-x64\python.exe test_data_conversion.py
- cmd: C:\Python37-x64\python.exe test_python.py
- cmd: C:\Python36-x64\Scripts\pip install %pkagepath%
- cmd: C:\Python36-x64\Scripts\pip install wheel scikit-learn cython
- cmd: C:\Python36-x64\python.exe test_data_conversion.py
- cmd: C:\Python36-x64\python.exe test_python.py
- cmd: C:\Python35-x64\Scripts\pip install %pkagepath%
- cmd: C:\Python35-x64\Scripts\pip install wheel scikit-learn cython
- cmd: C:\Python35-x64\python.exe test_data_conversion.py
- cmd: C:\Python35-x64\python.exe test_python.py
- cmd: set VS100COMNTOOLS=%VS140COMNTOOLS%
- cmd: C:\Python34-x64\Scripts\pip install %pkagepath%
- cmd: C:\Python34-x64\Scripts\pip install --upgrade setuptools
- cmd: C:\Python34-x64\Scripts\pip install wheel scikit-learn cython
- cmd: C:\Python34-x64\python.exe test_data_conversion.py
- cmd: C:\Python34-x64\python.exe test_python.py
artifacts:
- path: build_win\Release\*.exe
name: Bits
Expand Down
21 changes: 18 additions & 3 deletions doc/install_windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ Users can test the installation by using the following command: ::

run_example.bat

Build from Visual Studio solution
=======================
This build method is optional for Build from Source Code, if you already use method above, you can skip this part.

We support an Visual Studio(vs) solution for users, it's in the directory ``windows`` which is in root of xLearn project.

There are three vs project in this solution: ``xlearn_train``, ``xlearn_test``, ``xlearn_api``, respectively relation to build executable train,predict entry program and DLL(dynamic link library) API for windows.

Users should make sure that your vs platform toolset is greater than v141(It works well if you use vs2017).

**Note:** Files(both executable file and DLL) compiling from this solution is different from cmake solution, because of different structure.

Install Python Package
=======================

Expand Down Expand Up @@ -81,9 +93,12 @@ You should make sure that you enter DOS as Administrator.
Install xLearn from pip
^^^^^^^^^^^^^^^^^^^^^^^^

We will update Python package for Windows soon later.
We provide Python package on Windows, it supports these Python(x64) versions: ``2.7, 3.4, 3.5, 3.6, 3.7``.

Users can download this binary python package from tab release_, then use ``pip`` command install the ``.whl`` file which you download.

.. _release: https://github.com/aksnzhy/xlearn/releases

The installation process will take a while to complete.
After that, you can type the following script in your python shell to check whether the xLearn has been installed successfully: ::

>>> import xlearn as xl
Expand All @@ -99,5 +114,5 @@ You will see the following message if the installation is successful: ::
> <| |___| __/ (_| | | | | | |
/_/\_\_____/\___|\__,_|_| |_| |_|

xLearn -- 0.42 Version --
xLearn -- 0.43 Version --
-------------------------------------------------------------------------
4 changes: 4 additions & 0 deletions python-package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
4 changes: 4 additions & 0 deletions python-package/setup_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
14 changes: 14 additions & 0 deletions python-package/xlearn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion python-package/xlearn/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python-package/xlearn/xlearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/base/mman.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/base/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
*/
#ifndef PS_WINDOWS_UNISTD_H_
#define PS_WINDOWS_UNISTD_H_

#pragma warning(disable : 4996)

#include <stdlib.h>
#include <io.h>
// #include "getopt.h" /* getopt at: https://gist.github.com/ashelly/7776712 */
Expand Down
2 changes: 2 additions & 0 deletions src/base/utsname.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#ifndef UTSNAME_H_
#define UTSNAME_H_

#pragma warning(disable : 4996)

#define WIN32_LEAN_AND_MEAN
#include <WinSock2.h>
#include <Windows.h>
Expand Down
51 changes: 51 additions & 0 deletions windows/xLearn.sln
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 2c039b6

Please sign in to comment.