示例#1
0
def get_numpy_include():
    try:
        # Obtain the numpy include directory. This logic works across numpy
        # versions.
        # setuptools forgets to unset numpy's setup flag and we get a crippled
        # version of it unless we do it ourselves.
        try:
            import __builtin__  # py2
            __builtin__.__NUMPY_SETUP__ = False
        except:
            import builtins  # py3
            builtins.__NUMPY_SETUP__ = False
        import numpy as np
    except ImportError as e:
        try:
            # Try to install numpy
            from setuptools import dist
            dist.Distribution().fetch_build_eggs([REQUIRED_NUMPY])
            import numpy as np
        except Exception as e:
            print(e)
            print('*** package "numpy" not found ***')
            print('pyEDFlib requires a version of NumPy, even for setup.')
            print(
                'Please get it from http://numpy.scipy.org/ or install it through '
                'your package manager.')
            sys.exit(-1)
    try:
        numpy_include = np.get_include()
    except AttributeError:
        numpy_include = np.get_numpy_include()
    return numpy_include
示例#2
0
def pre_install_numpy():
    try:
        import numpy  # noqa
    except ImportError:
        print('Installing numpy')
        numpy_version = dist.Distribution().fetch_build_eggs(['numpy'
                                                              ])[0].version
        print(f'Pre-installed numpy {numpy_version}')
示例#3
0
def distribution():
    """Create a setuptools Distribution object."""
    return dist.Distribution({
        'name': 'foo',
        'packages': [
            'foo',
            'foo.bar',
            'foo_biz',
        ],
    })
示例#4
0
def wrap_commands(kwargs):
    dist = st_dist.Distribution()

    # This should suffice to get the same config values and command classes
    # that the actual Distribution will see (not counting cmdclass, which is
    # handled below)
    dist.parse_config_files()

    # Setuptools doesn't patch get_command_list, and as such we do not get
    # extra commands from entry_points.  As we need to be compatable we deal
    # with this here.
    for ep in pkg_resources.iter_entry_points('distutils.commands'):
        if ep.name not in dist.cmdclass:
            if hasattr(ep, 'resolve'):
                cmdclass = ep.resolve()
            else:
                # Old setuptools does not have ep.resolve, and load with
                # arguments is depricated in 11+.  Use resolve, 12+, if we
                # can, otherwise fall back to load.
                # Setuptools 11 will throw a deprication warning, as it
                # uses _load instead of resolve.
                cmdclass = ep.load(False)
            dist.cmdclass[ep.name] = cmdclass

    for cmd, _ in dist.get_command_list():
        hooks = {}
        for opt, val in dist.get_option_dict(cmd).items():
            val = val[1]
            if opt.startswith('pre_hook.') or opt.startswith('post_hook.'):
                hook_type, alias = opt.split('.', 1)
                hook_dict = hooks.setdefault(hook_type, {})
                hook_dict[alias] = val
        if not hooks:
            continue

        if 'cmdclass' in kwargs and cmd in kwargs['cmdclass']:
            cmdclass = kwargs['cmdclass'][cmd]
        else:
            cmdclass = dist.get_command_class(cmd)

        new_cmdclass = wrap_command(cmd, cmdclass, hooks)
        kwargs.setdefault('cmdclass', {})[cmd] = new_cmdclass
示例#5
0
from setuptools import dist

dist.Distribution().fetch_build_eggs(["Cython>=0.29", "numpy>=1.19"])

import os
import re
import sys
import platform
import subprocess

from distutils.core import setup, Extension
from distutils.version import LooseVersion
import numpy
from Cython.Distutils import build_ext


def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()


def find_version():
    version_file = read("version.py")
    version_re = r"__version__ = \"(?P<version>.+)\""
    version = re.match(version_re, version_file).group("version")
    return version


class CMakeExtension(Extension):
    def __init__(self, name, sourcedir=""):
        Extension.__init__(self, name, sources=[])
        self.sourcedir = os.path.abspath(sourcedir)
示例#6
0
import setuptools

# install numpy and cython dependencies needed for the rest of the setup script
from setuptools import dist
dist.Distribution().fetch_build_eggs(['cython>=0.28', 'numpy>=1.19'])

# normal inports
from distutils.core import Extension
from Cython.Build import cythonize
import numpy, sys
from os.path import join

# get setup variables
variables = {}
with open(join('mudpy', 'global_variables.py')) as fid:
    exec(fid.read(), variables)

__src__ = variables['__src__']
__version__ = variables['__version__']

# get needed compile arguments
compile_flags = ['-O3']

# get header
with open("README.md", "r", encoding="utf8") as fh:
    long_description = fh.read()

# module extension
ext = Extension("mudpy.mud_friendly",
                sources=[
                    join("mudpy", "mud_friendly_wrapper.pyx"),
示例#7
0
#  License as published by the Free Software Foundation; either
#  version 3.0 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with this library.
# from distutils.extension import Extension
import os

from setuptools import dist

dist.Distribution().fetch_build_eggs(['Cython>=0.29.22', 'numpy==1.20.1'])

import numpy as np

try:
    from Cython.Distutils import build_ext
    from Cython.Build import cythonize
except ImportError:
    # create closure for deferred import
    def cythonize(*args, **kwargs):
        from Cython.Build import cythonize
        return cythonize(*args, **kwargs)

    def build_ext(*args, **kwargs):
        from Cython.Distutils import build_ext
        return build_ext(*args, **kwargs)
示例#8
0
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :

from setuptools import setup, find_packages, dist
dist.Distribution(dict(setup_requires=['bob.extension']))

from bob.extension.utils import load_requirements
install_requires = load_requirements()

# Define package version
version = open("version.txt").read().rstrip()

# The only thing we do in this file is to call the setup() function with all
# parameters that define our package.
setup(
    name='bob.db.ijba',
    version=version,
    description='IJB-A Database Access API for Bob',
    url='https://gitlab.idiap.ch/bob/bob.db.ijba',
    license='BSD',
    author='Tiago de Freitas Pereira',
    author_email='*****@*****.**',
    long_description=open('README.rst').read(),

    # This line is required for any distutils based packaging.
    packages=find_packages(),
    include_package_data=True,
    zip_safe=False,
    install_requires=install_requires,
    entry_points={
        # bob database declaration
示例#9
0
文件: setup.py 项目: wangzhupi/s2anet
import os
import platform
import subprocess
import time

from setuptools import Extension, dist, find_packages, setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension

dist.Distribution().fetch_build_eggs(['Cython', 'numpy>=1.11.1'])
import numpy as np  # noqa: E402, isort:skip
from Cython.Build import cythonize  # noqa: E402, isort:skip


def readme():
    with open('README.md', encoding='utf-8') as f:
        content = f.read()
    return content


MAJOR = 1
MINOR = 0
PATCH = ''
SUFFIX = 'rc1'
if PATCH:
    SHORT_VERSION = '{}.{}.{}{}'.format(MAJOR, MINOR, PATCH, SUFFIX)
else:
    SHORT_VERSION = '{}.{}{}'.format(MAJOR, MINOR, SUFFIX)

version_file = 'mmdet/version.py'

示例#10
0
def setup_cfg_to_setup_kwargs(config, script_args=()):
    """Processes the setup.cfg options and converts them to arguments accepted
    by setuptools' setup() function.
    """

    kwargs = {}

    # Temporarily holds install_requires and extra_requires while we
    # parse env_markers.
    all_requirements = {}

    for arg in D1_D2_SETUP_ARGS:
        if len(D1_D2_SETUP_ARGS[arg]) == 2:
            # The distutils field name is different than distutils2's.
            section, option = D1_D2_SETUP_ARGS[arg]

        elif len(D1_D2_SETUP_ARGS[arg]) == 1:
            # The distutils field name is the same thant distutils2's.
            section = D1_D2_SETUP_ARGS[arg][0]
            option = arg

        in_cfg_value = has_get_option(config, section, option)
        if not in_cfg_value:
            # There is no such option in the setup.cfg
            if arg == "long_description":
                in_cfg_value = has_get_option(config, section,
                                              "description_file")
                if in_cfg_value:
                    in_cfg_value = split_multiline(in_cfg_value)
                    value = ''
                    for filename in in_cfg_value:
                        description_file = open(filename)
                        try:
                            value += description_file.read().strip() + '\n\n'
                        finally:
                            description_file.close()
                    in_cfg_value = value
            else:
                continue

        if arg in CSV_FIELDS:
            in_cfg_value = split_csv(in_cfg_value)
        if arg in MULTI_FIELDS:
            in_cfg_value = split_multiline(in_cfg_value)
        elif arg in MAP_FIELDS:
            in_cfg_map = {}
            for i in split_multiline(in_cfg_value):
                k, v = i.split('=')
                in_cfg_map[k.strip()] = v.strip()
            in_cfg_value = in_cfg_map
        elif arg in BOOL_FIELDS:
            # Provide some flexibility here...
            if in_cfg_value.lower() in ('true', 't', '1', 'yes', 'y'):
                in_cfg_value = True
            else:
                in_cfg_value = False

        if in_cfg_value:
            if arg in ('install_requires', 'tests_require'):
                # Replaces PEP345-style version specs with the sort expected by
                # setuptools
                in_cfg_value = [
                    _VERSION_SPEC_RE.sub(r'\1\2', pred)
                    for pred in in_cfg_value
                ]
            if arg == 'install_requires':
                # Split install_requires into package,env_marker tuples
                # These will be re-assembled later
                install_requires = []
                requirement_pattern = '(?P<package>[^;]*);?(?P<env_marker>[^#]*?)(?:\s*#.*)?$'
                for requirement in in_cfg_value:
                    m = re.match(requirement_pattern, requirement)
                    requirement_package = m.group('package').strip()
                    env_marker = m.group('env_marker').strip()
                    install_requires.append((requirement_package, env_marker))
                all_requirements[''] = install_requires
            elif arg == 'package_dir':
                in_cfg_value = {'': in_cfg_value}
            elif arg in ('package_data', 'data_files'):
                data_files = {}
                firstline = True
                prev = None
                for line in in_cfg_value:
                    if '=' in line:
                        key, value = line.split('=', 1)
                        key, value = (key.strip(), value.strip())
                        if key in data_files:
                            # Multiple duplicates of the same package name;
                            # this is for backwards compatibility of the old
                            # format prior to d2to1 0.2.6.
                            prev = data_files[key]
                            prev.extend(value.split())
                        else:
                            prev = data_files[key.strip()] = value.split()
                    elif firstline:
                        raise errors.DistutilsOptionError(
                            'malformed package_data first line %r (misses '
                            '"=")' % line)
                    else:
                        prev.extend(line.strip().split())
                    firstline = False
                if arg == 'data_files':
                    # the data_files value is a pointlessly different structure
                    # from the package_data value
                    data_files = data_files.items()
                in_cfg_value = data_files
            elif arg == 'cmdclass':
                cmdclass = {}
                dist = st_dist.Distribution()
                for cls_name in in_cfg_value:
                    cls = resolve_name(cls_name)
                    cmd = cls(dist)
                    cmdclass[cmd.get_command_name()] = cls
                in_cfg_value = cmdclass

        kwargs[arg] = in_cfg_value

    # Transform requirements with embedded environment markers to
    # setuptools' supported marker-per-requirement format.
    #
    # install_requires are treated as a special case of extras, before
    # being put back in the expected place
    #
    # fred =
    #     foo:marker
    #     bar
    # -> {'fred': ['bar'], 'fred:marker':['foo']}

    if 'extras' in config:
        requirement_pattern = '(?P<package>[^:]*):?(?P<env_marker>[^#]*?)(?:\s*#.*)?$'
        extras = config['extras']
        # Add contents of test-requirements, if any, into an extra named
        # 'test' if one does not already exist.
        if 'test' not in extras:
            from pbr import packaging
            extras['test'] = "\n".join(
                packaging.parse_requirements(
                    packaging.TEST_REQUIREMENTS_FILES)).replace(';', ':')

        for extra in extras:
            extra_requirements = []
            requirements = split_multiline(extras[extra])
            for requirement in requirements:
                m = re.match(requirement_pattern, requirement)
                extras_value = m.group('package').strip()
                env_marker = m.group('env_marker')
                extra_requirements.append((extras_value, env_marker))
            all_requirements[extra] = extra_requirements

    # Transform the full list of requirements into:
    # - install_requires, for those that have no extra and no
    #   env_marker
    # - named extras, for those with an extra name (which may include
    #   an env_marker)
    # - and as a special case, install_requires with an env_marker are
    #   treated as named extras where the name is the empty string

    extras_require = {}
    for req_group in all_requirements:
        for requirement, env_marker in all_requirements[req_group]:
            if env_marker:
                extras_key = '%s:(%s)' % (req_group, env_marker)
                # We do not want to poison wheel creation with locally
                # evaluated markers.  sdists always re-create the egg_info
                # and as such do not need guarded, and pip will never call
                # multiple setup.py commands at once.
                if 'bdist_wheel' not in script_args:
                    try:
                        if pkg_resources.evaluate_marker('(%s)' % env_marker):
                            extras_key = req_group
                    except SyntaxError:
                        log.error(
                            "Marker evaluation failed, see the following "
                            "error.  For more information see: "
                            "http://docs.openstack.org/"
                            "developer/pbr/compatibility.html#evaluate-marker")
                        raise
            else:
                extras_key = req_group
            extras_require.setdefault(extras_key, []).append(requirement)

    kwargs['install_requires'] = extras_require.pop('', [])
    kwargs['extras_require'] = extras_require

    return kwargs
示例#11
0
from setuptools import dist
dist.Distribution().fetch_build_eggs(['Cython>=0.15.1', 'numpy'])

from setuptools import setup, Extension, find_packages
from Cython.Build import cythonize, build_ext
import numpy

required_packages = [
    "setuptools>=18.0", "lightgbm", "numpy", "pandas", "cython"
]

setup(
    name="lambdaobj",
    author="yfu",
    author_email="*****@*****.**",
    version="0.1.0",
    packages=find_packages(),
    install_requires=required_packages,
    python_requires=">=3.6",
    include_package_data=True,
    ext_modules=cythonize(
        Extension('lambdaobj',
                  sources=['lambdaobj.pyx', 'argsort.cpp'],
                  language="c++",
                  include_dirs=[numpy.get_include()])),
    cmdclass={'build_ext': build_ext},
)
示例#12
0
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :

from setuptools import dist, setup

dist.Distribution(dict(setup_requires=["bob.extension"]))

from bob.extension.utils import find_packages, load_requirements

install_requires = load_requirements()

# The only thing we do in this file is to call the setup() function with all
# parameters that define our package.
setup(
    # This is the basic information about your project. Modify all this
    # information before releasing code publicly.
    name="bob.bio.video",
    version=open("version.txt").read().rstrip(),
    description="Run biometric recognition algorithms on videos",
    url="https://gitlab.idiap.ch/bob/bob.bio.video",
    license="BSD",
    author="The biometric person recognition group at Idiap, Switzerland",
    author_email="*****@*****.**",
    keywords="bob",
    # If you have a better, long description of your package, place it on the
    # 'doc' directory and then hook it here
    long_description="Video support to PipelineSimple",
    # This line is required for any distutils based packaging.
    packages=find_packages(),
    include_package_data=True,
    zip_safe=False,
示例#13
0
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 3.0 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with this library.
# from distutils.extension import Extension
import os

from setuptools import dist
dist.Distribution().fetch_build_eggs(['Cython>=0.29.14', 'numpy>=1.17.3'])

try:
    from Cython.Distutils import build_ext
    from Cython.Build import cythonize
except ImportError:
    # create closure for deferred import
    def cythonize(*args, **kwargs):
        from Cython.Build import cythonize
        return cythonize(*args, **kwargs)

    def build_ext(*args, **kwargs):
        from Cython.Distutils import build_ext
        return build_ext(*args, **kwargs)

示例#14
0
文件: setup.py 项目: kthnyt/kipet
# -*- coding: utf-8 -*-

try:
    from setuptools import setup, Extension
except ImportError:
    from distutils.core import setup

import os.path

from setuptools import dist
dist.Distribution().fetch_build_eggs(
    ['Cython>=0.15.1', 'numpy>=1.10', 'six>=1.15'])

readme = ''
here = os.path.abspath(os.path.dirname(__file__))
readme_path = os.path.join(here, 'README.md')
if os.path.exists(readme_path):
    with open(readme_path, 'rb') as stream:
        readme = stream.read().decode('utf8')

setup(
    long_description=readme,
    name='kipet',
    version='0.1.6',
    description=
    'An all-in-one tool for fitting kinetic models using spectral and other state data',
    python_requires='==3.*,>=3.8.0',
    project_urls={
        "repository": "https://github.com/salvadorgarciamunoz/kipet"
    },
    author=
示例#15
0
import sys
import os
import platform
import os.path
import shutil
from glob import glob
from subprocess import call
from setuptools import setup, Command, Extension, dist

dist.Distribution().fetch_build_eggs(['cython', 'setuptools>=18.0'])

from Cython.Distutils import build_ext

SFML_HEADERS = os.getenv('SFML_HEADERS')
SFML_LIBRARIES = os.getenv('SFML_LIBRARIES')

if platform.architecture()[0] == "32bit":
    arch = "x86"
elif platform.architecture()[0] == "64bit":
    arch = "x64"


class CythonBuildExt(build_ext):
    """ Updated version of cython build_ext command.

    This version of cython build_ext command include generated API headers to
    the build process of subsequent extensions. The C/C++ header files are all
    moved to the temporary build directory before being properly installed on
    the system.
    """
    def cython_sources(self, sources, extension):
示例#16
0
from setuptools import dist, setup, find_packages

# `Cython` is used when installing `kss` library.
dist.Distribution().fetch_build_eggs(['Cython'])

setup(
    name='langumo',
    version='0.2.0',

    author='Jungwoo Park',
    author_email='*****@*****.**',

    description='The unified corpus building environment for Language Models.',
    long_description=open('README.md', 'r', encoding='utf-8').read(),
    long_description_content_type='text/markdown',

    keywords=['langumo', 'corpus', 'dataset', 'nlp', 'language-model',
              'deep-learning', 'machine-learning'],
    url='https://github.com/affjljoo3581/langumo',
    license='Apache-2.0',

    package_dir={'': 'src'},
    packages=find_packages('src'),
    python_requires='>=3.6.0',
    install_requires=[
        'nltk',
        'colorama',
        'pyyaml>=5.3.1',
        'tqdm>=4.46.0',
        'tokenizers==0.8.1',
        'mwparserfromhell>=0.5.4',
示例#17
0
import setuptools

from setuptools import dist
dist.Distribution().fetch_build_eggs(['cython>=0.x', 'numpy>=1.16.2', 'wheel'])

from distutils.extension import Extension

from Cython.Build import cythonize
import numpy

import os, sys
from glob import glob

DIR_PATH = os.path.dirname(os.path.abspath(__file__))
sys.path.append(DIR_PATH)

import version

SOURCE_URL = 'https://github.com/matrix-profile-foundation/matrixprofile'
README = os.path.join(DIR_PATH, 'README.rst')

# manual list of files to be compiled
extensions = []
extensions.append(
    Extension(
        'matrixprofile.algorithms.cympx',
        ['matrixprofile/algorithms/cympx.pyx'],
        extra_compile_args=["-O2", "-fopenmp"],
        extra_link_args=['-fopenmp'],
        include_dirs=[numpy.get_include()],
    ))
示例#18
0
from setuptools.command.test import test


def load_requirements(filename):
    with open(filename, 'r') as f:
        return [line.split(';')[0].strip() for line in f.readlines()]


requirements = load_requirements('requirements.txt')

CYTHON = platform.python_implementation() != "PyPy"

if CYTHON:
    # "Recommended" method of installing Cython: https://github.com/pypa/pip/issues/5761
    from setuptools import dist
    dist.Distribution().fetch_build_eggs(["cython"])

    from Cython.Build import cythonize
    import Cython.Compiler.Options
    from Cython.Distutils import build_ext
else:
    try:
        requirements.remove('cython')
    except ValueError:
        pass

    class build_ext(distutils.cmd.Command):
        def initialize_options(self):
            pass

        def finalize_options(self):
示例#19
0
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Andre Anjos <*****@*****.**>
# Mon 16 Apr 08:18:08 2012 CEST

bob_packages = ['bob.core', 'bob.math', 'bob.io.base', 'bob.learn.activation']

from setuptools import setup, find_packages, dist
dist.Distribution(
    dict(setup_requires=['bob.extension', 'bob.blitz'] + bob_packages))
from bob.blitz.extension import Extension, Library, build_ext

from bob.extension.utils import load_requirements
build_requires = load_requirements()

# Define package version
version = open("version.txt").read().rstrip()

packages = ['boost']
boost_modules = ['system']

setup(
    name='bob.learn.linear',
    version=version,
    description='Linear Machine and Trainers for Bob',
    url='http://gitlab.idiap.ch/bob/bob.learn.linear',
    license='BSD',
    author='Andre Anjos',
    author_email='*****@*****.**',
    long_description=open('README.rst').read(),
    packages=find_packages(),
示例#20
0
from setuptools import setup, find_packages, Extension
from setuptools import dist
dist.Distribution().fetch_build_eggs(['numpy==1.16.6', 'Cython==0.29.15'])
import numpy
#from Cython.Build import cythonize
setup(
    name='sibreg',
    version='1.2.0a1',
    description=
    'Functions for performing robust GWAS using sibpairs in a random effects model',
    url='http://github.com/alexTISYoung/sibreg',
    download_url='https://github.com/AlexTISYoung/hlmm/archive/1.2.0a1.tar.gz',
    author='Alexander I. Young',
    author_email='*****@*****.**',
    license='MIT',
    scripts=['sibreg/bin/sGWAS.py'],
    classifiers=[
        # How mature is this project? Common values are
        #   3 - Alpha
        #   4 - Beta
        #   5 - Production/Stable
        'Development Status :: 3 - Alpha',

        # Indicate who your project is intended for
        'Intended Audience :: Science/Research',
        'Topic :: Scientific/Engineering :: Bio-Informatics',

        # Pick your license as you wish (should match "license" above)
        'License :: OSI Approved :: MIT License',

        # Specify the Python versions you support here. In particular, ensure
示例#21
0
from setuptools import dist, setup, Extension

# To compile and install locally run "python setup.py build_ext --inplace"
# To install library to Python site-packages run "python setup.py build_ext install"

install_requires = ['setuptools>=18.0', 'cython>=0.27.3', 'matplotlib==2.1.0']

dist.Distribution().fetch_build_eggs(install_requires)

import numpy as np
ext_modules = [
    Extension(
        'pycocotools._mask',
        sources=['./common/maskApi.c', 'pycocotools/_mask.pyx'],
        include_dirs=[np.get_include(), './common'],
        extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
    )
]

setup(
    name='pycocotools-fix',
    author='Junjue Wang',
    author_email='*****@*****.**',
    description=
    'Fixed pycocotools package installation error of numpy or cython not installed',
    long_description=
    'Created due to the inactivity of the original repo: https://github.com/cocodataset/cocoapi',
    url='https://github.com/junjuew/cocoapi',
    packages=['pycocotools'],
    package_dir={'pycocotools': 'pycocotools'},
    install_requires=[
示例#22
0
from setuptools import dist, setup, find_packages
from setuptools.extension import Extension
try:
    from Cython.Build import cythonize
except ImportError:
    dist.Distribution().fetch_build_eggs(['cython>=0.28.0'])
    from Cython.Build import cythonize
import Cython.Compiler.Options
Cython.Compiler.Options.annotate = True
try:
    from numpy import get_include as np_get_include
except ImportError:
    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"],
示例#23
0
    with open('README.md', 'r') as content:
        return content.read()


#===============================================================================

ext_modules = [
    Extension('gryffin.bayesian_network.kernel_evaluations',
              ['src/gryffin/bayesian_network/kernel_evaluations.c']),
    Extension('gryffin.bayesian_network.kernel_prob_reshaping',
              ['src/gryffin/bayesian_network/kernel_prob_reshaping.c']),
]

# Preinstall numpy
from setuptools import dist
dist.Distribution().fetch_build_eggs(['numpy>=1.10'])
import numpy as np


def requirements():
    with open('requirements.txt', 'r') as content:
        return content.readlines()


#===============================================================================

setup(
    name='gryffin',
    #version=versioneer.get_version(),
    version='0.1.1',
    # cmdclass=versioneer.get_cmdclass(),
示例#24
0
#  This library is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 3.0 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with this library.
import os
from setuptools import dist

dist.Distribution().fetch_build_eggs(['Cython==0.29.22'])

try:
    from Cython.Distutils import build_ext
    from Cython.Build import cythonize
except ImportError:
    # create closure for deferred import
    def cythonize(*args, **kwargs):
        from Cython.Build import cythonize
        return cythonize(*args, **kwargs)

    def build_ext(*args, **kwargs):
        from Cython.Distutils import build_ext
        return build_ext(*args, **kwargs)

示例#25
0
文件: setup.py 项目: ninesinc/cocoapi
"""To compile and install locally run "python setup.py build_ext --inplace".
To install library to Python site-packages run "python setup.py build_ext install"
"""
import platform
from setuptools import dist, setup, Extension

setup_requires = [
    'setuptools>=18.0',
    'cython>=0.27.3',
    'numpy==1.16.4',
]
dist.Distribution().fetch_build_eggs(setup_requires)

import numpy as np

ext_modules = [
    Extension(
        'pycocotools._mask',
        sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'],
        include_dirs=[np.get_include(), '../common'],
        extra_compile_args=[] if platform.system() == 'Windows' else
        ['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
    )
]

setup(name='pycocotools',
      description='Official APIs for the MS-COCO dataset',
      packages=['pycocotools'],
      package_dir={'pycocotools': 'pycocotools'},
      setup_requires=setup_requires,
      install_requires=[
示例#26
0
#!/usr/bin/env python
import os
from setuptools import dist, find_packages, setup

dist.Distribution().fetch_build_eggs(['numpy', 'pytorch'])

import torch
from torch.utils.cpp_extension import (BuildExtension, CppExtension,
                                       CUDAExtension)


def readme():
    with open('README.md', encoding='utf-8') as f:
        content = f.read()
    return content


version_file = 'mmdet/version.py'


def get_version():
    with open(version_file, 'r') as f:
        exec(compile(f.read(), version_file, 'exec'))
    return locals()['__version__']


def make_cuda_ext(name, module, sources, sources_cuda=[]):

    define_macros = []
    extra_compile_args = {'cxx': []}
示例#27
0
文件: setup.py 项目: mhbai/ckipnlp
#!/usr/bin/env python3
# -*- coding:utf-8 -*-

__author__ = 'Mu Yang <http://muyang.pro>'
__copyright__ = '2018-2019 CKIP Lab'
__license__ = 'CC BY-NC-SA 4.0'

from setuptools import dist
dist.Distribution().fetch_build_eggs([
    'Cython>=0.29',
])

################################################################################

import os
import sys
import warnings

from distutils.version import StrictVersion
import setuptools

assert StrictVersion(setuptools.__version__) >= StrictVersion('40.0'), \
    'Please update setuptools to 40.0+ using `pip install -U setuptools`.'

################################################################################

from setuptools import setup, find_namespace_packages
from setuptools.extension import Extension
from setuptools.command.install import install
from setuptools.command.develop import develop
from Cython.Build import cythonize
示例#28
0
import copy
import glob
import os
import platform
import subprocess
import time
from collections import defaultdict

from setuptools import Extension, dist, find_packages, setup

import numpy as np  # noqa: E402
from Cython.Build import cythonize  # noqa: E402
from torch.utils.cpp_extension import BuildExtension, CUDAExtension

dist.Distribution().fetch_build_eggs(["Cython", "numpy>=1.11.1"])


def readme():
    with open("README.md", encoding="utf-8") as f:
        content = f.read()
    return content


MAJOR = 1
MINOR = 0
PATCH = ""
SUFFIX = "rc0"
SHORT_VERSION = "{}.{}.{}{}".format(MAJOR, MINOR, PATCH, SUFFIX)

version_file = "det3d/version.py"
示例#29
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""The setup script."""


from setuptools import find_packages, dist
import distutils.util
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
import os
from glob import glob

dist.Distribution().fetch_build_eggs(['Cython', 'numpy==1.18.3'])

import numpy

with open('README.rst') as readme_file:
    readme = readme_file.read()

with open('HISTORY.rst') as history_file:
    history = history_file.read()

requirements = ['numpy>=1.18.3', 'scipy>=1.4.1']

setup_requirements = ['pytest-runner']

test_requirements = ['pytest', 'nose', 'pluggy>=0.7.1']

# if any problems occur with macOS' clang not knowing the -fopenmp flag, see:
# https://stackoverflow.com/questions/43555410/enable-openmp-support-in-clang-in-mac-os-x-sierra-mojave?rq=1
示例#30
0
def load_requirements(filename):
    if os.path.isfile(filename):
        with open(filename, "w") as f:
            f.write(REQUIREMENTS)
    return [line.split(";")[0].strip() for line in REQUIREMENTS.splitlines()]


requirements = load_requirements("requirements.txt")

MSYS = os.getenv("MSYS")
CYTHON = platform.python_implementation() != "PyPy"

if CYTHON:
    # "Recommended" method of installing Cython: https://github.com/pypa/pip/issues/5761
    from setuptools import dist
    dist.Distribution().fetch_build_eggs(["cython>=0.29.16"])

    from Cython.Build import cythonize
    import Cython.Compiler.Options
    from Cython.Distutils import build_ext
else:
    try:
        for r in requirements:
            if "cython" in r:
                break
        else:
            r = None
        requirements.remove(r)
    except ValueError:
        pass