Skip to content

Commit e6b5af9

Browse files
authored
Modernise build system (#654)
1 parent 91917c5 commit e6b5af9

File tree

8 files changed

+77
-107
lines changed

8 files changed

+77
-107
lines changed

.appveyor.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ environment:
1010
build: off
1111

1212
install:
13-
- "%PYTHON%\\python.exe -m pip install wheel"
14-
- "%PYTHON%\\python.exe -m pip install -r requirements.txt"
15-
- "%PYTHON%\\python.exe -m pip install -r requirements-dev.txt"
13+
- "%PYTHON%\\python.exe -m pip install .[tests]"
1614

1715
test_script:
1816
- "%PYTHON%\\python.exe -m pytest"

.github/workflows/docs-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: |
2222
pip install .[docs,tests]
2323
pip list
24-
- name: Build
24+
- name: Build docs
2525
run: |
2626
make -C docs html
2727
- uses: lauchacarro/Azure-Storage-Action@v1.0

.github/workflows/pypi-publish.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ on:
55
- '*'
66
jobs:
77
publish:
8-
runs-on: ubuntu-18.04
8+
runs-on: ubuntu-20-04
99
steps:
1010
- uses: actions/checkout@master
11-
- name: Set up Python 3.8
11+
- name: Set up Python 3.9
1212
uses: actions/setup-python@v1
1313
with:
14-
python-version: 3.8
14+
python-version: 3.9
1515
- name: Get release version
1616
run: |
1717
echo "CHANGELOG_VERSION=$(cat CHANGELOG.md | grep -oP '(?<=###\s)(.*)(?=\s\-)' | head -n 1 | sed 's/Version\s/v/')" >> $GITHUB_ENV
@@ -24,14 +24,12 @@ jobs:
2424
- name: Install dependencies
2525
run: |
2626
python -m pip install --upgrade pip
27-
pip install pyct \
28-
wheel \
29-
setuptools
27+
pip install build
3028
- name: Get all git tags
3129
run: git fetch --tags -f
3230
- name: Build package
3331
run: |
34-
python setup.py sdist bdist_wheel
32+
python -m build --sdist --wheel
3533
- name: Get package size
3634
run: echo "PKG_SIZE=$(find dist -maxdepth 1 -regex '.*gz' | xargs stat --format='%s')" >> $GITHUB_ENV
3735
- name: Check package size
@@ -44,4 +42,4 @@ jobs:
4442
uses: pypa/gh-action-pypi-publish@master
4543
with:
4644
skip_existing: true
47-
password: ${{ secrets.PYPI_API_TOKEN }}
45+
password: ${{ secrets.PYPI_API_TOKEN }}

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[build-system]
22
requires = [
3-
'param >=1.6.1',
4-
'pyct >= 0.4.8',
3+
'build',
4+
'param',
5+
'pyct',
56
'setuptools >= 54.1.2',
6-
'wheel >= 0.36.2',
77
]
8+
89
[tool.check-manifest]
910
ignore = [
1011
'.appveyor.yml',

requirements-dev.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ check-manifest
22
pytest
33
setuptools_scm
44
tox
5-
twine
6-
wheel

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
bokeh>2
1+
bokeh >2
22
datashader
33
noise >=1.2.2
44
numba

setup.cfg

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,61 @@
11
[metadata]
2+
author = makepath
3+
classifiers =
4+
Development Status :: 4 - Beta
5+
Intended Audience :: Developers
6+
Intended Audience :: Science/Research
7+
License :: OSI Approved :: MIT License
8+
Operating System :: OS Independent
9+
Programming Language :: Python :: 3
10+
description = xarray-based spatial analysis tools
11+
license = MIT
12+
license_file = LICENSE.txt
213
long_description = file: README.md
314
long_description_content_type = text/markdown
15+
name = xarray-spatial
16+
platforms = any
17+
url = https://github.com/makepath/xarray-spatial
18+
19+
[options]
20+
include_package_data = True
21+
install_requires =
22+
datashader
23+
numba
24+
xarray
25+
packages = find:
26+
python_requires = >=3.6
27+
zip_safe = False
28+
29+
[options.entry_points]
30+
console_scripts =
31+
xrspatial = xrspatial.__main__:main
32+
33+
[options.extras_require]
34+
doc =
35+
geopandas
36+
Jinja2 >=2.11
37+
ipykernel
38+
matplotlib
39+
nbsphinx
40+
numpydoc
41+
pandoc
42+
pydata_sphinx_theme
43+
sphinx
44+
sphinx-multiversion
45+
sphinx-panels
46+
sphinx_rtd_theme
47+
examples =
48+
optional =
49+
# Optional for polygonize return types.
50+
awkward>=1.4
51+
geopandas
52+
shapely
53+
spatialpandas
54+
# Optional for gpu_rtx functions. Also requires cupy.
55+
rtxpy
56+
tests =
57+
noise >= 1.2.2
58+
pytest
459

560
[flake8]
661
exclude =

setup.py

Lines changed: 9 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,17 @@
11
import os
2+
import param
3+
import pyct.build
24
import sys
35
import shutil
46
from setuptools import setup
57

68

7-
# build dependencies
8-
import pyct.build
9-
import param
10-
11-
# dependencies
12-
13-
# datashader first, then pyct unless pyct version compatible with ds
14-
# is specified
15-
# spatialpandas may not be required in final pharmacy_desert version
16-
# pyct may not be required after pyctdev is released
17-
install_requires = [
18-
'dask',
19-
'datashader',
20-
'numba',
21-
'pandas',
22-
'pillow',
23-
'requests',
24-
'xarray',
25-
'pyct <=0.4.6',
26-
'param >=1.6.1',
27-
'distributed >=2021.03.0',
28-
]
29-
30-
examples = [
31-
]
32-
33-
# Additional tests dependencies and examples_extra may be needed in the future
34-
extras_require = {
35-
'tests': [
36-
'pytest',
37-
'noise >=1.2.2',
38-
],
39-
'examples': examples,
40-
'optional': [
41-
# Optional for polygonize return types.
42-
'awkward>=1.4',
43-
'geopandas',
44-
'shapely',
45-
'spatialpandas',
46-
# Optional for gpu_rtx functions. Also requires cupy.
47-
"rtxpy",
48-
],
49-
'docs': [
50-
'geopandas',
51-
'Jinja2 >=2.11',
52-
'ipykernel',
53-
'matplotlib',
54-
'nbsphinx',
55-
'numpydoc',
56-
'pandoc',
57-
'pydata_sphinx_theme',
58-
'sphinx',
59-
'sphinx-multiversion',
60-
'sphinx-panels',
61-
'sphinx_rtd_theme',
62-
],
63-
}
64-
65-
extras_require['all'] = sorted(set(sum(extras_require.values(), [])))
66-
67-
version = param.version.get_setup_version(__file__, 'xarray-spatial',
68-
pkgname='xrspatial',
69-
archive_commit="$Format:%h$")
9+
version = param.version.get_setup_version(
10+
__file__,
11+
'xarray-spatial',
12+
pkgname='xrspatial',
13+
archive_commit="$Format:%h$",
14+
)
7015

7116
if 'sdist' in sys.argv and 'bdist_wheel' in sys.argv:
7217
try:
@@ -78,37 +23,12 @@
7823
sys.exit('invalid version')
7924

8025

81-
# metadata for setuptools
82-
83-
setup_args = dict(
84-
name='xarray-spatial',
85-
version=version,
86-
description='xarray-based spatial analysis tools',
87-
install_requires=install_requires,
88-
extras_require=extras_require,
89-
tests_require=extras_require['tests'],
90-
zip_safe=False,
91-
classifiers=['Programming Language :: Python :: 3',
92-
'License :: OSI Approved :: MIT License',
93-
'Operating System :: OS Independent'],
94-
packages=['xrspatial',
95-
'xrspatial.tests'
96-
],
97-
include_package_data=True,
98-
entry_points={
99-
'console_scripts': [
100-
'xrspatial = xrspatial.__main__:main'
101-
]
102-
},
103-
)
104-
105-
10626
if __name__ == '__main__':
10727
example_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
10828
'xrspatial', 'examples')
10929
if 'develop' not in sys.argv:
11030
pyct.build.examples(example_path, __file__, force=True)
111-
setup(**setup_args)
31+
setup(version=version)
11232

11333
if os.path.isdir(example_path):
11434
shutil.rmtree(example_path)

0 commit comments

Comments
 (0)