Skip to content
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

Build: update setuptools config, package structure and CI #242

Merged
merged 12 commits into from
Aug 10, 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
71 changes: 40 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,53 @@ jobs:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions\setup-python@v2
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black
pip install black 'isort[colors]<6'

- name: black check
run: |
python -m black --check --diff --color pykrige/ examples/ tests/
python -m black --check --diff --color .

- name: isort check
run: |
python -m isort --check --diff --color .

build_wheels:
name: wheels for ${{ matrix.cfg.os }} / ${{ matrix.cfg.arch }}
runs-on: ${{ matrix.cfg.os }}
strategy:
fail-fast: false
matrix:
cfg:
- { os: ubuntu-latest, arch: x86_64 }
- { os: ubuntu-latest, arch: i686 }
- { os: windows-latest, arch: AMD64 }
- { os: windows-latest, arch: x86 }
- { os: macos-latest, arch: x86_64 }
- { os: macos-latest, arch: arm64 }
- { os: macos-latest, arch: universal2 }

steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Build wheels
uses: pypa/cibuildwheel@v2.8.1
env:
CIBW_ARCHS: ${{ matrix.cfg.arch }}
with:
output-dir: dist

- uses: actions/upload-artifact@v2
with:
path: ./dist/*.whl

build_sdist:
name: sdist and coveralls
Expand All @@ -48,15 +83,15 @@ jobs:
fetch-depth: '0'

- name: Set up Python 3.8
uses: actions\setup-python@v2
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build coveralls>=3.0.0
pip install --editable .[test]
pip install -v --editable .[test]

- name: Run tests
env:
Expand All @@ -74,32 +109,6 @@ jobs:
with:
path: dist/*.tar.gz

build_wheels:
name: wheels on ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Build wheels
uses: pypa/cibuildwheel@v2.1.1
env:
CIBW_BUILD: cp36-* cp37-* cp38-* cp39-*
CIBW_TEST_EXTRAS: test
CIBW_TEST_COMMAND: pytest -v {project}/tests
with:
output-dir: dist

- uses: actions/upload-artifact@v2
with:
path: ./dist/*.whl

upload_to_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ downloads/
eggs/
.eggs/
lib/
!src/pykrige/lib/
lib64/
parts/
sdist/
Expand Down Expand Up @@ -108,7 +109,8 @@ tags

# own stuff
info/
pykrige/_version.py
src/pykrige/_version.py
.vscode/

# Cython generated C code
*.c
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015-2021, PyKrige Developers
Copyright (c) 2015-2022, PyKrige Developers
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
11 changes: 4 additions & 7 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
prune *
graft tests
recursive-include pykrige *.py *.pyx *.pxd
recursive-exclude pykrige *.c *.cpp
include LICENSE README.md pyproject.toml setup.py setup.cfg
exclude CHANGELOG.md
global-exclude __pycache__ *.py[cod] .*
prune **
recursive-include tests *.py *.txt *.asc
recursive-include src/pykrige *.py *.pyx *.pxd
include LICENSE README.md pyproject.toml setup.py
2 changes: 2 additions & 0 deletions benchmarks/kriging_benchmarks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
"""Benchmarks."""
from time import time

import numpy as np

from pykrige.ok import OrdinaryKriging

np.random.seed(19999)
Expand Down
26 changes: 16 additions & 10 deletions docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@
{{ super() }}
<br />
<p class="link caption"><span class="link caption-text">PyKrige Links</span></p>
<a href="https://github.com/GeoStat-Framework/PyKrige">PyKrige GitHub</a>
<a href="https://doi.org/10.5281/zenodo.3738604">PyKrige Zenodo DOI</a>
<a href="https://pypi.org/project/PyKrige/">PyKrige PyPI</a>
<ul>
<Li><a href="https://github.com/GeoStat-Framework/PyKrige">PyKrige GitHub</a></Li>
<Li><a href="https://doi.org/10.5281/zenodo.3738604">PyKrige Zenodo DOI</a></Li>
<Li><a href="https://pypi.org/project/PyKrige/">PyKrige PyPI</a></Li>
</ul>
<br />
<p class="link caption"><span class="link caption-text">GeoStat Framework</span></p>
<a href="https://geostat-framework.org">GeoStat Website</a>
<a href="https://github.com/GeoStat-Framework">GeoStat Github</a>
<a href="https://geostat-framework.readthedocs.io">GeoStat ReadTheDocs</a>
<a href="https://pypi.org/user/geostatframework/">GeoStat PyPI</a>
<ul>
<Li><a href="https://geostat-framework.org">GeoStat Website</a></Li>
<Li><a href="https://github.com/GeoStat-Framework">GeoStat Github</a></Li>
<Li><a href="https://geostat-framework.readthedocs.io">GeoStat ReadTheDocs</a></Li>
<Li><a href="https://pypi.org/user/geostatframework/">GeoStat PyPI</a></Li>
</ul>
<br />
<br />
<a href="genindex.html">Index</a>
<a href="contents.html">Sitemap</a>
{% endblock %}
<ul>
<Li><a href="genindex.html">Index</a></Li>
<Li><a href="contents.html">Sitemap</a></Li>
</ul>
{% endblock %}
35 changes: 27 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import datetime
import sys
import os
import shlex
import sphinx_rtd_theme
import sys

import matplotlib
import sphinx_rtd_theme

matplotlib.use("Agg")

Expand All @@ -28,9 +29,10 @@
# sys.path.insert(0, os.path.abspath("../../"))
sys.path.insert(0, os.path.abspath("sphinxext"))

import pykrige
from github_link import make_linkcode_resolve

import pykrige

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

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -45,17 +47,34 @@
"sphinx.ext.mathjax",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinxcontrib.napoleon",
"sphinx.ext.napoleon", # parameters look better than with numpydoc only
"numpydoc",
"sphinx_gallery.gen_gallery",
"sphinx.ext.linkcode",
"m2r2",
]


autosummary_generate = True

autodoc_default_flags = ["members", "inherited-members"]

# autosummaries from source-files
autosummary_generate = True
# dont show __init__ docstring
autoclass_content = "class"
# sort class members
autodoc_member_order = "groupwise"
# autodoc_member_order = 'bysource'

# Notes in boxes
napoleon_use_admonition_for_notes = True
# Attributes like parameters
# napoleon_use_ivar = True
# this is a nice class-doc layout
numpydoc_show_class_members = True
# class members have no separate file, so they are not in a toctree
numpydoc_class_members_toctree = False
# for the covmodels alot of classmembers show up...
# maybe switch off with: :no-inherited-members:
numpydoc_show_inherited_class_members = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down Expand Up @@ -326,7 +345,7 @@
# The following is used by sphinx.ext.linkcode to provide links to github
linkcode_resolve = make_linkcode_resolve(
"pykrige",
u"https://github.com/GeoStat-Framework/"
"https://github.com/GeoStat-Framework/"
"PyKrige/blob/{revision}/"
"{package}/{path}#L{lineno}",
)
4 changes: 2 additions & 2 deletions docs/source/sphinxext/github_link.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Adapted from scikit learn

from operator import attrgetter
import inspect
import subprocess
import os
import subprocess
import sys
from functools import partial
from operator import attrgetter

REVISION_CMD = "git rev-parse --short HEAD"

Expand Down
4 changes: 2 additions & 2 deletions examples/00_ordinary.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

"""

import matplotlib.pyplot as plt
import numpy as np

import pykrige.kriging_tools as kt
from pykrige.ok import OrdinaryKriging
import matplotlib.pyplot as plt


data = np.array(
[
Expand Down
4 changes: 2 additions & 2 deletions examples/01_universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

"""

from pykrige.uk import UniversalKriging
import numpy as np
import matplotlib.pyplot as plt
import numpy as np

from pykrige.uk import UniversalKriging

data = np.array(
[
Expand Down
4 changes: 2 additions & 2 deletions examples/02_kriging3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

"""

from pykrige.ok3d import OrdinaryKriging3D
from pykrige.uk3d import UniversalKriging3D
import numpy as np
from matplotlib import pyplot as plt

from pykrige.ok3d import OrdinaryKriging3D
from pykrige.uk3d import UniversalKriging3D

data = np.array(
[
Expand Down
5 changes: 3 additions & 2 deletions examples/03_gstools_covmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

Example how to use the PyKrige routines with a GSTools CovModel.
"""
import gstools as gs
import numpy as np
from pykrige.ok import OrdinaryKriging
from matplotlib import pyplot as plt
import gstools as gs

from pykrige.ok import OrdinaryKriging

# conditioning data
data = np.array(
Expand Down
2 changes: 1 addition & 1 deletion examples/04_krige_geometric.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
for ordinary kriging on a sphere.
"""

from pykrige.ok import OrdinaryKriging
import numpy as np
from matplotlib import pyplot as plt

from pykrige.ok import OrdinaryKriging

# Make this example reproducible:
np.random.seed(89239413)
Expand Down
3 changes: 2 additions & 1 deletion examples/05_kriging_1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

An example of 1D kriging with PyKrige
"""
import numpy as np
import matplotlib.pyplot as plt
import numpy as np

from pykrige import OrdinaryKriging

plt.style.use("ggplot")
Expand Down
3 changes: 2 additions & 1 deletion examples/06_exact_values_example_1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
as a non-exact interpolator in 1D.
"""

from pykrige.ok import OrdinaryKriging
import matplotlib.pyplot as plt
import numpy as np

from pykrige.ok import OrdinaryKriging

plt.style.use("ggplot")

np.random.seed(42)
Expand Down
4 changes: 2 additions & 2 deletions examples/07_regression_kriging2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import sys

from sklearn.svm import SVR
from sklearn.datasets import fetch_california_housing
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LinearRegression
from sklearn.datasets import fetch_california_housing
from sklearn.model_selection import train_test_split
from sklearn.svm import SVR

from pykrige.rk import RegressionKriging

Expand Down
2 changes: 1 addition & 1 deletion examples/08_krige_cv.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"""

import numpy as np
from pykrige.rk import Krige
from sklearn.model_selection import GridSearchCV

from pykrige.rk import Krige

# 2D Kring param opt

Expand Down
Loading