annoy

Форк
0
/
setup.py 
109 строк · 3.9 Кб
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
#
4
# Copyright (c) 2013 Spotify AB
5
#
6
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
7
# use this file except in compliance with the License. You may obtain a copy of
8
# the License at
9
#
10
# http://www.apache.org/licenses/LICENSE-2.0
11
#
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
# License for the specific language governing permissions and limitations under
16
# the License.
17

18
from setuptools import setup, Extension
19
import codecs
20
import os
21
import platform
22
import sys
23

24
readme_note = """\
25
.. note::
26

27
   For the latest source, discussion, etc, please visit the
28
   `GitHub repository <https://github.com/spotify/annoy>`_\n\n
29

30
.. image:: https://img.shields.io/github/stars/spotify/annoy.svg
31
    :target: https://github.com/spotify/annoy
32

33
"""
34

35
with codecs.open('README.rst', encoding='utf-8') as fobj:
36
    long_description = readme_note + fobj.read()
37

38
# Various platform-dependent extras
39
extra_compile_args = ['-D_CRT_SECURE_NO_WARNINGS', '-fpermissive']
40
extra_link_args = []
41
if platform.machine() == 'ppc64le':
42
    extra_compile_args += ['-mcpu=native',]
43

44
if platform.machine() == 'x86_64':
45
    # do not apply march on Intel Darwin
46
    if platform.system() != 'Darwin':
47
        # Not all CPUs have march as a tuning parameter
48
        extra_compile_args += ['-march=native',]
49

50
if os.name != 'nt':
51
    extra_compile_args += ['-O3', '-ffast-math', '-fno-associative-math']
52

53
# Add multithreaded build flag for all platforms using Python 3 and
54
# for non-Windows Python 2 platforms
55
python_major_version = sys.version_info[0]
56
if python_major_version == 3 or (python_major_version == 2 and os.name != 'nt'):
57
    extra_compile_args += ['-DANNOYLIB_MULTITHREADED_BUILD']
58

59
    if os.name != 'nt':
60
        extra_compile_args += ['-std=c++14']
61

62
# #349: something with OS X Mojave causes libstd not to be found
63
if platform.system() == 'Darwin':
64
    extra_compile_args += ['-mmacosx-version-min=10.12']
65
    extra_link_args += ['-stdlib=libc++', '-mmacosx-version-min=10.12']
66

67
# Manual configuration, you're on your own here.
68
manual_compiler_args = os.environ.get('ANNOY_COMPILER_ARGS', None)
69
if manual_compiler_args:
70
    extra_compile_args = manual_compiler_args.split(',')
71
manual_linker_args = os.environ.get('ANNOY_LINKER_ARGS', None)
72
if manual_linker_args:
73
    extra_link_args = manual_linker_args.split(',')
74

75
setup(name='annoy',
76
      version='1.17.3',
77
      description='Approximate Nearest Neighbors in C++/Python optimized for memory usage and loading/saving to disk.',
78
      packages=['annoy'],
79
      package_data={'annoy': ['__init__.pyi', 'py.typed']},
80
      ext_modules=[
81
          Extension(
82
              'annoy.annoylib', ['src/annoymodule.cc'],
83
              depends=['src/annoylib.h', 'src/kissrandom.h', 'src/mman.h'],
84
              extra_compile_args=extra_compile_args,
85
              extra_link_args=extra_link_args,
86
          )
87
      ],
88
      long_description=long_description,
89
      author='Erik Bernhardsson',
90
      author_email='mail@erikbern.com',
91
      url='https://github.com/spotify/annoy',
92
      license='Apache License 2.0',
93
      classifiers=[
94
          'Development Status :: 5 - Production/Stable',
95
          'Programming Language :: Python',
96
          'Programming Language :: Python :: 2.6',
97
          'Programming Language :: Python :: 2.7',
98
          'Programming Language :: Python :: 3.3',
99
          'Programming Language :: Python :: 3.4',
100
          'Programming Language :: Python :: 3.5',
101
          'Programming Language :: Python :: 3.6',
102
          'Programming Language :: Python :: 3.7',
103
          'Programming Language :: Python :: 3.8',
104
          'Programming Language :: Python :: 3.9',
105
      ],
106
      keywords='nns, approximate nearest neighbor search',
107
      setup_requires=['nose>=1.0'],
108
      tests_require=['numpy', 'h5py']
109
      )
110

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.