|
| 1 | +import os, sys |
| 2 | +import shutil |
1 | 3 | from setuptools import setup |
| 4 | +import pkg_resources |
2 | 5 |
|
| 6 | +# build dependencies |
| 7 | +import pyct.build |
3 | 8 |
|
4 | | -setup(name='xarray-spatial', |
5 | | - use_scm_version={ |
6 | | - "write_to": "xrspatial/_version.py", |
7 | | - "write_to_template": '__version__ = "{version}"', |
8 | | - "tag_regex": r"^(?P<prefix>v)?(?P<version>[^\+]+)(?P<suffix>.*)?$", |
9 | | - }, |
10 | | - description='xarray-based spatial analysis tools', |
11 | | - packages=['xrspatial', |
12 | | - 'xrspatial.tests'], |
13 | | - install_requires=[ |
14 | | - 'dask', |
15 | | - 'datashader', |
16 | | - 'numba', |
17 | | - 'numpy', |
18 | | - 'pandas', |
19 | | - 'pillow', |
20 | | - 'requests', |
21 | | - 'scipy', |
22 | | - 'xarray', |
23 | | - ], |
24 | | - zip_safe=False, |
25 | | - classifiers=["Programming Language :: Python :: 3", |
26 | | - "License :: OSI Approved :: MIT License", |
27 | | - "Operating System :: OS Independent"], |
28 | | - include_package_data=True) |
| 9 | +# dependencies |
| 10 | + |
| 11 | +# datashader first, then pyct unless pyct version compatible with ds is specified |
| 12 | +# spatialpandas may not be required in final pharmacy_desert version |
| 13 | +# pyct may not be required after pyctdev is released |
| 14 | +install_requires = [ |
| 15 | + 'dask', |
| 16 | + 'datashader', |
| 17 | + 'numba', |
| 18 | + 'numpy', |
| 19 | + 'pandas', |
| 20 | + 'pillow', |
| 21 | + 'requests', |
| 22 | + 'scipy', |
| 23 | + 'xarray', |
| 24 | + 'pyct', |
| 25 | + ] |
| 26 | + |
| 27 | +examples = [ |
| 28 | + 'spatialpandas', |
| 29 | +] |
| 30 | + |
| 31 | +# Additional tests dependencies and examples_extra may be needed in the future |
| 32 | +extras_require = { |
| 33 | + 'tests': [ |
| 34 | + 'pytest', |
| 35 | + ], |
| 36 | + 'examples': examples, |
| 37 | +} |
| 38 | + |
| 39 | +# additional doc dependencies may be needed |
| 40 | +extras_require['doc'] = extras_require['examples'] + ['numpydoc'] |
| 41 | + |
| 42 | +extras_require['all'] = sorted(set(sum(extras_require.values(), []))) |
| 43 | + |
| 44 | +# metadata for setuptools |
| 45 | + |
| 46 | +setup_args = dict( |
| 47 | + name='xarray-spatial', |
| 48 | + use_scm_version={ |
| 49 | + "write_to": "xrspatial/_version.py", |
| 50 | + "write_to_template": '__version__ = "{version}"', |
| 51 | + "tag_regex": r"^(?P<prefix>v)?(?P<version>[^\+]+)(?P<suffix>.*)?$", |
| 52 | + }, |
| 53 | + description='xarray-based spatial analysis tools', |
| 54 | + install_requires=install_requires, |
| 55 | + extras_require=extras_require, |
| 56 | + tests_require=extras_require['tests'], |
| 57 | + zip_safe=False, |
| 58 | + classifiers=["Programming Language :: Python :: 3", |
| 59 | + "License :: OSI Approved :: MIT License", |
| 60 | + "Operating System :: OS Independent"], |
| 61 | + packages=['xrspatial', |
| 62 | + 'xrspatial.tests' |
| 63 | + ], |
| 64 | + include_package_data=True, |
| 65 | + entry_points={ |
| 66 | + 'console_scripts': [ |
| 67 | + 'xrspatial = xrspatial.__main__:main' |
| 68 | + ] |
| 69 | + }, |
| 70 | +) |
| 71 | + |
| 72 | +if __name__ == '__main__': |
| 73 | + example_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), |
| 74 | + 'xrspatial', 'examples') |
| 75 | + if 'develop' not in sys.argv: |
| 76 | + pyct.build.examples(example_path, __file__, force=True) |
| 77 | + setup(**setup_args) |
| 78 | + |
| 79 | + if os.path.isdir(example_path): |
| 80 | + shutil.rmtree(example_path) |
0 commit comments