From f6193d56794498834ceefc14547562acf307c75f Mon Sep 17 00:00:00 2001 From: Pascal Bourgault Date: Fri, 26 May 2023 17:12:06 -0400 Subject: [PATCH 1/8] Remove clisops from env --- environment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/environment.yml b/environment.yml index 6273399af..d5695fa30 100644 --- a/environment.yml +++ b/environment.yml @@ -23,7 +23,6 @@ dependencies: - scipy>=1.2 - xarray>=2022.06.0 # Extras - - clisops - eofs - flox - pytest-json-report # Added due to a packaging bug with ESMPy. See: https://github.com/esmf-org/esmf/issues/115 From b3b73e360395ad7b78a4480f3f4f5b37f3163ae8 Mon Sep 17 00:00:00 2001 From: Pascal Bourgault Date: Fri, 26 May 2023 17:39:10 -0400 Subject: [PATCH 2/8] Clean up dependencies to rm xesmf and allow py3.11 --- environment.yml | 6 +++--- pylintrc | 4 ++-- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/environment.yml b/environment.yml index d5695fa30..a78d9bc44 100644 --- a/environment.yml +++ b/environment.yml @@ -21,11 +21,11 @@ dependencies: - pyyaml - scikit-learn>=0.21.3 - scipy>=1.2 + - statsmodels - xarray>=2022.06.0 # Extras - eofs - flox - - pytest-json-report # Added due to a packaging bug with ESMPy. See: https://github.com/esmf-org/esmf/issues/115 # Testing and development dependencies - black>=22.12 - blackdoc @@ -33,6 +33,7 @@ dependencies: - cairosvg - coverage - distributed>=2.0 + - filelock - flake8 - flake8-rst-docstrings - flit @@ -49,7 +50,7 @@ dependencies: - pre-commit - pybtex - pydocstyle - - pylint<2.15 + - pylint - pytest - pytest-cov - pytest-xdist>=3.2 @@ -59,7 +60,6 @@ dependencies: - sphinx-copybutton - sphinx-rtd-theme>=1.0 - sphinxcontrib-bibtex - - statsmodels - tokenize-rt - tox # - tox-conda # Will be added when a tox@v4.0+ compatible plugin is released. diff --git a/pylintrc b/pylintrc index f8faf05a3..cdac8c797 100644 --- a/pylintrc +++ b/pylintrc @@ -195,8 +195,8 @@ timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests. [EXCEPTIONS] # Exceptions that will emit a warning when caught. -overgeneral-exceptions=BaseException, - Exception +overgeneral-exceptions=builtins.BaseException, + builtins.Exception [REFACTORING] diff --git a/pyproject.toml b/pyproject.toml index 24a526087..a41b2818d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ dev = [ "pre-commit >=2.9", "pydocstyle >=5.1.1", "pybtex", - "pylint <2.15", + "pylint", "pytest", "pytest-cov", "pytest-xdist[psutil] >=3.2", From e31ae6bbb6b698792380ed0831ec1b6013588305 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 31 May 2023 14:11:47 -0400 Subject: [PATCH 3/8] specify sphinx_rtd_theme --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index a78d9bc44..4c62a7de6 100644 --- a/environment.yml +++ b/environment.yml @@ -58,7 +58,7 @@ dependencies: - sphinx-autodoc-typehints - sphinx-codeautolink - sphinx-copybutton - - sphinx-rtd-theme>=1.0 + - sphinx_rtd_theme>=1.0 - sphinxcontrib-bibtex - tokenize-rt - tox From f3e9447e78c97fb27302afd38d6ed9bb7933168f Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 31 May 2023 15:03:24 -0400 Subject: [PATCH 4/8] Add docstring --- xclim/core/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xclim/core/utils.py b/xclim/core/utils.py index 069c52d09..9c286cc33 100644 --- a/xclim/core/utils.py +++ b/xclim/core/utils.py @@ -582,9 +582,16 @@ class InputKind(IntEnum): """ -def infer_kind_from_parameter(param: Parameter, has_units: bool = False) -> InputKind: +def infer_kind_from_parameter(param, has_units: bool = False) -> InputKind: """Return the appropriate InputKind constant from an ``inspect.Parameter`` object. + Parameters + ---------- + param : Parameter + has_units : bool + + Notes + ----- The correspondence between parameters and kinds is documented in :py:class:`xclim.core.utils.InputKind`. The only information not inferable through the `inspect` object is whether the parameter has been assigned units through the :py:func:`xclim.core.units.declare_units` decorator. From 55243ece99f8fcc67533a7d0c9b1b8dafcb34d1f Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 31 May 2023 15:26:07 -0400 Subject: [PATCH 5/8] pin below Python3.11 --- environment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index 4c62a7de6..25dd43197 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python>=3.8 + - python>=3.8,<3.11 # pin due to sphinx-autodoc-typehints errors in Python3.11 - astroid - boltons>=20.1 - bottleneck>=1.3.1 @@ -15,7 +15,7 @@ dependencies: - lmoments3 - numba - numpy>=1.16 - - pandas>=0.23,<2.0 # Pinned due to incompatibility with xarray <=2023.03 + - pandas>=0.23 - pint>=0.9 - poppler>=0.67 - pyyaml From 057d56ead2d980fb47825ac1f72ad06a8f1b99f0 Mon Sep 17 00:00:00 2001 From: Zeitsperre <10819524+Zeitsperre@users.noreply.github.com> Date: Wed, 31 May 2023 15:26:18 -0400 Subject: [PATCH 6/8] docstring adjustments --- xclim/core/indicator.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/xclim/core/indicator.py b/xclim/core/indicator.py index 56d57adc4..48f6e9a2b 100644 --- a/xclim/core/indicator.py +++ b/xclim/core/indicator.py @@ -302,30 +302,30 @@ class Indicator(IndicatorRegistrar): Parameters ---------- identifier : str - Unique ID for class registry, should be a valid slug. + Unique ID for class registry, should be a valid slug. realm : {'atmos', 'seaIce', 'land', 'ocean'} - General domain of validity of the indicator. Indicators created outside xclim.indicators must set this attribute. + General domain of validity of the indicator. Indicators created outside xclim.indicators must set this attribute. compute : func - The function computing the indicators. It should return one or more DataArray. + The function computing the indicators. It should return one or more DataArray. cf_attrs : list of dicts - Attributes to be formatted and added to the computation's output. - See :py:attr:`xclim.core.indicator.Indicator.cf_attrs`. + Attributes to be formatted and added to the computation's output. + See :py:attr:`xclim.core.indicator.Indicator.cf_attrs`. title : str - A succinct description of what is in the computed outputs. Parsed from `compute` docstring if None (first paragraph). + A succinct description of what is in the computed outputs. Parsed from `compute` docstring if None (first paragraph). abstract : str - A long description of what is in the computed outputs. Parsed from `compute` docstring if None (second paragraph). + A long description of what is in the computed outputs. Parsed from `compute` docstring if None (second paragraph). keywords : str - Comma separated list of keywords. Parsed from `compute` docstring if None (from a "Keywords" section). + Comma separated list of keywords. Parsed from `compute` docstring if None (from a "Keywords" section). references : str - Published or web-based references that describe the data or methods used to produce it. Parsed from - `compute` docstring if None (from the "References" section). + Published or web-based references that describe the data or methods used to produce it. Parsed from + `compute` docstring if None (from the "References" section). notes : str - Notes regarding computing function, for example the mathematical formulation. Parsed from `compute` - docstring if None (form the "Notes" section). + Notes regarding computing function, for example the mathematical formulation. Parsed from `compute` + docstring if None (form the "Notes" section). src_freq : str, sequence of strings, optional - The expected frequency of the input data. Can be a list for multiple frequencies, or None if irrelevant. + The expected frequency of the input data. Can be a list for multiple frequencies, or None if irrelevant. context : str - The `pint` unit context, for example use 'hydro' to allow conversion from kg m-2 s-1 to mm/day. + The `pint` unit context, for example use 'hydro' to allow conversion from kg m-2 s-1 to mm/day. Notes ----- From 9bd8180912ca4a5cc7708f4e9636c0d44967c65b Mon Sep 17 00:00:00 2001 From: Pascal Bourgault Date: Wed, 7 Jun 2023 16:11:27 -0400 Subject: [PATCH 7/8] Simplify annotations to solve py311-autodoc-bug --- environment.yml | 2 +- xclim/core/indicator.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/environment.yml b/environment.yml index 25dd43197..53ff4139b 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python>=3.8,<3.11 # pin due to sphinx-autodoc-typehints errors in Python3.11 + - python>=3.8 - astroid - boltons>=20.1 - bottleneck>=1.3.1 diff --git a/xclim/core/indicator.py b/xclim/core/indicator.py index 48f6e9a2b..5234bae67 100644 --- a/xclim/core/indicator.py +++ b/xclim/core/indicator.py @@ -190,11 +190,11 @@ class Parameter: _empty = _empty kind: InputKind - default: "Any" = _empty_default + default: Any = _empty_default description: str = "" units: str = _empty choices: set = _empty - value: "Any" = _empty + value: Any = _empty def update(self, other: dict) -> None: """Update a parameter's values from a dict.""" @@ -368,7 +368,7 @@ class Indicator(IndicatorRegistrar): # Note: typing and class types in this call signature will cause errors with sphinx-autodoc-typehints # See: https://github.com/tox-dev/sphinx-autodoc-typehints/issues/186#issuecomment-1450739378 - _all_parameters: dict[str, "Parameter"] = {} + _all_parameters: dict = {} """A dictionary mapping metadata about the input parameters to the indicator. Keys are the arguments of the "compute" function. All parameters are listed, even @@ -378,7 +378,7 @@ class Indicator(IndicatorRegistrar): # Note: typing and class types in this call signature will cause errors with sphinx-autodoc-typehints # See: https://github.com/tox-dev/sphinx-autodoc-typehints/issues/186#issuecomment-1450739378 - cf_attrs: list[dict[str, "Any"]] = None + cf_attrs: list[dict[str, str]] = None """A list of metadata information for each output of the indicator. It minimally contains a "var_name" entry, and may contain : "standard_name", "long_name", From 84076615f3e0c421df663d2476945e1c50abdfed Mon Sep 17 00:00:00 2001 From: Pascal Bourgault Date: Thu, 8 Jun 2023 11:30:05 -0400 Subject: [PATCH 8/8] Update CHANGES.rst --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index bf38d5b65..e62b533e3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -25,6 +25,7 @@ Internal changes * In order to ensure documentation can be rebuilt at a later time, errors raised by `sphinx` linkcheck are now set to be ignored when building the documentation. (:pull:`1375`). * With the publication of `xclim`, the code repository now offers a `CITATION.cff` configuration for users to properly cite the software (APA formatted and raw BibTeX) for academic purposes. (:issue:`95`, :pull:`250`). * Logging messages emitted when redefining units via `pint` (caused by `logging` interactions with dependencies) have been silenced. (:issue:`1373`, :pull:`1384`). +* Fixed some annotations and dev dependencies issues to allow the development of xclim inside a python 3.11 environment. (:issue:`1376`, :pull:`1381`). v0.43.0 (2023-05-09) --------------------