Skip to content

Commit

Permalink
-cmake for linux compile
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyill committed Oct 14, 2018
1 parent 01d86d0 commit e46c7ab
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 145 deletions.
4 changes: 2 additions & 2 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# skynet
SkyNet is a deep learning library designed for both efficiency and flexibility. It allows you to mix the flavours of deep learning programs together to maximize the efficiency and your productivity.

on development stage
This package supports Linux, and Windows platforms.
26 changes: 24 additions & 2 deletions python/libskynet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#
#!/usr/bin/env python

# SkyNet Project
# Copyright (C) 2018 by Contributors <https:#github.com/Tyill/skynet>
#
Expand All @@ -22,11 +23,17 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

# coding: utf-8

from __future__ import absolute_import
import os
import ctypes


from . import snNet
from . import snType
from . import snOperator

libname = 'libskynet.so'
if os.name == 'nt':
libname = 'libskynet.dll'
Expand All @@ -36,6 +43,21 @@

_LIB = ctypes.CDLL(libname)

__all__ = ["snType", "snNet", "snOperator"]

def _snVersionLib() -> str:
"""
version library
:return: version
"""

pfun = _LIB.snVersionLib
pfun.restype = None
pfun.argtypes = (ctypes.c_char_p,)

ver = ctypes.create_string_buffer(32)
pfun(ver)

return ver.value.decode("utf-8")

# current version
__version__ = _snVersionLib()
76 changes: 0 additions & 76 deletions python/libskynet/snExample.py

This file was deleted.

46 changes: 0 additions & 46 deletions python/libskynet/snLibInfo.py

This file was deleted.

9 changes: 4 additions & 5 deletions python/libskynet/snNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
# THE SOFTWARE.
import ctypes

from __init__ import _LIB
from libskynet.__init__ import _LIB
import json
from snBase import*
import snOperator
from libskynet.snBase import*
import numpy

class Net():
Expand Down Expand Up @@ -79,7 +78,7 @@ def getErrorStr(self) -> str:
return err


def addNode(self, name : str, nd : snOperator, nextNodes : str):
def addNode(self, name : str, nd, nextNodes : str):
"""
add Node
:param name: name node
Expand All @@ -92,7 +91,7 @@ def addNode(self, name : str, nd : snOperator, nextNodes : str):
return self


def updateNode(self, name : str, nd : snOperator) -> bool:
def updateNode(self, name : str, nd) -> bool:
"""
Update params node
:param name: name node
Expand Down
2 changes: 1 addition & 1 deletion python/libskynet/snOperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from snType import *
from libskynet.snType import *

class Input():
"""Input layer."""
Expand Down
39 changes: 26 additions & 13 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,35 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from setuptools import setup, find_packages

"""Setup skynet package."""
from __future__ import absolute_import
import os
import sys

from setuptools import find_packages

kwargs = {}
if "--inplace" in sys.argv:
from distutils.core import setup
from distutils.extension import Extension
else:
from setuptools import setup
from setuptools.extension import Extension
kwargs = {'install_requires': ['numpy<=1.15.2,>=1.8.2', 'requests<2.19.0,>=2.18.4', 'graphviz<0.9.0,>=0.8.1'], 'zip_safe': False}

with open("README.md", "r") as fh:
long_description = fh.read()

CURRENT_DIR = os.path.normpath(os.path.dirname(__file__))
libinfo_py = os.path.join(CURRENT_DIR, 'libskynet/snLibInfo.py')
libinfo = {'__file__': libinfo_py}
exec(compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'), libinfo, libinfo)

dll_path = os.listdir(os.path.join(CURRENT_DIR, 'dll'))
lib_path = [os.path.join(CURRENT_DIR, 'dll') + os.path.sep + p for p in dll_path]
if os.name == 'nt':
trgPath = 'lib/site-packages/libskynet'
else:
trgPath = 'lib/python3.5/dist-packages/libskynet'

dll_path = os.listdir(os.path.join(CURRENT_DIR, 'lib'))
lib_path = [os.path.join(CURRENT_DIR, 'lib') + os.path.sep + p for p in dll_path]

__version__ = libinfo['__version__']
__version__ = '1.0.1'

setup(
name="libskynet",
Expand All @@ -49,20 +60,22 @@
description="neural net with blackjack and hookers",
long_description=long_description,
long_description_content_type="text/markdown",
data_files=[('lib/site-packages/libskynet', lib_path)],
data_files=[(trgPath, lib_path)],
classifiers=[
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Programming Language :: C++',
'Programming Language :: Python :: 3',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
]
)
],
**kwargs)

0 comments on commit e46c7ab

Please sign in to comment.