Skip to content

Commit f7af298

Browse files
committed
Update setup. Version bump.
1 parent 50bffef commit f7af298

7 files changed

+831
-30
lines changed

COPYING.txt

+674
Large diffs are not rendered by default.

LICENSE.txt

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright (c) 2011-2015 Marinka Zitnik and Blaz Zupan.
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
2. Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Nimfa
22
-----
33

4-
Nimfa is a Python library that implements a number of nonnegative matrix factorization algorithms.
4+
Nimfa is a Python module that implements many algorithms for nonnegative matrix factorization.
55

6-
Documentation and examples on real-world data are at `Nimfa website`_.
6+
Documentation and examples are at `Nimfa website`_.
77

88
.. _Nimfa website: http://nimfa.biolab.si
99

nimfa/__init__.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
"""
3-
###########
3+
#################
44
Nimfa (``nimfa``)
5-
###########
5+
#################
66
7-
Nimfa is a Python library which includes a number of published matrix
7+
Nimfa is a Python module which includes a number of published matrix
88
factorization algorithms, initialization methods, quality and performance
99
measures and facilitates the combination of these to produce new strategies.
1010
The library represents a unified and efficient interface to matrix
@@ -20,3 +20,5 @@
2020

2121
from nimfa import examples
2222
from nimfa.methods.factorization import *
23+
from .version import \
24+
short_version as __version__, git_revision as __git_version__

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
numpy>=1.7.0
2+
scipy>=0.12.0

setup.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[bdist_wheel]
2+
universal=1

setup.py

+123-25
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
11
import os
22
from glob import glob
33
from setuptools import setup, find_packages
4+
import subprocess
5+
import imp
46

5-
NAME = "nimfa"
67

7-
def read(fname):
8-
return open(os.path.join(os.path.dirname(__file__), fname)).read()
8+
DISTNAME = 'nimfa'
9+
MAINTAINER = 'Marinka Zitnik'
10+
MAINTAINER_EMAIL = '[email protected]'
11+
DESCRIPTION = 'A Python module for nonnegative matrix factorization'
12+
LONG_DESCRIPTION = open('README.rst').read()
13+
URL = 'http://nimfa.biolab.si'
14+
DOWNLOAD_URL = 'http://github.com/marinkaz/nimfa'
15+
KEYWORDS = ['matrix factorization', 'nonnegative matrix factorization',
16+
'bioinformatics', 'data mining']
17+
LICENSE = 'GPLv3'
18+
VERSION = '1.2.2'
19+
ISRELEASED = True
20+
21+
INSTALL_REQUIRES = (
22+
'numpy>=1.7.0',
23+
'scipy>=0.12.0',
24+
)
25+
926

1027
def get_package_data(topdir, excluded=set()):
1128
retval = []
12-
for dirname, subdirs, files in os.walk(os.path.join(NAME, topdir)):
29+
for dirname, subdirs, files in os.walk(os.path.join(DISTNAME, topdir)):
1330
for x in excluded:
1431
if x in subdirs:
1532
subdirs.remove(x)
16-
retval.append(os.path.join(dirname[len(NAME)+1:], '*.*'))
33+
retval.append(os.path.join(dirname[len(DISTNAME)+1:], '*.*'))
1734
return retval
1835

36+
1937
def get_data_files(dest, source):
2038
retval = []
2139
for dirname, subdirs, files in os.walk(source):
@@ -25,23 +43,103 @@ def get_data_files(dest, source):
2543
return retval
2644

2745

28-
setup(
29-
name = NAME,
30-
version = "1.2.1",
31-
author = "Marinka Zitnik",
32-
author_email = "[email protected]",
33-
description = "A Python Library for Nonnegative Matrix Factorization Techniques",
34-
url = "http://nimfa.biolab.si",
35-
download_url = "https://github.com/marinkaz/MF",
36-
packages = find_packages(),
37-
package_dir = {NAME: "./nimfa"},
38-
package_data = {NAME: get_package_data("datasets")},
39-
license = "OSI Approved :: GNU General Public License (GPL)",
40-
long_description = read("README.rst"),
41-
classifiers = [
42-
"License :: OSI Approved :: GNU General Public License (GPL)",
43-
"Natural Language :: English",
44-
"Programming Language :: Python",
45-
"Topic :: Scientific/Engineering"
46-
]
47-
)
46+
# Return the git revision as a string
47+
def git_version():
48+
"""Return the git revision as a string.
49+
50+
Copied from numpy setup.py
51+
"""
52+
def _minimal_ext_cmd(cmd):
53+
# construct minimal environment
54+
env = {}
55+
for k in ['SYSTEMROOT', 'PATH']:
56+
v = os.environ.get(k)
57+
if v is not None:
58+
env[k] = v
59+
# LANGUAGE is used on win32
60+
env['LANGUAGE'] = 'C'
61+
env['LANG'] = 'C'
62+
env['LC_ALL'] = 'C'
63+
out = subprocess.Popen(cmd, stdout = subprocess.PIPE, env=env).communicate()[0]
64+
return out
65+
66+
try:
67+
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
68+
GIT_REVISION = out.strip().decode('ascii')
69+
except OSError:
70+
GIT_REVISION = "Unknown"
71+
return GIT_REVISION
72+
73+
74+
def write_version_py(filename='nimfa/version.py'):
75+
# Copied from numpy setup.py
76+
cnt = """
77+
# THIS FILE IS GENERATED FROM NIMFA SETUP.PY
78+
short_version = '%(version)s'
79+
version = '%(version)s'
80+
full_version = '%(full_version)s'
81+
git_revision = '%(git_revision)s'
82+
release = %(isrelease)s
83+
84+
if not release:
85+
version = full_version
86+
short_version += ".dev"
87+
"""
88+
FULLVERSION = VERSION
89+
if os.path.exists('.git'):
90+
GIT_REVISION = git_version()
91+
elif os.path.exists('nimfa/version.py'):
92+
# must be a source distribution, use existing version file
93+
version = imp.load_source("nimfa.version", "nimfa/version.py")
94+
GIT_REVISION = version.git_revision
95+
else:
96+
GIT_REVISION = "Unknown"
97+
98+
if not ISRELEASED:
99+
FULLVERSION += '.dev0+' + GIT_REVISION[:7]
100+
101+
a = open(filename, 'w')
102+
try:
103+
a.write(cnt % {'version': VERSION,
104+
'full_version': FULLVERSION,
105+
'git_revision': GIT_REVISION,
106+
'isrelease': str(ISRELEASED)})
107+
finally:
108+
a.close()
109+
110+
111+
112+
def setup_package():
113+
write_version_py()
114+
setup(
115+
name=DISTNAME,
116+
version=VERSION,
117+
author=MAINTAINER,
118+
author_email=MAINTAINER_EMAIL,
119+
maintainer=MAINTAINER,
120+
maintainer_email=MAINTAINER_EMAIL,
121+
description=DESCRIPTION,
122+
url=URL,
123+
download_url=DOWNLOAD_URL,
124+
keywords=KEYWORDS,
125+
install_requires=INSTALL_REQUIRES,
126+
packages=find_packages(),
127+
package_dir={DISTNAME: "./nimfa"},
128+
package_data={DISTNAME: get_package_data("datasets")},
129+
license=LICENSE,
130+
long_description=LONG_DESCRIPTION,
131+
classifiers=['Intended Audience :: Science/Research',
132+
'Intended Audience :: Developers',
133+
'License :: OSI Approved',
134+
'Programming Language :: Python',
135+
'Topic :: Software Development',
136+
'Topic :: Scientific/Engineering',
137+
'Topic :: Scientific/Engineering :: Artificial Intelligence',
138+
'Topic :: Scientific/Engineering :: Bio-Informatics',
139+
'Programming Language :: Python :: 2',
140+
'Programming Language :: Python :: 3',],
141+
)
142+
143+
144+
if __name__ == "__main__":
145+
setup_package()

0 commit comments

Comments
 (0)