Skip to content

Commit

Permalink
use requirements files as input to setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-tham committed Sep 30, 2016
1 parent d8c6d1b commit f87cd03
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 32 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -26,10 +26,10 @@ before_install:
install:
- conda install --yes pip
- if [ "$PYSAL_PLUS" == true ]; then
echo 'plus testing'; pip install .[plus];
else pip install .;
echo 'plus testing'; conda install --yes --file requirements_plus.txt;
else conda install --yes --file requirements.txt;
fi;
- pip install .[dev]
- pip install -r requirements_dev.txt

script:
- python setup.py sdist >/dev/null
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
@@ -0,0 +1,2 @@
scipy>=0.11
numpy>=1.3
7 changes: 7 additions & 0 deletions requirements_dev.txt
@@ -0,0 +1,7 @@
nose
nose-progressive
nose-exclude
coverage
sphinx
sphinxcontrib-napoleon
coveralls
11 changes: 11 additions & 0 deletions requirements_plus.txt
@@ -0,0 +1,11 @@
matplotlib>=1.5.1
seaborn>=0.7.0
geopandas>=0.2
scikit-learn>=0.17.1
bokeh>=0.11.1
geojson>=1.3.2
folium>=0.2.1
mplleaflet>=0.0.5
statsmodels>=0.6.1
numba
numexpr
50 changes: 21 additions & 29 deletions setup.py
Expand Up @@ -24,9 +24,17 @@
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')

def _get_requirements_from_files(groups_files):
groups_reqlist = {}

def setup_package():
for k,v in groups_files.items():
with open(v, 'r') as f:
pkg_list = f.read().splitlines()
groups_reqlist[k] = pkg_list

return groups_reqlist

def setup_package():
# get all file endings and copy whole file names without a file suffix
# assumes nested directories are only down one level
example_data_files = set()
Expand All @@ -43,6 +51,16 @@ def setup_package():

example_data_files.add(glob_name)

_groups_files = {
'base': 'requirements.txt',
'plus': 'requirements_plus.txt',
'dev': 'requirements_dev.txt'
}

reqs = _get_requirements_from_files(_groups_files)
install_reqs = reqs.pop('base')
extras_reqs = reqs

setup(
name='PySAL',
version=VERSION,
Expand Down Expand Up @@ -74,34 +92,8 @@ def setup_package():
packages=find_packages(exclude=[".meta", "*.meta.*", "meta.*",
"meta"]),
package_data={'pysal': list(example_data_files)},
install_requires=[
'scipy>=0.11',
'numpy>=1.3',
],
extras_require={
'plus': [
'matplotlib>=1.5.1',
'seaborn>=0.7.0',
'geopandas>=0.2',
'scikit-learn>=0.17.1',
'bokeh>=0.11.1',
'geojson>=1.3.2',
'folium>=0.2.1',
'mplleaflet>=0.0.5',
'statsmodels>=0.6.1',
'numba',
'numexpr',
],
'dev': [
'nose',
'nose-progressive',
'nose-exclude',
'coverage',
'sphinx',
'sphinxcontrib-napoleon',
'coveralls',
],
},
install_requires=install_reqs,
extras_require=extras_reqs,
cmdclass={'build_py': build_py}
)

Expand Down

0 comments on commit f87cd03

Please sign in to comment.