Esempio n. 1
0
relative_paths = ["calcul.py"]
make_backend_files([pack_dir / path for path in relative_paths],
                   backend="pythran")

relative_paths = ["util.py"]
make_backend_files([pack_dir / path for path in relative_paths],
                   backend="cython")

relative_paths = ["other.py"]
make_backend_files([pack_dir / path for path in relative_paths],
                   backend="numba")

extensions = []
if "egg_info" not in sys.argv:
    compile_arch = os.getenv("CARCH", "native")
    extensions = init_transonic_extensions(
        pack_name,
        backend="pythran",
        include_dirs=[np.get_include()],
        compile_args=("-O3", f"-march={compile_arch}", "-DUSE_XSIMD"),
    )
    extensions.extend(init_transonic_extensions(pack_name, backend="cython"))
    init_transonic_extensions(pack_name, backend="numba")

setup(
    version=__version__,
    packages=find_packages(exclude=["doc"]),
    install_requires=install_requires,
    ext_modules=extensions,
)
Esempio n. 2
0
path_sources = Path(__file__).parent.absolute()
include_dirs = [np.get_include()]

try:
    from Cython.Build import cythonize
except ImportError:
    extensions = [
        Extension(
            "add_cython",
            include_dirs=[str(path_sources)] + include_dirs,
            libraries=["m"],
            library_dirs=[],
            sources=[str(path_sources / "add_cython.c")],
        )
    ]
    print(extensions)
else:
    extensions = cythonize(
        Extension("add_cython", ["add_cython.pyx"], include_dirs=include_dirs))

make_backend_files([path_sources / "add.py"])
extensions.extend(init_transonic_extensions(".", include_dirs=include_dirs))

setup(
    name="add",
    ext_modules=extensions,
    script_name="setup.py",
    script_args=["build_ext"],
    cmdclass=dict(build_ext=ParallelBuildExt),
)
Esempio n. 3
0
if platform.system() == "Windows":
    backend = "numba"
    install_requires.append("numba")
else:
    backend = "pythran"

paths = ["pylandstats/landscape.py"]
make_backend_files([here / path for path in paths], backend=backend)

if platform.system() == "Linux":
    compile_args = ("-O3", "-DUSE_XSIMD")
else:
    compile_args = ("-O3", )

extensions = init_transonic_extensions("pylandstats",
                                       compile_args=compile_args,
                                       backend=backend)

setup(
    name="pylandstats",
    version=__version__,
    description="Open-source Python library to compute landscape metrics",
    long_description=long_description,
    long_description_content_type="text/markdown",
    classifiers=classifiers,
    url="https://github.com/martibosch/pylandstats",
    author="Martí Bosch",
    author_email="*****@*****.**",
    license="GPL-3.0",
    packages=find_packages(exclude=["docs", "tests*"]),
    include_package_data=True,
Esempio n. 4
0
from transonic.dist import init_transonic_extensions

res = init_transonic_extensions("transonic", "cython")
print(res)
Esempio n. 5
0
here = Path(__file__).parent.absolute()

pack_name = "package_simple"
pack_dir = here / pack_name

# Get the version from the relevant file
version = run_path(pack_name + "/_version.py")
__version__ = version["__version__"]

install_requires = ["transonic", "numpy", "matplotlib"]

relative_paths = ["util.py", "calcul.py"]
make_backend_files([pack_dir / path for path in relative_paths])

extensions = []
if "egg_info" not in sys.argv:
    compile_arch = os.getenv("CARCH", "native")
    extensions = init_transonic_extensions(
        pack_name,
        include_dirs=[np.get_include()],
        compile_args=("-O3", f"-march={compile_arch}", "-DUSE_XSIMD"),
    )

setup(
    version=__version__,
    packages=find_packages(exclude=["doc"]),
    install_requires=install_requires,
    ext_modules=extensions,
)
Esempio n. 6
0
path_here = Path(__file__).parent.absolute()
include_dirs = [np.get_include()]

pack_name = "future"

paths = tuple((path_here / pack_name).glob("*.py"))

for backend in ("pythran", "cython", "numba"):
    make_backend_files(paths, backend=backend)

extensions = []
if "egg_info" not in sys.argv:
    extensions = init_transonic_extensions(
        pack_name,
        backend="pythran",
        include_dirs=[np.get_include()],
        compile_args=("-O3", "-DUSE_XSIMD"),
        inplace=True,
    )
    extensions.extend(
        init_transonic_extensions(pack_name,
                                  backend="cython",
                                  inplace=True,
                                  annotate=True))
    init_transonic_extensions(pack_name, backend="numba")

setup(
    name=pack_name,
    ext_modules=extensions,
    # script_name="setup.py",
    script_args=["build_ext", "--inplace"],