Skip to content

Commit

Permalink
Merge 9315920 into 0041bf5
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Aug 23, 2023
2 parents 0041bf5 + 9315920 commit d86147b
Show file tree
Hide file tree
Showing 25 changed files with 942 additions and 384 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ jobs:
shell: bash -l {0}
run: |
python -m pip install \
-f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com \
-f https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/ \
--trusted-host pypi.anaconda.org \
--no-deps --pre --upgrade \
numpy \
pandas; \
Expand All @@ -61,6 +62,9 @@ jobs:
shell: bash -l {0}
run: |
pip install --no-deps -e .
# pip forces non-wheel builds if we provide --cython-coverage as a --build-option
# and that's way too slow
python setup.py build_ext --inplace --cython-coverage --force
- name: Run unit tests
shell: bash -l {0}
Expand All @@ -73,3 +77,19 @@ jobs:
flags: unittests
file: ./coverage.xml
env_vars: OS,PYTHON_VERSION,UNSTABLE

- name: Coveralls Parallel
uses: AndreMiras/coveralls-python-action@develop
with:
flag-name: run-${{ matrix.test_number }}
parallel: true
if: runner.os == 'Linux'

coveralls:
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
25 changes: 0 additions & 25 deletions .github/workflows/deploy-sdist.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +0,0 @@
name: Deploy sdist

on:
release:
types:
- published

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v3

- name: Create sdist
shell: bash -l {0}
run: python setup.py sdist

- name: Publish package to PyPI
if: github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@v1.8.10
with:
user: __token__
password: ${{ secrets.pypi_password }}
76 changes: 76 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build Package


on:
push:
pull_request:
release:
types:
- published

jobs:
build_sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3

- name: Create sdist
shell: bash -l {0}
run: |
python -m pip install -q build
python -m build -s
- name: Upload sdist to build artifacts
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/*.tar.gz

build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macOS-11]

steps:
- uses: actions/checkout@v3

- name: Build wheels
uses: pypa/cibuildwheel@v2.12.0
env:
CIBW_SKIP: "cp36-* cp37-* cp38-* pp* *-i686"

- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./wheelhouse/*.whl

upload_to_pypi:
needs: [build_sdist, build_wheels]
runs-on: ubuntu-latest
steps:
- name: Download sdist artifact
uses: actions/download-artifact@v2
with:
name: sdist
path: dist
- name: Download wheels artifact
uses: actions/download-artifact@v2
with:
name: wheels
path: dist
- name: Publish package to Test PyPI
if: github.event.action != 'published' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish package to PyPI
if: github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.pypi_password }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ nosetests.xml
.ropeproject

# sphinx
doc/_build
doc/_build
doc/api/*.rst
8 changes: 8 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ build:
os: "ubuntu-20.04"
tools:
python: "3.10"
jobs:
post_install:
- python -c "import os; print(os.getcwd()); import sys; print(sys.path)"
- python setup.py build_ext --inplace
- cd doc
- python -c "import sys; print(sys.path); import trollimage.tests; print(trollimage.tests.__file__)"
- python -c "import trollimage.tests.test_colormap"
sphinx:
configuration: doc/conf.py
fail_on_warning: true
python:
install:
- requirements: rtd_requirements.txt
Expand Down
21 changes: 21 additions & 0 deletions LICENSE_RIO_COLOR.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Mapbox

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include LICENSE.txt
include LICENSE_RIO_COLOR.txt
include README.rst
include versioneer.py
include trollimage/version.py
1 change: 1 addition & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ help:

clean:
-rm -rf $(BUILDDIR)/*
-rm -rf api/*.rst

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
Expand Down
Empty file added doc/api/.gitkeep
Empty file.
4 changes: 1 addition & 3 deletions doc/colormap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ Now applying a palette to the data, with sharp edges::
API
===

.. automodule:: trollimage.colormap
:members:
:undoc-members:
See the :class:`~trollimage.Colormap` API documentation.

Default Colormaps
=================
Expand Down
7 changes: 0 additions & 7 deletions doc/colorspaces.rst

This file was deleted.

40 changes: 8 additions & 32 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,13 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
from trollimage import __version__

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))


class Mock(object):
def __init__(self, *args, **kwargs):
pass

def __call__(self, *args, **kwargs):
return Mock()

@classmethod
def __getattr__(cls, name):
if name in ('__file__', '__path__'):
return '/dev/null'
elif name[0] == name[0].upper():
mockType = type(name, (), {})
mockType.__module__ = __name__
return mockType
elif name == "inf":
return 0
else:
return Mock()


MOCK_MODULES = ['Image']
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = Mock()


# -- General configuration -----------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -54,7 +26,11 @@ def __getattr__(cls, name):
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
'sphinx.ext.napoleon']
'sphinx.ext.napoleon', 'sphinxcontrib.apidoc']
# API docs
apidoc_module_dir = "../trollimage"
apidoc_output_dir = "api"
apidoc_excluded_paths = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -247,9 +223,9 @@ def __getattr__(cls, name):

intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'numpy': ('https://docs.scipy.org/doc/numpy', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
'xarray': ('https://xarray.pydata.org/en/stable', None),
'numpy': ('https://numpy.org/doc/stable', None),
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
'xarray': ('https://docs.xarray.dev/en/stable', None),
'dask': ('https://dask.pydata.org/en/latest', None),
'rasterio': ('https://rasterio.readthedocs.io/en/latest', None),
}
7 changes: 0 additions & 7 deletions doc/image.rst

This file was deleted.

4 changes: 1 addition & 3 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ Contents:
:maxdepth: 2

installation
image
xrimage
colorspaces
colormap
API <api/modules>


Indices and tables
Expand Down
8 changes: 0 additions & 8 deletions doc/xrimage.rst

This file was deleted.

8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build-system]
requires = ["setuptools", "wheel", "oldest-supported-numpy", "Cython", "versioneer"]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
relative_files = true
plugins = ["Cython.Coverage"]
omit = ["trollimage/version.py", "versioneer.py"]
8 changes: 5 additions & 3 deletions rtd_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ pillow
rasterio
xarray
dask[array]
docutils<0.18
sphinx>=5,<6
sphinx-rtd-theme>=1.1.0,<2.0
docutils
sphinx>=7,<8
sphinx-rtd-theme>=1.2.0,<2.0
sphinxcontrib-apidoc
pytest

setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
9 changes: 3 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ universal=1
max-line-length = 120
exclude =
doc/conf.py
trollimage/version.py
versioneer.py

[versioneer]
VCS = git
style = pep440
versionfile_source = trollimage/version.py
versionfile_build =
versionfile_build = trollimage/version.py
tag_prefix = v

[coverage:run]
omit =
trollimage/version.py
versioneer.py

0 comments on commit d86147b

Please sign in to comment.