mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-03 11:00:57 +08:00
41
setup.py
Normal file
41
setup.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from setuptools import setup, Extension
|
||||
import numpy
|
||||
import os
|
||||
|
||||
|
||||
def read(rel_path: str) -> str:
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
with open(os.path.join(here, rel_path), encoding="utf-8") as fp:
|
||||
return fp.read()
|
||||
|
||||
|
||||
def get_version(rel_path: str) -> str:
|
||||
for line in read(rel_path).splitlines():
|
||||
if line.startswith("__version__"):
|
||||
delim = '"' if '"' in line else "'"
|
||||
return line.split(delim)[1]
|
||||
raise RuntimeError("Unable to find version string.")
|
||||
|
||||
|
||||
NUMPY_INCLUDE = numpy.get_include()
|
||||
|
||||
VERSION = get_version("qlib/__init__.py")
|
||||
|
||||
|
||||
setup(
|
||||
version=VERSION,
|
||||
ext_modules=[
|
||||
Extension(
|
||||
"qlib.data._libs.rolling",
|
||||
["qlib/data/_libs/rolling.pyx"],
|
||||
language="c++",
|
||||
include_dirs=[NUMPY_INCLUDE],
|
||||
),
|
||||
Extension(
|
||||
"qlib.data._libs.expanding",
|
||||
["qlib/data/_libs/expanding.pyx"],
|
||||
language="c++",
|
||||
include_dirs=[NUMPY_INCLUDE],
|
||||
),
|
||||
],
|
||||
)
|
||||
Reference in New Issue
Block a user