Skip to content

Commit

Permalink
Fix seas val (#307)
Browse files Browse the repository at this point in the history
* Fix error in seasonal metrics calculator adapter when an empty time series is used

* Update changes

* Update CI

* update env

* Update setup.cfg

* Update meta packag

* Fix docs

* Update meta packag

* Fix C ext

* Update CI

* Update CI

* Update CI

* Rebuild .c ext

* Update changelog
  • Loading branch information
wpreimes committed Jun 15, 2024
1 parent 0e3cbb0 commit 97d7a46
Show file tree
Hide file tree
Showing 23 changed files with 91,037 additions and 66,661 deletions.
45 changes: 24 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,28 @@ jobs:
build:
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10' ]
# as we build C extension for users to download, we want to include as many python versions
# and OS versions as possible (especially windows to create .whl packages,
# see step "Create wheel and dist package")
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: ["ubuntu-latest", "windows-latest"]
ymlfile: ["environment.yml"]
name: Py${{ matrix.python-version }}@${{ matrix.os }}🐍
name: py${{ matrix.python-version }} @ ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true # does not work with self-hosted testdata
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: "latest"
channel-priority: flexible
python-version: ${{ matrix.python-version }}
environment-file: ${{ matrix.ymlfile }}
activate-environment: pytesmo # todo: must match with name in environment.yml
auto-activate-base: false
miniconda-version: "latest"
auto-update-conda: true
python-version: ${{ matrix.python-version }}
environment-file: environment.yml
activate-environment: pytesmo # todo: must match with name in environment.yml
mamba-version: "*"
auto-activate-base: false
- name: Print Infos
shell: bash -l {0}
run: |
Expand All @@ -45,16 +47,13 @@ jobs:
pip list
which pip
which python
gcc -v
- name: Export Environment
shell: bash -l {0}
run: |
mkdir -p .artifacts
# Here we could exclude pinned environments (not used):
if [ ${{ matrix.ymlfile }} == "environment.yml" ]
then
filename=env_py${{ matrix.python-version }}_${{ matrix.os }}.yml
conda env export --no-builds | grep -v "prefix" > .artifacts/$filename
fi
filename=env_py${{ matrix.python-version }}_${{ matrix.os }}.yml
conda env export --no-builds | grep -v "prefix" > .artifacts/$filename
- name: Install package and test
shell: bash -l {0}
run: |
Expand Down Expand Up @@ -84,9 +83,9 @@ jobs:
fi
ls .artifacts/dist
- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Artifacts
name: Artifacts-${{ matrix.python-version }}-${{ matrix.os }}
path: .artifacts/*
coveralls:
name: Submit Coveralls 👚
Expand All @@ -112,7 +111,11 @@ jobs:
echo "GITHUB_REF = $GITHUB_REF"
echo "GITHUB_REPOSITORY = $GITHUB_REPOSITORY"
- name: Download Artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
path: Artifacts
pattern: Artifacts-*
merge-multiple: true
- name: Display downloaded files
run: ls -aR
- name: Upload to PyPI
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://gitlab.com/pycqa/flake8
- repo: https://github.com/PyCQA/flake8
rev: 3.7.9
hooks:
- id: flake8
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog

Unreleased changes in master
============================
- Fixed an issue with the intra-annual metrics adapter when an empty time series is passed (PR `#307 <https://github.com/TUW-GEO/pytesmo/pull/307>`_)
- Metapackage updated (pyscaffold 4.5) (PR `#307 <https://github.com/TUW-GEO/pytesmo/pull/307>`_)
- C modules were outdated and could not be compiled, therefore rebuilt (PR `#307 <https://github.com/TUW-GEO/pytesmo/pull/307>`_)

Version 0.16.0, 2023-09-12
==========================
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AUTODOCDIR = api

# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $?), 1)
$(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http:https://sphinx-doc.org/")
$(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from https:https://sphinx-doc.org/")
endif

.PHONY: help clean Makefile
Expand Down
57 changes: 28 additions & 29 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

import os
import sys
import inspect
import shutil
import subprocess


# Create kernel for notebooks
on_rtd = "READTHEDOCS" in os.environ and os.environ["READTHEDOCS"]
if on_rtd:
Expand Down Expand Up @@ -46,19 +44,17 @@

# -- Path setup --------------------------------------------------------------

__location__ = os.path.join(
os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe()))
)
__location__ = os.path.dirname(__file__)

# 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.join(__location__, "../src"))
sys.path.insert(0, os.path.join(__location__, "../src"))

# -- Run sphinx-apidoc -------------------------------------------------------
# This hack is necessary since RTD does not issue `sphinx-apidoc` before running
# `sphinx-build -b html . _build/html`. See Issue:
# https://github.com/rtfd/readthedocs.org/issues/1139
# https://github.com/readthedocs/readthedocs.org/issues/1139
# DON'T FORGET: Check the box "Install your project inside a virtualenv using
# setup.py install" in the RTD Advanced Settings.
# Additionally it helps us to avoid running apidoc manually
Expand All @@ -78,13 +74,7 @@
try:
import sphinx

cmd_line_template = (
"sphinx-apidoc --implicit-namespaces"
" -Me -d 3 -f -o {outputdir} {moduledir}"
)
cmd_line = cmd_line_template.format(
outputdir=output_dir, moduledir=module_dir
)
cmd_line = f"sphinx-apidoc --implicit-namespaces -f -o {output_dir} {module_dir}"

args = cmd_line.split(" ")
if tuple(sphinx.__version__.split(".")) >= ("1", "7"):
Expand Down Expand Up @@ -113,7 +103,7 @@
"sphinx.ext.ifconfig",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"nbsphinx",
"nbsphinx"
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -130,16 +120,25 @@

# General information about the project.
project = "pytesmo"
copyright = "2021, TU Wien"
copyright = "2024, TU Wien"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "" # Is set by calling `setup.py docs`
# The full version, including alpha/beta/rc tags.
release = "" # Is set by calling `setup.py docs`
# version: The short X.Y version.
# release: The full version, including alpha/beta/rc tags.
# If you don’t need the separation provided between version and release,
# just set them both to the same value.
try:
from pytesmo import __version__ as version
except ImportError:
version = ""

if not version or version.lower() == "unknown":
version = os.getenv("READTHEDOCS_VERSION", "unknown") # automatically set by RTD

release = version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -178,14 +177,16 @@
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False

# If this is True, todo emits a warning for each TODO entries. The default is False.
todo_emit_warnings = True


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "sphinx_rtd_theme"


# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
Expand All @@ -198,12 +199,7 @@

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
try:
from pytesmo import __version__ as version
except ImportError:
pass
else:
release = version
# html_title = None

# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
Expand Down Expand Up @@ -307,12 +303,15 @@
# -- External mapping --------------------------------------------------------
python_version = ".".join(map(str, sys.version_info[0:2]))
intersphinx_mapping = {
"sphinx": ("http:https://www.sphinx-doc.org/en/stable", None),
"sphinx": ("https:https://www.sphinx-doc.org/en/master", None),
"python": ("https://docs.python.org/" + python_version, None),
"matplotlib": ("https://matplotlib.org", None),
"numpy": ("https://docs.scipy.org/doc/numpy", None),
"numpy": ("https://numpy.org/doc/stable", None),
"sklearn": ("https://scikit-learn.org/stable", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
"setuptools": ("https://setuptools.pypa.io/en/stable/", None),
"pyscaffold": ("https://pyscaffold.org/en/stable", None),
}

print(f"loading configurations for {project} {version} ...", file=sys.stderr)
1 change: 1 addition & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. include:: ../DEVELOPERS_GUIDE.md
Loading

0 comments on commit 97d7a46

Please sign in to comment.