Skip to content

Commit eca7cff

Browse files
Merge pull request #231 from paxtonfitzpatrick/master
dealing with pip, setuptools, and non-PyPI dependencies
2 parents 4808f9e + 3c335f5 commit eca7cff

File tree

7 files changed

+23
-19
lines changed

7 files changed

+23
-19
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include requirements.txt
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
# The short X.Y version.
6969
version = u'0.6'
7070
# The full version, including alpha/beta/rc tags.
71-
release = u'0.6.0'
71+
release = u'0.6.2'
7272

7373
# The language for content autogenerated by Sphinx. Refer to documentation
7474
# for a list of supported languages.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ seaborn>=0.8.1
55
matplotlib>=1.5.1
66
scipy>=1.0.0
77
numpy>=1.10.4
8-
https://api.github.com/repos/lmcinnes/umap/tarball/5f9488a9540d1e0ac149e2dd42ebf03c39706110#egg=umap_learn
98
future
109
requests
1110
deepdish
1211
six
12+
# also requires umap-learn. However, due to a recent bug fix that has not been released on PyPI yet, umap-learn is installed from GitHub in setup.py

setup.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
# -*- coding: utf-8 -*-
22
import os
3+
import subprocess
4+
import sys
35
from setuptools import setup, find_packages
6+
from setuptools.command.install import install
47

58
os.environ["MPLCONFIGDIR"] = "."
69

710

8-
def parse_dependencies(requirements_path, vcs_id, egg_id):
9-
requirements = []
10-
with open(requirements_path, 'r') as f:
11-
reqs = f.read().splitlines()
11+
class PostInstall(install):
12+
github_pkg = 'https://api.github.com/repos/lmcinnes/umap/tarball/5f9488a9540d1e0ac149e2dd42ebf03c39706110#egg=umap_learn'
1213

13-
for req in reqs:
14-
if req.startswith(vcs_id) and egg_id in req:
15-
package_name = req[req.find(egg_id) + len(egg_id):]
16-
requirements.append(package_name + ' @ ' + req.rstrip(egg_id + package_name))
17-
else:
18-
requirements.append(req)
19-
20-
return requirements
14+
def run(self):
15+
install.run(self)
16+
output = subprocess.run([sys.executable, '-m', 'pip', 'install', self.github_pkg],
17+
stdout=subprocess.PIPE)
18+
print(output.stdout.decode('utf-8'))
2119

2220

2321
NAME = 'hypertools'
24-
VERSION = '0.6.0'
22+
VERSION = '0.6.2'
2523
AUTHOR = 'Contextual Dynamics Lab'
2624
AUTHOR_EMAIL = '[email protected]'
2725
URL = 'https://github.com/ContextLab/hypertools'
2826
DOWNLOAD_URL = URL
2927
LICENSE = 'MIT'
30-
REQUIRES_PYTHON = '>=3'
28+
REQUIRES_PYTHON = '>=3.5'
3129
PACKAGES = find_packages(exclude=('images', 'examples', 'tests'))
32-
REQUIREMENTS = parse_dependencies('requirements.txt', 'https://api.github.com', '#egg=')
33-
30+
with open('requirements.txt', 'r') as f:
31+
REQUIREMENTS = f.read().splitlines()
3432

3533
DESCRIPTION = 'A python package for visualizing and manipulating high-dimensional data'
3634
LONG_DESCRIPTION = """\
@@ -57,7 +55,11 @@ def parse_dependencies(requirements_path, vcs_id, egg_id):
5755
'Topic :: Multimedia :: Graphics',
5856
'Operating System :: POSIX',
5957
'Operating System :: Unix',
60-
'Operating System :: MacOS']
58+
'Operating System :: MacOS'
59+
]
60+
CMDCLASS = {
61+
'install': PostInstall
62+
}
6163

6264

6365
setup(
@@ -74,4 +76,5 @@ def parse_dependencies(requirements_path, vcs_id, egg_id):
7476
packages=PACKAGES,
7577
install_requires=REQUIREMENTS,
7678
classifiers=CLASSIFIERS,
79+
cmdclass=CMDCLASS,
7780
)

0 commit comments

Comments
 (0)