-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
70 lines (63 loc) · 2.04 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from setuptools import setup, Extension, find_packages
from Cython.Build import cythonize
import numpy
import os
def build_ext(srcs, package="puffergrid"):
return Extension(
name=package + "." + srcs[0].split('/')[-1].split('.')[0],
sources=srcs,
define_macros=[('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')],
include_dirs=[numpy.get_include()],
)
ext_modules = [
build_ext(["puffergrid/action.pyx"]),
build_ext(["puffergrid/event.pyx"]),
build_ext(["puffergrid/grid.cpp"]),
build_ext(["puffergrid/grid_env.pyx"]),
build_ext(["puffergrid/grid_object.pyx"]),
build_ext(["puffergrid/observation_encoder.pyx"]),
build_ext(["puffergrid/stats_tracker.pyx"]),
build_ext(["examples/forage.pyx"], "puffergrid.examples"),
build_ext(["tests/test_grid_object.pyx"], "puffergrid.tests"),
build_ext(["tests/test_action_handler.pyx"], "puffergrid.tests"),
]
debug = os.getenv('DEBUG', '0') == '1'
annotate = os.getenv('ANNOTATE', '0') == '1'
build_dir = 'build'
if debug:
build_dir = 'build_debug'
os.makedirs(build_dir, exist_ok=True)
os.makedirs("puffergrid/tests", exist_ok=True)
os.makedirs("puffergrid/examples", exist_ok=True)
setup(
name='puffergrid',
packages=find_packages(),
ext_modules=cythonize(
ext_modules,
build_dir=build_dir,
compiler_directives={
"profile": True,
"language_level": "3",
"embedsignature": debug,
"annotation_typing": debug,
"cdivision": debug,
"boundscheck": debug,
"wraparound": debug,
"initializedcheck": debug,
"nonecheck": debug,
"overflowcheck": debug,
"overflowcheck.fold": debug,
"linetrace": debug,
"c_string_encoding": "utf-8",
"c_string_type": "str",
},
annotate=debug or annotate,
),
description='',
url='https://github.com/daveey/puffergrid',
install_requires=[
'numpy',
'cython==3.0.11',
'tqdm',
],
)