-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c9ef8d
commit 9b9accd
Showing
3 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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], | ||
), | ||
] | ||
) |