setup.py 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. """
  2. Lakesuperior setup script.
  3. Proudly ripped from https://github.com/pypa/sampleproject/blob/master/setup.py
  4. """
  5. import sys
  6. # Always prefer setuptools over distutils
  7. from setuptools import Extension, setup, find_packages
  8. # To use a consistent encoding
  9. from codecs import open
  10. from glob import glob
  11. from os import path
  12. import lakesuperior
  13. try:
  14. from Cython.Build import cythonize
  15. except ImportError:
  16. USE_CYTHON = False
  17. print('Not using Cython to compile extensions.')
  18. else:
  19. USE_CYTHON = True
  20. print('Using Cython to compile extensions.')
  21. # ``pytest_runner`` is referenced in ``setup_requires``.
  22. # See https://github.com/pytest-dev/pytest-runner#conditional-requirement
  23. needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
  24. pytest_runner = ['pytest-runner'] if needs_pytest else []
  25. # Get the long description from the README file
  26. readme_fpath = path.join(path.dirname(lakesuperior.basedir), 'README.rst')
  27. with open(readme_fpath, encoding='utf-8') as f:
  28. long_description = f.read()
  29. # Extensions directory.
  30. ext_dir = path.join(path.dirname(lakesuperior.basedir), 'ext')
  31. include_dirs = [
  32. path.join(ext_dir, 'include'),
  33. ]
  34. if USE_CYTHON:
  35. include_dirs.append(path.join(lakesuperior.basedir, 'cy_include'))
  36. ext = 'pyx'
  37. else:
  38. ext = 'c'
  39. extensions = [
  40. Extension(
  41. 'lakesuperior.store.base_lmdb_store',
  42. [
  43. path.join(ext_dir, 'lib', 'mdb.c'),
  44. path.join(ext_dir, 'lib', 'midl.c'),
  45. path.join(lakesuperior.basedir, 'store', f'base_lmdb_store.{ext}'),
  46. ],
  47. include_dirs=include_dirs,
  48. ),
  49. Extension(
  50. 'lakesuperior.store.ldp_rs.term',
  51. [
  52. path.join(ext_dir, 'lib', 'tpl.c'),
  53. path.join(lakesuperior.basedir, 'store', 'ldp_rs', f'term.{ext}'),
  54. ],
  55. include_dirs=include_dirs,
  56. extra_compile_args=['-fopenmp'],
  57. extra_link_args=['-fopenmp'],
  58. libraries=['crypto']
  59. ),
  60. Extension(
  61. 'lakesuperior.store.ldp_rs.lmdb_triplestore',
  62. [
  63. path.join(ext_dir, 'lib', 'mdb.c'),
  64. path.join(ext_dir, 'lib', 'midl.c'),
  65. path.join(
  66. lakesuperior.basedir, 'store', 'ldp_rs',
  67. f'lmdb_triplestore.{ext}'),
  68. ],
  69. include_dirs=include_dirs,
  70. extra_compile_args=['-fopenmp'],
  71. extra_link_args=['-fopenmp'],
  72. libraries=['crypto']
  73. ),
  74. # For testing.
  75. #Extension(
  76. # '*',
  77. # [
  78. # #path.join(ext_dir, 'lib', 'tpl.c'),
  79. # path.join(
  80. # path.dirname(lakesuperior.basedir), 'sandbox', f'*.{ext}'),
  81. # ],
  82. # include_dirs=include_dirs,
  83. #),
  84. ]
  85. if USE_CYTHON:
  86. extensions = cythonize(extensions, compiler_directives={
  87. 'language_level': 3,
  88. 'boundscheck': False,
  89. 'wraparound': False,
  90. 'profile': True,
  91. })
  92. setup(
  93. name='lakesuperior',
  94. version=lakesuperior.release,
  95. description='A Linked Data Platform repository sever.',
  96. long_description=long_description,
  97. long_description_content_type='text/x-rst; charset=UTF-8',
  98. url='https://lakesuperior.readthedocs.io',
  99. author='Stefano Cossu <@scossu>',
  100. #author_email='',
  101. license='Apache License Version 2.0',
  102. ext_modules=extensions,
  103. # https://pypi.python.org/pypi?%3Aaction=list_classifiers
  104. classifiers=[
  105. 'Development Status :: 3 - Alpha',
  106. 'Environment :: Console',
  107. 'Environment :: Web Environment',
  108. 'Framework :: Flask',
  109. 'Intended Audience :: Developers',
  110. 'Intended Audience :: Information Technology',
  111. 'Intended Audience :: Science/Research',
  112. 'License :: OSI Approved :: Apache Software License',
  113. 'Natural Language :: English',
  114. 'Operating System :: MacOS',
  115. 'Operating System :: Microsoft :: Windows',
  116. 'Operating System :: POSIX :: Linux',
  117. 'Programming Language :: Python :: 3',
  118. 'Programming Language :: Python :: 3.6',
  119. 'Programming Language :: Python :: 3.7',
  120. 'Topic :: Database :: Database Engines/Servers',
  121. ],
  122. keywords='repository linked-data',
  123. python_requires='~=3.6',
  124. packages=find_packages(exclude=['contrib', 'docs', 'tests']),
  125. # Great reference read about dependency management:
  126. # https://caremad.io/posts/2013/07/setup-vs-requirement/
  127. install_requires=[
  128. 'CoilMQ',
  129. 'Flask',
  130. 'HiYaPyCo',
  131. 'PyYAML',
  132. 'arrow',
  133. 'cchardet',
  134. 'click',
  135. 'click-log',
  136. 'gevent',
  137. 'gunicorn',
  138. 'rdflib',
  139. 'rdflib-jsonld',
  140. 'requests',
  141. 'requests-toolbelt',
  142. 'sphinx-rtd-theme',
  143. 'stomp.py',
  144. ],
  145. setup_requires=[
  146. 'setuptools>=18.0',
  147. ] + pytest_runner,
  148. tests_require=[
  149. 'Pillow',
  150. 'numpy',
  151. 'pytest',
  152. 'pytest-flask',
  153. ],
  154. include_package_data=True,
  155. #extras_require={},
  156. #package_data={
  157. #},
  158. #data_files=[],
  159. entry_points={
  160. 'console_scripts': [
  161. 'lsup-admin=lakesuperior.lsup_admin:admin',
  162. 'lsup-benchmark=lakesuperior.util.benchmark:run',
  163. 'lsup-profiler=lakesuperior.profiler:run',
  164. 'lsup-server=lakesuperior.server:run',
  165. ],
  166. },
  167. project_urls={
  168. 'Source Code': 'https://github.com/scossu/lakesuperior/',
  169. 'Documentation': 'https://lakesuperior.readthedocs.io',
  170. 'Discussion': 'https://groups.google.com/forum/#!forum/lakesuperior',
  171. 'Bug Reports': 'https://github.com/scossu/lakesuperior/issues',
  172. }
  173. )