Skip to content

Modernise build system #654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ environment:
build: off

install:
- "%PYTHON%\\python.exe -m pip install wheel"
- "%PYTHON%\\python.exe -m pip install -r requirements.txt"
- "%PYTHON%\\python.exe -m pip install -r requirements-dev.txt"
- "%PYTHON%\\python.exe -m pip install .[tests]"

test_script:
- "%PYTHON%\\python.exe -m pytest"
2 changes: 1 addition & 1 deletion .github/workflows/docs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
pip install .[docs,tests]
pip list
- name: Build
- name: Build docs
run: |
make -C docs html
- uses: lauchacarro/[email protected]
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
- '*'
jobs:
publish:
runs-on: ubuntu-18.04
runs-on: ubuntu-20-04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.9
- name: Get release version
run: |
echo "CHANGELOG_VERSION=$(cat CHANGELOG.md | grep -oP '(?<=###\s)(.*)(?=\s\-)' | head -n 1 | sed 's/Version\s/v/')" >> $GITHUB_ENV
Expand All @@ -24,14 +24,12 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyct \
wheel \
setuptools
pip install build
- name: Get all git tags
run: git fetch --tags -f
- name: Build package
run: |
python setup.py sdist bdist_wheel
python -m build --sdist --wheel
- name: Get package size
run: echo "PKG_SIZE=$(find dist -maxdepth 1 -regex '.*gz' | xargs stat --format='%s')" >> $GITHUB_ENV
- name: Check package size
Expand All @@ -44,4 +42,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
password: ${{ secrets.PYPI_API_TOKEN }}
password: ${{ secrets.PYPI_API_TOKEN }}
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[build-system]
requires = [
'param >=1.6.1',
'pyct >= 0.4.8',
'build',
'param',
'pyct',
'setuptools >= 54.1.2',
'wheel >= 0.36.2',
]

[tool.check-manifest]
ignore = [
'.appveyor.yml',
Expand Down
2 changes: 0 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ check-manifest
pytest
setuptools_scm
tox
twine
wheel
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bokeh>2
bokeh >2
datashader
noise >=1.2.2
numba
Expand Down
55 changes: 55 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,61 @@
[metadata]
author = makepath
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python :: 3
description = xarray-based spatial analysis tools
license = MIT
license_file = LICENSE.txt
long_description = file: README.md
long_description_content_type = text/markdown
name = xarray-spatial
platforms = any
url = https://github.com/makepath/xarray-spatial

[options]
include_package_data = True
install_requires =
datashader
numba
xarray
packages = find:
python_requires = >=3.6
zip_safe = False

[options.entry_points]
console_scripts =
xrspatial = xrspatial.__main__:main

[options.extras_require]
doc =
geopandas
Jinja2 >=2.11
ipykernel
matplotlib
nbsphinx
numpydoc
pandoc
pydata_sphinx_theme
sphinx
sphinx-multiversion
sphinx-panels
sphinx_rtd_theme
examples =
optional =
# Optional for polygonize return types.
awkward>=1.4
geopandas
shapely
spatialpandas
# Optional for gpu_rtx functions. Also requires cupy.
rtxpy
tests =
noise >= 1.2.2
pytest

[flake8]
exclude =
Expand Down
98 changes: 9 additions & 89 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,72 +1,17 @@
import os
import param
import pyct.build
import sys
import shutil
from setuptools import setup


# build dependencies
import pyct.build
import param

# dependencies

# datashader first, then pyct unless pyct version compatible with ds
# is specified
# spatialpandas may not be required in final pharmacy_desert version
# pyct may not be required after pyctdev is released
install_requires = [
'dask',
'datashader',
'numba',
'pandas',
'pillow',
'requests',
'xarray',
'pyct <=0.4.6',
'param >=1.6.1',
'distributed >=2021.03.0',
]

examples = [
]

# Additional tests dependencies and examples_extra may be needed in the future
extras_require = {
'tests': [
'pytest',
'noise >=1.2.2',
],
'examples': examples,
'optional': [
# Optional for polygonize return types.
'awkward>=1.4',
'geopandas',
'shapely',
'spatialpandas',
# Optional for gpu_rtx functions. Also requires cupy.
"rtxpy",
],
'docs': [
'geopandas',
'Jinja2 >=2.11',
'ipykernel',
'matplotlib',
'nbsphinx',
'numpydoc',
'pandoc',
'pydata_sphinx_theme',
'sphinx',
'sphinx-multiversion',
'sphinx-panels',
'sphinx_rtd_theme',
],
}

extras_require['all'] = sorted(set(sum(extras_require.values(), [])))

version = param.version.get_setup_version(__file__, 'xarray-spatial',
pkgname='xrspatial',
archive_commit="$Format:%h$")
version = param.version.get_setup_version(
__file__,
'xarray-spatial',
pkgname='xrspatial',
archive_commit="$Format:%h$",
)

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


# metadata for setuptools

setup_args = dict(
name='xarray-spatial',
version=version,
description='xarray-based spatial analysis tools',
install_requires=install_requires,
extras_require=extras_require,
tests_require=extras_require['tests'],
zip_safe=False,
classifiers=['Programming Language :: Python :: 3',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent'],
packages=['xrspatial',
'xrspatial.tests'
],
include_package_data=True,
entry_points={
'console_scripts': [
'xrspatial = xrspatial.__main__:main'
]
},
)


if __name__ == '__main__':
example_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'xrspatial', 'examples')
if 'develop' not in sys.argv:
pyct.build.examples(example_path, __file__, force=True)
setup(**setup_args)
setup(version=version)

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