Skip to content

Commit 81317df

Browse files
authored
MAINT simplify setup.py (#362)
* MAINT simplify setup.py * FIX import version
1 parent 2f7e4e5 commit 81317df

File tree

8 files changed

+63
-230
lines changed

8 files changed

+63
-230
lines changed

conda-recipe/imbalanced-learn/meta.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ requirements:
1414
build:
1515
- python
1616
- setuptools
17-
- scikit-learn 0.19.*
1817
run:
1918
- python
2019
- scikit-learn 0.19.*
2120

2221
test:
2322
requires:
24-
- nose
25-
- coverage
2623
- pytest
2724
- pytest-cov
2825
imports:

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
# built documents.
104104
#
105105
# The short X.Y version.
106-
__version__ = '0.4.0.dev0'
106+
from imblearn import __version__
107107
version = __version__
108108
# The full version, including alpha/beta/rc tags.
109109
release = __version__

imblearn/__init__.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,7 @@
2626
Module which allowing to create pipeline with scikit-learn estimators.
2727
"""
2828

29-
from .version import _check_module_dependencies, __version__
30-
31-
_check_module_dependencies()
32-
33-
# Boolean controlling whether the joblib caches should be
34-
# flushed if the version of certain modules changes (eg nibabel, as it
35-
# does not respect the backward compatibility in some of its internal
36-
# structures
37-
# This is used in nilearn._utils.cache_mixin
38-
CHECK_CACHE_VERSION = True
29+
from ._version import __version__
3930

4031
# list all submodules available in imblearn and version
4132
__all__ = [

imblearn/_version.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""
2+
``imbalanced-learn`` is a set of python methods to deal with imbalanced
3+
datset in machine learning and pattern recognition.
4+
"""
5+
# Based on NiLearn package
6+
# License: simplified BSD
7+
8+
# PEP0440 compatible formatted version, see:
9+
# https://www.python.org/dev/peps/pep-0440/
10+
#
11+
# Generic release markers:
12+
# X.Y
13+
# X.Y.Z # For bugfix releases
14+
#
15+
# Admissible pre-release markers:
16+
# X.YaN # Alpha release
17+
# X.YbN # Beta release
18+
# X.YrcN # Release Candidate
19+
# X.Y # Final release
20+
#
21+
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
22+
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
23+
#
24+
__version__ = '0.4.0.dev0'

imblearn/setup.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

imblearn/version.py

Lines changed: 0 additions & 102 deletions
This file was deleted.

requirements.test.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
matplotlib>=2.0.0
2+
pytest
3+
pytest-cov

setup.py

Lines changed: 34 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -6,96 +6,46 @@
66
import sys
77

88
from setuptools import find_packages, setup
9+
from imblearn import __version__
910

1011

11-
def load_version():
12-
"""Executes imblearn/version.py in a globals dictionary and
13-
return it.
14-
"""
15-
# load all vars into globals, otherwise
16-
# the later function call using global vars doesn't work.
17-
globals_dict = {}
18-
with codecs.open(os.path.join('imblearn', 'version.py'),
19-
encoding='utf-8-sig') as fp:
20-
exec(fp.read(), globals_dict)
21-
22-
return globals_dict
23-
24-
25-
def is_installing():
26-
# Allow command-lines such as "python setup.py build install"
27-
install_commands = set(['install', 'develop'])
28-
return install_commands.intersection(set(sys.argv))
29-
30-
31-
# Make sources available using relative paths from this file's directory.
32-
os.chdir(os.path.dirname(os.path.abspath(__file__)))
33-
34-
35-
_VERSION_GLOBALS = load_version()
3612
DISTNAME = 'imbalanced-learn'
3713
DESCRIPTION = 'Toolbox for imbalanced dataset in machine learning.'
3814
with codecs.open('README.rst', encoding='utf-8-sig') as f:
3915
LONG_DESCRIPTION = f.read()
40-
MAINTAINER = 'G. Lemaitre, F. Nogueira, D. Oliveira, C. Aridas'
41-
MAINTAINER_EMAIL = ('[email protected], [email protected], '
42-
16+
MAINTAINER = 'G. Lemaitre, C. Aridas'
17+
4318
URL = 'https://github.com/scikit-learn-contrib/imbalanced-learn'
4419
LICENSE = 'MIT'
4520
DOWNLOAD_URL = 'https://github.com/scikit-learn-contrib/imbalanced-learn'
46-
VERSION = _VERSION_GLOBALS['__version__']
47-
48-
49-
def configuration(parent_package='', top_path=None):
50-
if os.path.exists('MANIFEST'):
51-
os.remove('MANIFEST')
52-
53-
from numpy.distutils.misc_util import Configuration
54-
config = Configuration(None, parent_package, top_path)
55-
56-
config.add_subpackage('imblearn')
57-
58-
return config
59-
60-
61-
if __name__ == "__main__":
62-
if is_installing():
63-
module_check_fn = _VERSION_GLOBALS['_check_module_dependencies']
64-
module_check_fn(is_imbalanced_dataset_installing=True)
65-
66-
install_requires = \
67-
['%s>=%s' % (mod, meta['min_version'])
68-
for mod, meta in _VERSION_GLOBALS['REQUIRED_MODULE_METADATA']
69-
if not meta['required_at_installation']]
70-
71-
setup(configuration=configuration,
72-
name=DISTNAME,
73-
maintainer=MAINTAINER,
74-
maintainer_email=MAINTAINER_EMAIL,
75-
description=DESCRIPTION,
76-
license=LICENSE,
77-
url=URL,
78-
version=VERSION,
79-
download_url=DOWNLOAD_URL,
80-
long_description=LONG_DESCRIPTION,
81-
zip_safe=False, # the package can run out of an .egg file
82-
classifiers=[
83-
'Intended Audience :: Science/Research',
84-
'Intended Audience :: Developers',
85-
'License :: OSI Approved',
86-
'Programming Language :: C',
87-
'Programming Language :: Python',
88-
'Topic :: Software Development',
89-
'Topic :: Scientific/Engineering',
90-
'Operating System :: Microsoft :: Windows',
91-
'Operating System :: POSIX',
92-
'Operating System :: Unix',
93-
'Operating System :: MacOS',
94-
'Programming Language :: Python :: 2.7',
95-
'Programming Language :: Python :: 3.5',
96-
'Programming Language :: Python :: 3.6'
97-
],
98-
packages=find_packages(),
99-
install_requires=['scipy',
100-
'numpy',
101-
'scikit-learn'])
21+
VERSION = __version__
22+
INSTALL_REQUIRES = ['numpy', 'scipy', 'scikit-learn']
23+
CLASSIFIERS = ['Intended Audience :: Science/Research',
24+
'Intended Audience :: Developers',
25+
'License :: OSI Approved',
26+
'Programming Language :: C',
27+
'Programming Language :: Python',
28+
'Topic :: Software Development',
29+
'Topic :: Scientific/Engineering',
30+
'Operating System :: Microsoft :: Windows',
31+
'Operating System :: POSIX',
32+
'Operating System :: Unix',
33+
'Operating System :: MacOS',
34+
'Programming Language :: Python :: 2.7',
35+
'Programming Language :: Python :: 3.5',
36+
'Programming Language :: Python :: 3.6']
37+
38+
39+
setup(name=DISTNAME,
40+
maintainer=MAINTAINER,
41+
maintainer_email=MAINTAINER_EMAIL,
42+
description=DESCRIPTION,
43+
license=LICENSE,
44+
url=URL,
45+
version=VERSION,
46+
download_url=DOWNLOAD_URL,
47+
long_description=LONG_DESCRIPTION,
48+
zip_safe=False, # the package can run out of an .egg file
49+
classifiers=CLASSIFIERS,
50+
packages=find_packages(),
51+
install_requires=INSTALL_REQUIRES)

0 commit comments

Comments
 (0)