forked from inspirehep/beard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
122 lines (103 loc) · 3.26 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# -*- coding: utf-8 -*-
#
# This file is part of Beard.
# Copyright (C) 2014, 2015 CERN.
#
# Beard is a free software; you can redistribute it and/or modify it
# under the terms of the Revised BSD License; see LICENSE file for
# more details.
"""Setup file for Beard.
.. codeauthor:: Mateusz Susik <[email protected]>
.. codeauthor:: Jan Aage Lavik <[email protected]>
"""
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import os
import re
import sys
class PyTest(TestCommand):
"""Handle ``python setup.py test``."""
user_options = [("pytest-args=", "a", "Arguments to pass to py.test")]
def initialize_options(self):
"""Read options from ``pytest.ini`` config file."""
TestCommand.initialize_options(self)
try:
from ConfigParser import ConfigParser
except ImportError:
from configparser import ConfigParser
config = ConfigParser()
config.read("pytest.ini")
self.pytest_args = config.get("pytest", "addopts").split(" ")
def finalize_options(self):
"""Finalize options."""
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
"""Run tests using pytest library."""
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
packages = find_packages(exclude=['doc', 'examples'])
# Get the version string. Cannot be done with import!
with open(os.path.join("beard", "__init__.py"), "rt") as f:
_version = re.search(
'__version__\s*=\s*"(?P<version>.*)"\n',
f.read()
).group("version")
_classifiers = [
# clasifiers for PyPI
"Development Status :: 1 - Planning",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Information Analysis"
]
_keywords = [
"author disambiguation",
"machine learning",
"data mining"
]
_install_requires = [
"joblib>=0.8.4",
"numpy>=1.9",
"scikit-learn>=0.15.2",
"scipy>=0.14",
"six",
"unidecode"
]
_tests_require = [
"pytest",
"pytest-cache>=1.0",
"pytest-cov>=1.8.0",
"pytest-pep8>=1.0.6",
"pytest>=2.6.1",
"coverage"
]
_parameters = {
"author": "Invenio collaboration",
"author_email": "[email protected]",
"classifiers": _classifiers,
"cmdclass": {"test": PyTest},
"description": "Bibliographic Entity Automatic \
Recognition and Disambiguation",
"install_requires": _install_requires,
"keywords": _keywords,
"license": "BSD",
"long_description": open("README.rst").read(),
"name": "beard",
"packages": packages,
"platforms": "any",
"tests_require": _tests_require,
"url": "https://github.com/inveniosoftware/beard",
"version": _version,
}
setup(**_parameters)