def get_extensions(): ext_dirs = cwd / package_name / "cpp_exts" ext_modules = [] # Add rANS module rans_lib_dir = cwd / "third_party/ryg_rans" rans_ext_dir = ext_dirs / "rans" extra_compile_args = ["-std=c++17"] if os.getenv("DEBUG_BUILD", None): extra_compile_args += ["-O0", "-g", "-UNDEBUG"] else: extra_compile_args += ["-O3"] ext_modules.append( Pybind11Extension( name=f"{package_name}.ans", sources=[str(s) for s in rans_ext_dir.glob("*.cpp")], language="c++", include_dirs=[rans_lib_dir, rans_ext_dir], extra_compile_args=extra_compile_args, ) ) # Add ops ops_ext_dir = ext_dirs / "ops" ext_modules.append( Pybind11Extension( name=f"{package_name}._CXX", sources=[str(s) for s in ops_ext_dir.glob("*.cpp")], language="c++", extra_compile_args=extra_compile_args, ) ) return ext_modules
def main(): with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() ext_modules = [ Pybind11Extension("fistpp", _source_files(), define_macros=[('VERSION_INFO', __version__)]) ] setup(name="fistpp", version=__version__, author="Konrad Archicinski", author_email="*****@*****.**", description="Simple statistical Python package written in C++.", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/konradarchicinski/fistpp", project_urls={ "Bug Tracker": "https://github.com/konradarchicinski/fistpp/issues" }, classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent" ], ext_modules=ext_modules, cmdclass=dict(build_ext=build_ext), test_suite="tests", zip_safe=False, python_requires=">=3.6")
def get_appsi_extension(in_setup=False, appsi_root=None): from pybind11.setup_helpers import Pybind11Extension if appsi_root is None: from pyomo.common.fileutils import this_file_dir appsi_root = this_file_dir() sources = [ os.path.join(appsi_root, 'cmodel', 'src', file_) for file_ in ( 'interval.cpp', 'expression.cpp', 'common.cpp', 'nl_writer.cpp', 'lp_writer.cpp', 'model_base.cpp', 'fbbt_model.cpp', 'cmodel_bindings.cpp', ) ] if in_setup: package_name = 'pyomo.contrib.appsi.cmodel.appsi_cmodel' else: package_name = 'appsi_cmodel' return Pybind11Extension(package_name, sources, extra_compile_args=['-std=c++11'])
def get_appsi_extension(in_setup=False, appsi_root=None): from pybind11.setup_helpers import Pybind11Extension if appsi_root is None: from pyomo.common.fileutils import this_file_dir appsi_root = this_file_dir() sources = [ os.path.join(appsi_root, 'cmodel', 'src', file_) for file_ in ( 'interval.cpp', 'expression.cpp', 'common.cpp', 'nl_writer.cpp', 'lp_writer.cpp', 'model_base.cpp', 'fbbt_model.cpp', 'cmodel_bindings.cpp', ) ] if in_setup: package_name = 'pyomo.contrib.appsi.cmodel.appsi_cmodel' else: package_name = 'appsi_cmodel' if sys.platform.startswith('win'): # Assume that builds on Windows will use MSVC # MSVC doesn't have a flag for c++11, use c++14 extra_args = ['/std:c++14'] else: # Assume all other platforms are GCC-like extra_args = ['-std=c++11'] return Pybind11Extension(package_name, sources, extra_compile_args=extra_args)
def make_extensions(): from pybind11.setup_helpers import Pybind11Extension yield Pybind11Extension( "dlsym", ["src/dlsym.cpp"], cxx_std=11, libraries={ "posix": ["dl"], "nt": ["psapi"] }[os.name], )
def get_extensions(): # on macOS std::filesystem requires Catalina (10.15) or later. if sys.platform.startswith("darwin"): os.environ["MACOSX_DEPLOYMENT_TARGET"] = get_macOS_deployment_target() return [ Pybind11Extension( "stdfs", [os.path.join("src", "stdfs.cpp")], cxx_std=17, ), ]
def get_parser_ext(): """Get the parser extension.""" extra_compile_args = [] # We need some platform-dependent compile args for the C extensions. if sys.platform == 'win32': # windows does not have unistd.h; lex/yacc needs this define. extra_compile_args.append('-DYY_NO_UNISTD_H') # This is a setuptools.Extension, with an added include for pybind11, a few # flags, and a cxx_std setting. return Pybind11Extension( 'pytype.pyi.parser_ext', sources=[ 'pytype/pyi/parser_ext.cc', 'pytype/pyi/lexer.lex.cc', 'pytype/pyi/parser.tab.cc', ], cxx_std=11, extra_compile_args=extra_compile_args, )
def build_appsi(): print('\n\n**** Building APPSI ****') import setuptools from distutils.dist import Distribution import shutil import glob import os from pybind11.setup_helpers import Pybind11Extension, build_ext import pybind11.setup_helpers original_pybind11_setup_helpers_macos = pybind11.setup_helpers.MACOS pybind11.setup_helpers.MACOS = False ext_modules = [ Pybind11Extension("cmodel.cmodel", [ 'cmodel/src/expression.cpp', 'cmodel/src/common.cpp', 'cmodel/src/nl_writer.cpp', 'cmodel/src/lp_writer.cpp', 'cmodel/src/cmodel_bindings.cpp' ]) ] package_config = { 'name': 'appsi', 'packages': list(), 'ext_modules': ext_modules, 'cmdclass': { "build_ext": build_ext } } dist = Distribution(package_config) try: basedir = os.path.abspath(os.path.curdir) current_dir = os.path.dirname(os.path.abspath(__file__)) os.chdir(current_dir) dist.run_command('build_ext') library = glob.glob("build/*/cmodel/cmodel.*")[0] shutil.copy(library, 'cmodel/') finally: os.chdir(basedir) pybind11.setup_helpers.MACOS = original_pybind11_setup_helpers_macos
def get_typegraph_ext(): """Generates the typegraph extension.""" return Pybind11Extension( 'pytype.typegraph.cfg', sources=[ "pytype/typegraph/cfg.cc", "pytype/typegraph/cfg_logging.cc", "pytype/typegraph/pylogging.cc", "pytype/typegraph/reachable.cc", "pytype/typegraph/solver.cc", "pytype/typegraph/typegraph.cc", ], depends=[ "pytype/typegraph/cfg_logging.h", "pytype/typegraph/map_util.h", "pytype/typegraph/memory_util.h", "pytype/typegraph/pylogging.h", "pytype/typegraph/reachable.h", "pytype/typegraph/solver.h", "pytype/typegraph/typegraph.h", ], cxx_std=11, )
from setuptools import setup from pybind11.setup_helpers import Pybind11Extension import subprocess subprocess.run( ["make", "lib/libalephzero.a", "A0_EXT_YYJSON=1", "-j"], cwd="./alephzero", check=True, ) module = Pybind11Extension( "alephzero_bindings", sources=["module.cc"], extra_compile_args=["-flto", "-O2"], extra_objects=["./alephzero/lib/libalephzero.a"], include_dirs=[ "./alephzero/include/", "./alephzero/third_party/yyjson/src/", ], define_macros=[("A0_EXT_YYJSON", "1")], ) setup( name="alephzero", version="0.3.12", description="TODO: description", author="Leonid Shamis", author_email="*****@*****.**", url="https://github.com/alephzero/py", long_description="""TODO: long description""", ext_modules=[module],
import os from setuptools import setup from pybind11.setup_helpers import Pybind11Extension, build_ext FILE_DIR = os.path.dirname(os.path.abspath(__file__)) VERSION = '0.12.11' ext_modules = [ Pybind11Extension('mapbox_earcut', ['src/main.cpp'], include_dirs=['include'], define_macros = [('VERSION_INFO', VERSION)], ), ] def get_readme_contents(): with open(os.path.join(FILE_DIR, 'README.md'), 'r') as readme_file: return readme_file.read() setup( name='mapbox_earcut', version=VERSION, url='https://github.com/skogler/mapbox_earcut_python', author='Samuel Kogler', author_email='*****@*****.**', description= 'Python bindings for the mapbox earcut C++ polygon triangulation library.', long_description=get_readme_contents(), long_description_content_type='text/markdown', license='ISC',
__version__ = "0.0.1" # The main interface is through Pybind11Extension. # * You can add cxx_std=11/14/17, and then build_ext can be removed. # * You can set include_pybind11=false to add the include directory yourself, # say from a submodule. # # Note: # Sort input source files if you glob sources to ensure bit-for-bit # reproducible builds (https://github.com/pybind/python_example/pull/53) ext_modules = [ Pybind11Extension( "suite", ["Py/suite.cpp"], # Example: passing in the version to the compiled code define_macros=[('VERSION_INFO', __version__)], ), ] setup( name="suite", version=__version__, author="Umberto Zerbinati", author_email="*****@*****.**", url="https://github.com/UZerbinati/Suite", description="A suite of numerical stuff.", long_description="", ext_modules=ext_modules, extras_require={"test": "pytest"}, # Currently, build_ext only provides an optional "highest supported C++
def libadcc_extension(): # Initial lot of flags flags = dict( libraries=[], library_dirs=[], include_dirs=[], extra_link_args=[], extra_compile_args=["-Wall", "-Wextra", "-Werror", "-O3"], runtime_library_dirs=[], extra_objects=[], define_macros=[], search_system=True, coverage=False, libtensor_autoinstall="~/.local", libtensor_url=None, ) if sys.platform == "darwin" and is_conda_build(): flags["extra_compile_args"] += [ "-Wno-unused-command-line-argument", "-Wno-undefined-var-template" ] platform_autoinstall = (sys.platform.startswith("linux") or sys.platform.startswith("darwin")) if platform_autoinstall and not is_conda_build(): flags["libtensor_autoinstall"] = "~/.local" else: # Not yet supported on other platforms and disabled # for conda builds flags["libtensor_autoinstall"] = None # User-provided config adcc_config = os.environ.get('ADCC_CONFIG') if adcc_config and not os.path.isfile(adcc_config): raise FileNotFoundError(adcc_config) for siteconfig in [adcc_config, "siteconfig.py", "~/.adcc/siteconfig.py"]: if siteconfig is not None: siteconfig = os.path.expanduser(siteconfig) if os.path.isfile(siteconfig): log.info("Reading siteconfig file:", siteconfig) exec(open(siteconfig, "r").read(), flags) flags.pop("__builtins__") break # Keep track whether libtensor has been found found_libtensor = "tensorlight" in flags["libraries"] lt_min_version = "3.0.1" if not found_libtensor: if flags["search_system"]: # Find libtensor on the OS using pkg-config log.info("Searching OS for libtensorlight using pkg-config") cflags, libs = search_with_pkg_config("libtensorlight", lt_min_version) # Try to download libtensor if not on the OS if (cflags is None or libs is None) and flags["libtensor_autoinstall"]: if flags["libtensor_url"]: url = flags["libtensor_url"] else: assets = assets_most_recent_release("adc-connect/libtensor") url = [] if sys.platform == "linux": url = [ asset for asset in assets if "-linux_x86_64" in asset ] elif sys.platform == "darwin": url = [ asset for asset in assets if "-macosx_" in asset and "_x86_64" in asset ] else: raise AssertionError("Should not get to download for " "unspported platform.") if len(url) != 1: raise RuntimeError( "Could not find a libtensor version to download. " "Check your platform is supported and if in doubt see the " "adcc installation instructions " "(https://adc-connect.org/latest/installation.html).") url = url[0] destdir = os.path.expanduser(flags["libtensor_autoinstall"]) install_libtensor(url, destdir) os.environ['PKG_CONFIG_PATH'] += f":{destdir}/lib/pkgconfig" cflags, libs = search_with_pkg_config("libtensorlight", lt_min_version) assert cflags is not None and libs is not None if cflags is not None and libs is not None: found_libtensor = True flags["extra_compile_args"].extend(cflags) flags["extra_link_args"].extend(libs) log.info(f"Using libtensorlight libraries: {libs}.") if sys.platform == "darwin": flags["extra_link_args"].append("-Wl,-rpath,@loader_path") for path in extract_library_dirs(libs): flags["extra_link_args"].append(f"-Wl,-rpath,{path}") else: flags["runtime_library_dirs"].extend( extract_library_dirs(libs)) if not found_libtensor: raise RuntimeError("Did not find the libtensorlight library.") # Filter out the arguments to pass to Pybind11Extension extargs = { k: v for k, v in flags.items() if k in ("libraries", "library_dirs", "include_dirs", "extra_link_args", "extra_compile_args", "runtime_library_dirs", "extra_objects", "define_macros") } if have_pybind11: # This is needed on the first pass where pybind11 is not yet installed extargs["cxx_std"] = 14 ext = Pybind11Extension("libadcc", libadcc_sources("extension"), language="c++", **extargs) if flags["coverage"]: ext.extra_compile_args += ["--coverage", "-O0", "-g"] ext.extra_link_args += ["--coverage"] return ext
'-fsanitize=address', '-fno-omit-frame-pointer', '-fno-optimize-sibling-calls' ]) extra_link_args.append('-fsanitize=address') if platform.system() == 'Linux': extra_link_args.append('-static-libasan') else: extra_compile_args.extend(['-O3']) ext_modules = [ Pybind11Extension( "vectorian_core", [str(x) for x in sorted(sources)], cxx_std=17, extra_compile_args=extra_compile_args, extra_link_args=extra_link_args, define_macros=macros, include_dirs=[str(x) for x in include_dirs], ), ] exec(open("vectorian/_version.py").read()) setup( name='vectorian', version=__version__, packages=find_packages(), license='GPLv2', author='Bernhard Liebl', author_email='*****@*****.**',
__version__ = "0.3.0" # The main interface is through Pybind11Extension. # * You can add cxx_std=11/14/17, and then build_ext can be removed. # * You can set include_pybind11=false to add the include directory yourself, # say from a submodule. # # Note: # Sort input source files if you glob sources to ensure bit-for-bit # reproducible builds (https://github.com/pybind/python_example/pull/53) ext_modules = [ Pybind11Extension( "_spyder", sorted(glob("src/spyder/*.cc")), # Example: passing in the version to the compiled code define_macros=[("VERSION_INFO", __version__)], ), ] long_description = open("README.md").read() install_requires = ["click>=7.0.0", "tabulate>=0.8.9"] setup( name="spy-der", version=__version__, author="Desh Raj", author_email="*****@*****.**", url="https://github.com/desh2608/spyder", description="A simple Python package for fast DER computation",
"ompy.decomposition", ["ompy/decomposition.pyx"], # on MacOS the clang compiler pretends not to support OpenMP, but in fact it does so extra_compile_args=extra_compile_args, extra_link_args=extra_link_args, include_dirs=[numpy.get_include()]), Extension("ompy.rebin", ["ompy/rebin.pyx"], include_dirs=[numpy.get_include()]), Extension("ompy.gauss_smoothing", ["ompy/gauss_smoothing.pyx"], include_dirs=[numpy.get_include()]), ] ext_modules_pybind11 = [ Pybind11Extension("ompy.stats", ["src/stats.cpp"], extra_compile_args=[ "-std=c++11", "-mfpmath=sse", "-O3", "-funroll-loops", "-march=native" ]) ] install_requires = [ "cython", "numpy>=1.20.0", "pandas", "matplotlib", "termtables", "pymultinest", # needed only for multinest-runs "scipy", "uncertainties>=3.0.3", "tqdm", "pathos",
proj_root = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(proj_root, 'README.md'), encoding='utf-8') as f: long_description = f.read() # Note: # Sort input source files if you glob sources to ensure bit-for-bit # reproducible builds (https://github.com/pybind/python_example/pull/53) zlib_dir = 'vendor/zlib-1.2.11/' zlib_sources = [zlib_dir + fn for fn in ['adler32.c', 'compress.c', 'crc32.c', 'deflate.c', 'gzclose.c', 'gzlib.c', 'gzread.c', 'gzwrite.c', 'infback.c', 'inffast.c', 'inflate.c', 'inftrees.c', 'trees.c', 'uncompr.c', 'zutil.c']] ext_modules = [ Pybind11Extension("_pyspng_c", ["pyspng/main.cpp", "vendor/libspng-0.6.1/spng/spng.c"] + zlib_sources, include_dirs=['vendor/libspng-0.6.1', zlib_dir], # Example: passing in the version to the compiled code define_macros = [('VERSION_INFO', __version__)], ), ] setup( name="pyspng", version=__version__, author="Janne Hellsten", author_email="*****@*****.**", url="https://github.com/nurpax/pyspng", # TODO description="Fast libspng-based PNG decoder", project_urls={ 'Documentation': 'https://pyspng.readthedocs.io/', 'Tracker': 'https://github.com/nurpax/pyspng/issues', },
from setuptools import setup # Available at setup time due to pyproject.toml from pybind11.setup_helpers import Pybind11Extension, build_ext __version__ = "0.0.1" PKG_NAME: str = 'fast_gsdmm' # The main interface is through Pybind11Extension. # * You can add cxx_std=11/14/17, and then build_ext can be removed. # * You can set include_pybind11=false to add the include directory yourself, # say from a submodule. ext_modules = [ Pybind11Extension(PKG_NAME, ["src/main.cpp"], define_macros=[('VERSION_INFO', __version__)], cxx_std=17), ] with open('README.md', 'r') as _read_me: long_description = _read_me.read() setup( name=PKG_NAME, version=__version__, author="Gianni Francesco Balistreri", author_email="*****@*****.**", description= "Gibbs Sampling Dirichlet Multinomial Modeling algorithm for short-text clustering", long_description=long_description, long_description_content_type='text/markdown',
"libprotoc", "lz4", "zstd_static", "zlibstatic", "snappy", ] else: LIBS = [ "orc", "protobuf", "protoc", "lz4", "zstd", "z", "snappy", "pthread" ] EXT_MODULES = [ Pybind11Extension( "pyorc._pyorc", sources=[os.path.join("src", "_pyorc", src) for src in SOURCES], depends=[os.path.join("src", "_pyorc", hdr) for hdr in HEADERS], libraries=LIBS, include_dirs=[os.path.join("deps", "include")], library_dirs=[os.path.join("deps", "lib")], ) ] class BuildExt(build_ext): """A custom build extension for handling debug build on Windows""" def build_extensions(self): if sys.platform.startswith("win32") and self.debug: self.extensions[0].libraries = [ lib if lib != "zlibstatic" else "zlibstaticd" for lib in self.extensions[0].libraries ] super().build_extensions()
"extern/pybind11/include", "extern/assert/include", "extern/config/include", "extern/core/include", "extern/histogram/include", "extern/mp11/include", "extern/throw_exception/include", "extern/variant2/include", ] ext_modules = [ Pybind11Extension( "boost_histogram._core", SRC_FILES, include_dirs=INCLUDE_DIRS, cxx_std=cxx_std, include_pybind11=False, extra_compile_args=["/d2FH4-"] if sys.platform.startswith("win32") else [], ) ] extras = { "test": ["pytest>=6.0", "pytest-benchmark", "cloudpickle", "hypothesis>=6.0"], "docs": [ "Sphinx>=4.0", "myst_parser>=0.13", "sphinx-book-theme>=0.0.33", "nbsphinx", "sphinx_copybutton",
from pybind11.setup_helpers import Pybind11Extension, build_ext from pybind11 import get_cmake_dir import sys __version__ = "0.0.4" # The main interface is through Pybind11Extension. # * You can add cxx_std=11/14/17, and then build_ext can be removed. # * You can set include_pybind11=false to add the include directory yourself, # say from a submodule. ext_modules = [ Pybind11Extension( "pybind11_test_dmpytain", ["src/main.cpp"], # Example: passing in the version to the compiled code define_macros=[('VERSION_INFO', __version__)], ), ] with open("README.md", "r") as fh: long_description = fh.read() setup( name="pybind11_test_dmpytain", version=__version__, author="Dmitry Pyatin", author_email="*****@*****.**", url="https://github.com/dmpyatin/pybind11_test", description="A test project using pybind11", long_description=long_description,
highs_lib = find_library('highs', include_PATH=True) if highs_lib is None: raise RuntimeError( 'Could not find HiGHS library; Please make sure it is in the LD_LIBRARY_PATH environment variable' ) highs_lib_dir = os.path.dirname(highs_lib) highs_build_dir = os.path.dirname(highs_lib_dir) highs_include_dir = os.path.join(highs_build_dir, 'include', 'highs') if not os.path.exists(os.path.join(highs_include_dir, 'Highs.h')): raise RuntimeError('Could not find HiGHS include directory') extensions = list() extensions.append( Pybind11Extension('highspy.highs_bindings', sources=['highspy/highs_bindings.cpp'], language='c++', include_dirs=[highs_include_dir], library_dirs=[highs_lib_dir], libraries=['highs'])) setup(name='highspy', version='1.1.2.dev1', packages=find_packages(), description='Python interface to HiGHS', maintainer_email='*****@*****.**', license='MIT', url='https://github.com/ergo-code/highs', install_requires=['pybind11', 'numpy', 'pyomo'], include_package_data=True, package_data={'highspy': ['highspy/*.so']}, ext_modules=extensions, cmdclass={'build_ext': build_ext},
#!/usr/bin/env python """ bindthem: A simple script for C++ kernels, to find them all and in the darkness bind them. The C++ kernels are very limited. Uses pybind11. """ from setuptools import setup from pybind11.setup_helpers import Pybind11Extension, build_ext ext_modules = [ Pybind11Extension('tests.bind_examples', sources=['tests/bind_examples_bind.cpp']) ] setup( ext_modules=ext_modules, cmdclass={'build_ext': build_ext}, )
warnings.warn( 'The robot model module is required to build the controllers module! ' 'The controllers module will not be installed with the current settings.') __install_controllers_module__ = False except Exception as e: msg = f'Error with control library dependencies: {e.args[0]} Ensure the control libraries are properly installed.' warnings.warn(msg) ParallelCompile('NPY_NUM_BUILD_JOBS', needs_recompile=naive_recompile).install() ext_modules = [ Pybind11Extension('state_representation', sorted(glob('source/state_representation/*.cpp') + glob('source/common/*.cpp')), cxx_std=17, include_dirs=__include_dirs__, libraries=['state_representation'], define_macros=[('MODULE_VERSION_INFO', __version__)], ) ] if __install_clproto_module__: ext_modules.append( Pybind11Extension('clproto', sorted(glob('source/clproto/*.cpp') + glob('source/common/*.cpp')), cxx_std=17, include_dirs=__include_dirs__, libraries=['state_representation', 'clproto'], define_macros=[('MODULE_VERSION_INFO', __version__)], ) )
extra_includes.append('/usr/local/include') try: from setuptools_scm import get_version __version__ = get_version() except ImportError: __version__ = '0.0.1' ext_modules = [ Pybind11Extension( 'pikepdf._qpdf', sorted(glob('src/qpdf/*.cpp')), depends=sorted(glob('src/qpdf/*.h')), include_dirs=[ # Path to pybind11 headers *extra_includes, ], library_dirs=[*extra_library_dirs], libraries=['qpdf'], cxx_std=14, ) ] if sys.platform == 'cygwin': # On cygwin, use gnu++14 instead of c++14 eca = ext_modules[0].extra_compile_args eca[eca.index('-std=c++14')] = '-std=gnu++14' if sysconfig.get_platform() == 'mingw': ext_modules[0].extra_compile_args = ['-std=c++14']
import setuptools import sys with open("README.md", "r") as fh: long_description = fh.read() from pybind11.setup_helpers import Pybind11Extension ext_modules = [ Pybind11Extension( "python_example", sorted(glob("src/*.cpp")), # Sort source files for reproducibility ), ] setuptools.setup( name="novamind", version="0.0.2", author="Nova Mind", author_email="*****@*****.**", description="Learning", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/duanyzhi/novamind", packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent" ], )
from setuptools import Extension as Pybind11Extension with open("README.md", "r") as fh: long_description = fh.read() exec(open('submodlib/version.py').read()) ext_modules = [ Pybind11Extension( "submodlib_cpp", #["cpp/submod/wrapper.cpp","cpp/submod/FacilityLocation.cpp", "cpp/submod/wr_FacilityLocation.cpp", "cpp/submod/helper.cpp", "cpp/submod/wr_helper.cpp","cpp/submod/sparse_utils.cpp", "cpp/submod/wr_sparse_utils.cpp","cpp/optimizers/NaiveGreedyOptimizer.cpp", "cpp/submod/SetFunction.cpp","cpp/submod/ClusteredFunction.cpp", "cpp/submod/wr_ClusteredFunction.cpp"], [ "cpp/wrappers/wrapper.cpp", "cpp/submod/FacilityLocation.cpp", "cpp/wrappers/wr_FacilityLocation.cpp", "cpp/utils/helper.cpp", "cpp/wrappers/wr_helper.cpp", "cpp/utils/sparse_utils.cpp", "cpp/wrappers/wr_sparse_utils.cpp", "cpp/optimizers/NaiveGreedyOptimizer.cpp", "cpp/submod/SetFunction.cpp", "cpp/submod/ClusteredFunction.cpp", "cpp/wrappers/wr_ClusteredFunction.cpp" ], # Example: passing in the version to the compiled code #sorted(glob("cpp/submod/*.cpp")), define_macros=[('VERSION_INFO', __version__)], ), ] setup( name='submodlib', #packages=find_packages(include=['submodlib']), packages=['submodlib', 'submodlib/functions'], #packages=find_packages('submodlib'), #package_dir={'':'submodlib'},
from setuptools import setup, find_packages from pybind11.setup_helpers import Pybind11Extension __version__ = "0.0.2" ext_modules = [ Pybind11Extension( "pygenstability.generalized_louvain", ["pygenstability/generalized_louvain/generalized_louvain.cpp"], include_dirs=["extra"], extra_compile_args=["-std=c++11"], ), ] plotly_require = ["plotly>=3.6.0"] contrib_require = ["scikit-image>=0.18.1"] test_require = ["pyyaml", "dictdiffer"] setup( name="pygenstability", version=__version__, author="Alexis Arnaudon", author_email="*****@*****.**", url="https://github.com/ImperialCollegeLondon/PyGenStability", description="Python binding of generalised Louvain with Markov Stability", ext_modules=ext_modules, setup_requires=["pybind11>=2.6.0"], install_requires=[ "numpy>=1.18.1", "scipy>=1.4.1", "matplotlib>=3.1.3", "networkx>=2.4",
from setuptools import find_packages, setup from pybind11.setup_helpers import Pybind11Extension setup(name='pyemonlib', packages=find_packages(include=['pyemonlib']), version='0.1.0', description='Emon Python library', author='Me', license='MIT', install_requires=['influxdb-client[ciso]', 'paho-mqtt', 'pyyaml'], setup_requires=['pytest-runner'], tests_require=['pytest==4.4.1', 'cython', 'numpy', 'pytz'], test_suite='tests', ext_modules=[ Pybind11Extension("pyemonlib.emonSuite", ['pyemonlib/emon_pybindings.cpp']) ] #package_data={'': ['emonSuite.cpython-37m-arm-linux-gnueabihf.so']} )
def finalize_options(self): if not self.distribution.have_run.get("egg_info", 1): # Just listing the MANIFEST; setup_requires are not available yet. super().finalize_options() return import cairo from pybind11.setup_helpers import Pybind11Extension self.distribution.ext_modules[:] = ext, = [ Pybind11Extension( "mplcairo._mplcairo", sources=(["src/_unity_build.cpp"] if UNITY_BUILD else sorted({*map(str, Path("src").glob("*.cpp"))} - {"src/_unity_build.cpp"})), depends=[ "setup.py", *map(str, Path("src").glob("*.h")), *map(str, Path("src").glob("*.cpp")), ], cxx_std=17, include_dirs=[cairo.get_include()], ) ] tmp_include_dir = Path( self.get_finalized_command("build").build_base, "include") tmp_include_dir.mkdir(parents=True, exist_ok=True) # On Arch Linux, the python-pillow (Arch) package # includes a version of ``raqm.h`` that is both invalid # (https://bugs.archlinux.org/task/57492) and now outdated (it is # missing a declaration for `raqm_version_string`), but placed in an # non-overridable directory for distutils. Thus, on that distro, force # the use of a cleanly downloaded header. try: is_arch = "Arch Linux" in Path("/etc/os-release").read_text() except OSError: is_arch = False if is_arch: has_pkgconfig_raqm = False else: try: get_pkgconfig(f"--atleast-version={MIN_RAQM_VERSION}", "raqm") except (FileNotFoundError, CalledProcessError): has_pkgconfig_raqm = False else: has_pkgconfig_raqm = True if has_pkgconfig_raqm: ext.extra_compile_args += get_pkgconfig("--cflags", "raqm") else: (tmp_include_dir / "raqm-version.h").write_text("") # Touch it. with urllib.request.urlopen( f"https://raw.githubusercontent.com/HOST-Oman/libraqm/" f"v{MIN_RAQM_VERSION}/src/raqm.h") as request, \ (tmp_include_dir / "raqm.h").open("wb") as file: file.write(request.read()) ext.include_dirs += [tmp_include_dir] if os.name == "posix": get_pkgconfig(f"--atleast-version={MIN_CAIRO_VERSION}", "cairo") ext.extra_compile_args += [ "-flto", "-Wall", "-Wextra", "-Wpedantic", *get_pkgconfig("--cflags", "cairo"), ] ext.extra_link_args += ["-flto"] if MANYLINUX: ext.extra_link_args += ["-static-libgcc", "-static-libstdc++"] elif os.name == "nt": # Windows conda path for FreeType. ext.include_dirs += [Path(sys.prefix, "Library/include")] ext.extra_compile_args += [ "/experimental:preprocessor", "/wd4244", "/wd4267", # cf. gcc -Wconversion. ] ext.libraries += ["psapi", "cairo", "freetype"] # Windows conda path for FreeType -- needs to be str, not Path. ext.library_dirs += [str(Path(sys.prefix, "Library/lib"))] super().finalize_options()