def extensions(): from Cython.Build import cythonize from numpy import get_include as np_get_include np_inc = np_get_include() common_cflags = [ '-O3', ] fasthist_module = Extension( 'westpa.fasthist._fasthist', sources=['src/westpa/fasthist/_fasthist.pyx'], include_dirs=[np_inc], extra_compile_args=common_cflags, ) trajtree_module = Extension( 'westpa.trajtree._trajtree', sources=['src/westpa/trajtree/_trajtree.pyx'], include_dirs=[np_inc], extra_compile_args=common_cflags, ) mclib_module = Extension('westpa.mclib._mclib', sources=['src/westpa/mclib/_mclib.pyx'], include_dirs=[np_inc], extra_compile_args=common_cflags) binning_module = Extension( 'westpa.core.binning._assign', sources=['src/westpa/core/binning/_assign.pyx'], include_dirs=[np_inc], extra_compile_args=common_cflags, ) kinetics_module = Extension( 'westpa.core.kinetics._kinetics', sources=['src/westpa/core/kinetics/_kinetics.pyx'], include_dirs=[np_inc], extra_compile_args=common_cflags, ) reweight_module = Extension( 'westpa.core.reweight._reweight', sources=['src/westpa/core/reweight/_reweight.pyx'], include_dirs=[np_inc], extra_compile_args=common_cflags, ) exts = [ fasthist_module, trajtree_module, mclib_module, binning_module, kinetics_module, reweight_module ] exts = cythonize(exts, language_level=sys.version_info[0]) return exts
def extensions(): from Cython.Build import cythonize from numpy import get_include as np_get_include pybind_inc = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'ext', 'pybind11', 'include') assert os.path.exists( pybind_inc), 'pybind11 headers not found at %s' % pybind_inc from mdtraj import capi as mdtraj_capi mdtraj_inc = mdtraj_capi()['include_dir'] mdtraj_lib = mdtraj_capi()['lib_dir'] lib_prefix = 'lib' if sys.platform.startswith('win') else '' common_cflags = [ '-O3', ] clustering_module = \ Extension('pyerna.coordinates.clustering._ext', sources=['pyerna/coordinates/clustering/src/clustering_module.cpp'], include_dirs=[ mdtraj_inc, pybind_inc, 'pyerna/coordinates/clustering/include', ], language='c++', libraries=[lib_prefix+'theobald'], library_dirs=[mdtraj_lib], extra_compile_args=common_cflags) covar_module = \ Extension('pyerna._ext.variational.estimators.covar_c._covartools', sources=['pyerna/_ext/variational/estimators/covar_c/covartools.cpp'], include_dirs=['pyerna/_ext/variational/estimators/covar_c/', pybind_inc, ], language='c++', extra_compile_args=common_cflags) eig_qr_module = \ Extension('pyerna._ext.variational.solvers.eig_qr.eig_qr', sources=['pyerna/_ext/variational/solvers/eig_qr/eig_qr.pyx'], include_dirs=['pyerna/_ext/variational/solvers/eig_qr/'], extra_compile_args=['-std=c99'] + common_cflags) orderedset = \ Extension('pyerna._ext.orderedset._orderedset', sources=['pyerna/_ext/orderedset/_orderedset.pyx'], extra_compile_args=['-std=c99'] + common_cflags) extra_compile_args = ["-O3", "-std=c99"] ext_bar = Extension("pyerna.thermo.extensions.bar", sources=[ "pyerna/thermo/extensions/bar/bar.pyx", "pyerna/thermo/extensions/bar/_bar.c", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args) ext_wham = Extension("pyerna.thermo.extensions.wham", sources=[ "pyerna/thermo/extensions/wham/wham.pyx", "pyerna/thermo/extensions/wham/_wham.c", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args) ext_mbar = Extension("pyerna.thermo.extensions.mbar", sources=[ "pyerna/thermo/extensions/mbar/mbar.pyx", "pyerna/thermo/extensions/mbar/_mbar.c", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args) ext_tram = Extension("pyerna.thermo.extensions.tram", sources=[ "pyerna/thermo/extensions/tram/tram.pyx", "pyerna/thermo/extensions/tram/_tram.c", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args) ext_dtram = Extension("pyerna.thermo.extensions.dtram", sources=[ "pyerna/thermo/extensions/dtram/dtram.pyx", "pyerna/thermo/extensions/dtram/_dtram.c", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args) ext_trammbar = Extension( "pyerna.thermo.extensions.trammbar", sources=[ "pyerna/thermo/extensions/trammbar/trammbar.pyx", "pyerna/thermo/extensions/tram/_tram.c", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args + ["-DTRAMMBAR"]) ext_mbar_direct = Extension( "pyerna.thermo.extensions.mbar_direct", sources=[ "pyerna/thermo/extensions/mbar_direct/mbar_direct.pyx", "pyerna/thermo/extensions/mbar_direct/_mbar_direct.c", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args) ext_tram_direct = Extension( "pyerna.thermo.extensions.tram_direct", sources=[ "pyerna/thermo/extensions/tram_direct/tram_direct.pyx", "pyerna/thermo/extensions/tram_direct/_tram_direct.c", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args) ext_trammbar_direct = Extension( "pyerna.thermo.extensions.trammbar_direct", sources=[ "pyerna/thermo/extensions/trammbar_direct/trammbar_direct.pyx", "pyerna/thermo/extensions/tram_direct/_tram_direct.c", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args + ["-DTRAMMBAR"]) ext_util = Extension("pyerna.thermo.extensions.util", sources=[ "pyerna/thermo/extensions/util/util.pyx", "pyerna/thermo/extensions/util/_util.c" ], extra_compile_args=extra_compile_args) exts_thermo = [ ext_bar, ext_wham, ext_mbar, ext_tram, ext_dtram, ext_trammbar, ext_mbar_direct, ext_tram_direct, ext_trammbar_direct, ext_util ] exts = [clustering_module, covar_module, eig_qr_module, orderedset] exts += exts_thermo # Note, that we add numpy include to every extension after declaration. np_inc = np_get_include() for e in exts: e.include_dirs.append(np_inc) exts = cythonize(exts, language_level=sys.version_info[0]) return exts
dist.Distribution().fetch_build_eggs(['numpy']) from numpy import get_include as np_get_include import causalml with open("README.md", "r", encoding="utf-8") as f: long_description = f.read() with open("requirements.txt") as f: requirements = f.readlines() extensions = [ Extension("causalml.inference.tree.causaltree", ["causalml/inference/tree/causaltree.pyx"], libraries=[], include_dirs=[np_get_include()], extra_compile_args=["-O3"]), Extension("causalml.inference.tree.uplift", ["causalml/inference/tree/uplift.pyx"], libraries=[], include_dirs=[np_get_include()], extra_compile_args=["-O3"]) ] packages = find_packages() setup( name="causalml", version=causalml.__version__, author= "Huigang Chen, Totte Harinen, Jeong-Yoon Lee, Yuchen Luo, Jing Pan, Mike Yung, Zhenyu Zhao",
except ImportError: print "ERROR - please install the cython dependency manually:" print "pip install cython" sys_exit( 1 ) try: from numpy import get_include as np_get_include except ImportError: print "ERROR - please install the numpy dependency manually:" print "pip install numpy" sys_exit( 1 ) ext_lse = Extension( "pytram.lse", sources=["ext/lse/lse.pyx", "ext/lse/_lse.c" ], include_dirs=[np_get_include()], extra_compile_args=["-O3"] ) ext_dtram = Extension( "pytram._dtram.ext", sources=["ext/dtram/dtram.pyx", "ext/dtram/_dtram.c", "ext/lse/_lse.c" ], include_dirs=[np_get_include()], extra_compile_args=["-O3"] ) ext_xtram = Extension( "pytram._xtram.ext", sources=["ext/xtram/xtram.pyx", "ext/xtram/_xtram.c" ], include_dirs=[np_get_include()], extra_compile_args=["-O3"] )
lib_dirs = [ blas_opt['library_dirs'][0], lapack_opt['library_dirs'][0], config_path ] # Compile resource information needed by seispy.signal.detect module eigen_path = os.getcwd() + "/seispy/signal/src" # Add statistics and detect extension modules from the seispy.signal # sub-module. kwargs['ext_modules'] = [ Extension('seispy.signal.statistics', ['seispy/signal/statistics.f90'], libraries=libs, library_dirs=lib_dirs, extra_link_args=['-llapack', '-lblas']), Extension( 'seispy.signal.detect', sources=['seispy/signal/src/detect.cc', 'seispy/signal/src/picker.cc'], include_dirs=[np_get_include(), eigen_path], extra_compile_args=['-O3']), Extension('seispy.hypocenter.accelerate', sources=['seispy/hypocenter/accelerate.cc']) ] kwargs['packages'] = ['seispy', 'seispy.signal', 'seispy.hypocenter'] kwargs['package_dir'] = {'seispy': 'seispy'} # If $ANTELOPE environment variable is not initialized, install only the # portions of the distribution that will operate independently of # Antelope. try: antelope_dir = os.environ['ANTELOPE'] except KeyError: print "INFO:: $ANTELOPE environment variable not detected." print "INFO:: Installing Antelope independent components only." setup(**kwargs)
return libraries,library_dirs,include_dirs # Now use the above function to set up our extension library's needs: ext_libraries, ext_library_dirs, ext_include_dirs = pkg_config(pkg_libraries=["lal","lalsimulation","lalinspiral"]) # Setup our swig options. We need the first two to match with how the swiglal # wrappings are compiled, so that our module can talk to theirs. Then we must # reassemble the include_dirs to add the "-I" so swig can find things ext_swig_opts = ['-O','-keyword','-builtin','-outdir','pycbc'] for libpath in ext_include_dirs: ext_swig_opts.append('-I'+str(libpath)) # Numpy include must be added separately: ext_include_dirs += [np_get_include()] # Define our extension module pycbc_headers = [] lalwrap_module = Extension('_lalwrap', sources=['include/lalwrap.i'], depends=['include/pycbc_laltypes.i'], swig_opts=ext_swig_opts, include_dirs=ext_include_dirs, library_dirs=ext_library_dirs, libraries=ext_libraries, extra_compile_args=['-std=c99'] ) pycbc_headers.append('include/lalwrap.i') pycbc_headers.append('include/pycbc_laltypes.i') testlalwrap_module = Extension('_testlalwrap',