anemoi-utils 0.4.18__tar.gz → 0.4.19__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of anemoi-utils might be problematic. Click here for more details.
- anemoi_utils-0.4.19/.readthedocs.yaml +19 -0
- anemoi_utils-0.4.19/.release-please-manifest.json +3 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/CHANGELOG.md +12 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/PKG-INFO +2 -1
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/Makefile +1 -0
- anemoi_utils-0.4.19/docs/_templates/apidoc/package.rst.jinja +55 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/index.rst +4 -4
- anemoi_utils-0.4.19/docs/scripts/api_build.sh +13 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/pyproject.toml +1 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/_version.py +2 -2
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/registry.py +7 -3
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/testing.py +81 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi_utils.egg-info/PKG-INFO +2 -1
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi_utils.egg-info/SOURCES.txt +2 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi_utils.egg-info/requires.txt +1 -0
- anemoi_utils-0.4.18/.readthedocs.yaml +0 -16
- anemoi_utils-0.4.18/.release-please-manifest.json +0 -3
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.gitattributes +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/CODEOWNERS +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/ci-hpc-config.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/dependabot.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/labeler.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/pull_request_template.md +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/release.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/downstream-ci-hpc.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/pr-conventional-commit.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/pr-label-conventional-commits.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/pr-label-file-based.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/pr-label-public.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/python-publish.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/python-pull-request.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/readthedocs-pr-update.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/release-please.yml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.gitignore +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.pre-commit-config.yaml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.release-please-config.json +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/CONTRIBUTORS.md +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/LICENSE +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/README.md +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/_static/logo.png +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/_static/style.css +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/_templates/.gitkeep +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/conf.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/installing.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/modules/checkpoints.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/modules/config.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/modules/dates.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/modules/grib.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/modules/humanize.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/modules/provenance.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/modules/s3.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/modules/testing.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/docs/modules/text.rst +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/setup.cfg +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/__init__.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/__main__.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/caching.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/checkpoints.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/cli.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/commands/__init__.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/commands/config.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/commands/requests.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/compatibility.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/config.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/dates.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/devtools.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/grib.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/grids.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/hindcasts.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/humanize.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/logs.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/mars/__init__.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/mars/mars.yaml +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/mars/requests.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/provenance.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/remote/__init__.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/remote/s3.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/remote/ssh.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/rules.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/s3.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/sanitise.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/sanitize.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/text.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi/utils/timer.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi_utils.egg-info/dependency_links.txt +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi_utils.egg-info/entry_points.txt +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/src/anemoi_utils.egg-info/top_level.txt +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test-transfer-data/directory/b/c/x +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test-transfer-data/directory/b/y +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test-transfer-data/directory/exotic filename ;^/"'[=.,#]()/303/252/303/274/303/247/303/262/342/234/205.txt" +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test-transfer-data/directory/z +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test-transfer-data/file +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test_caching.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test_compatibility.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test_dates.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test_frequency.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test_grids.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test_provenance.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test_remote.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test_sanetise.py +0 -0
- {anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/tests/test_utils.py +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
build:
|
|
4
|
+
os: ubuntu-22.04
|
|
5
|
+
tools:
|
|
6
|
+
python: "3.11"
|
|
7
|
+
jobs:
|
|
8
|
+
pre_build:
|
|
9
|
+
- bash docs/scripts/api_build.sh
|
|
10
|
+
|
|
11
|
+
sphinx:
|
|
12
|
+
configuration: docs/conf.py
|
|
13
|
+
|
|
14
|
+
python:
|
|
15
|
+
install:
|
|
16
|
+
- method: pip
|
|
17
|
+
path: .
|
|
18
|
+
extra_requirements:
|
|
19
|
+
- docs
|
|
@@ -8,6 +8,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
Please add your functional changes to the appropriate section in the PR.
|
|
9
9
|
Keep it human-readable, your future self will thank you!
|
|
10
10
|
|
|
11
|
+
## [0.4.19](https://github.com/ecmwf/anemoi-utils/compare/0.4.18...0.4.19) (2025-04-04)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* more testing support functions ([#136](https://github.com/ecmwf/anemoi-utils/issues/136)) ([5687b87](https://github.com/ecmwf/anemoi-utils/commit/5687b87ed17748412340d00f0724249f59b4e3f2))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Documentation
|
|
20
|
+
|
|
21
|
+
* add api ([#133](https://github.com/ecmwf/anemoi-utils/issues/133)) ([16af518](https://github.com/ecmwf/anemoi-utils/commit/16af5184eafbfc29cc3f0217a35675f2aa32847e))
|
|
22
|
+
|
|
11
23
|
## [0.4.18](https://github.com/ecmwf/anemoi-utils/compare/0.4.17...0.4.18) (2025-03-31)
|
|
12
24
|
|
|
13
25
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anemoi-utils
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.19
|
|
4
4
|
Summary: A package to hold various functions to support training of ML models on ECMWF data.
|
|
5
5
|
Author-email: "European Centre for Medium-Range Weather Forecasts (ECMWF)" <software.support@ecmwf.int>
|
|
6
6
|
License: Apache License
|
|
@@ -237,6 +237,7 @@ Requires-Dist: anemoi-utils[grib,provenance,s3,text]; extra == "all"
|
|
|
237
237
|
Provides-Extra: dev
|
|
238
238
|
Requires-Dist: anemoi-utils[all,docs,tests]; extra == "dev"
|
|
239
239
|
Provides-Extra: docs
|
|
240
|
+
Requires-Dist: anemoi-utils[all]; extra == "docs"
|
|
240
241
|
Requires-Dist: nbsphinx; extra == "docs"
|
|
241
242
|
Requires-Dist: pandoc; extra == "docs"
|
|
242
243
|
Requires-Dist: requests; extra == "docs"
|
|
@@ -19,4 +19,5 @@ help:
|
|
|
19
19
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
20
20
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
21
21
|
%: Makefile
|
|
22
|
+
bash $(SOURCEDIR)/scripts/api_build.sh
|
|
22
23
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{%- macro automodule(modname, options) -%}
|
|
2
|
+
.. automodule:: {{ modname }}
|
|
3
|
+
{%- for option in options %}
|
|
4
|
+
:{{ option }}:
|
|
5
|
+
{%- endfor %}
|
|
6
|
+
{%- endmacro %}
|
|
7
|
+
|
|
8
|
+
{%- macro toctree(docnames) -%}
|
|
9
|
+
.. toctree::
|
|
10
|
+
:maxdepth: {{ maxdepth }}
|
|
11
|
+
{% for docname in docnames %}
|
|
12
|
+
{{ docname }}
|
|
13
|
+
{%- endfor %}
|
|
14
|
+
{%- endmacro %}
|
|
15
|
+
|
|
16
|
+
{%- if is_namespace %}
|
|
17
|
+
{{- pkgname.split(".")[1:] | join(".") | e | heading }}
|
|
18
|
+
{% else %}
|
|
19
|
+
{{- pkgname.split(".")[1:] | join(" ") | e | heading }}
|
|
20
|
+
{% endif %}
|
|
21
|
+
|
|
22
|
+
{%- if is_namespace %}
|
|
23
|
+
.. py:module:: {{ pkgname }}
|
|
24
|
+
{% endif %}
|
|
25
|
+
|
|
26
|
+
{%- if modulefirst and not is_namespace %}
|
|
27
|
+
{{ automodule(["anemoi", pkgname] | join("."), [""]) }}
|
|
28
|
+
{% endif %}
|
|
29
|
+
|
|
30
|
+
{%- if subpackages %}
|
|
31
|
+
Subpackages
|
|
32
|
+
-----------
|
|
33
|
+
|
|
34
|
+
{{ toctree(subpackages) }}
|
|
35
|
+
{% endif %}
|
|
36
|
+
|
|
37
|
+
{%- if submodules %}
|
|
38
|
+
{% if separatemodules %}
|
|
39
|
+
{{ toctree(submodules) }}
|
|
40
|
+
{% else %}
|
|
41
|
+
{%- for submodule in submodules %}
|
|
42
|
+
{% if show_headings %}
|
|
43
|
+
{{- submodule.split(".")[2:] | join(".") | e | heading(2) }}
|
|
44
|
+
{% endif %}
|
|
45
|
+
{{ automodule(["anemoi", submodule] | join("."), automodule_options) }}
|
|
46
|
+
{% endfor %}
|
|
47
|
+
{%- endif %}
|
|
48
|
+
{%- endif %}
|
|
49
|
+
|
|
50
|
+
{%- if not modulefirst and not is_namespace %}
|
|
51
|
+
Module contents
|
|
52
|
+
---------------
|
|
53
|
+
|
|
54
|
+
{{ automodule(pkgname, automodule_options) }}
|
|
55
|
+
{% endif %}
|
|
@@ -30,15 +30,15 @@ of the *Anemoi* packages.
|
|
|
30
30
|
|
|
31
31
|
installing
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
*****
|
|
34
|
+
API
|
|
35
|
+
*****
|
|
36
36
|
|
|
37
37
|
.. toctree::
|
|
38
38
|
:maxdepth: 1
|
|
39
39
|
:glob:
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
_api/*
|
|
42
42
|
|
|
43
43
|
***********************
|
|
44
44
|
Other Anemoi packages
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
script_dir=$(dirname "${BASH_SOURCE[0]}")
|
|
6
|
+
docs_dir="$script_dir/.."
|
|
7
|
+
source_dir="$script_dir/../../src/"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
trap 'rm -f $source_dir/anemoi/__init__.py' EXIT
|
|
11
|
+
|
|
12
|
+
touch "$source_dir/anemoi/__init__.py"
|
|
13
|
+
sphinx-apidoc -M -f -o "$docs_dir/_api" "$source_dir/anemoi" #-t "$docs_dir/_templates/apidoc"
|
|
@@ -17,8 +17,10 @@ from functools import cached_property
|
|
|
17
17
|
from typing import Any
|
|
18
18
|
from typing import Callable
|
|
19
19
|
from typing import Dict
|
|
20
|
+
from typing import Generic
|
|
20
21
|
from typing import List
|
|
21
22
|
from typing import Optional
|
|
23
|
+
from typing import TypeVar
|
|
22
24
|
from typing import Union
|
|
23
25
|
|
|
24
26
|
import entrypoints
|
|
@@ -78,8 +80,10 @@ class Error:
|
|
|
78
80
|
|
|
79
81
|
_BY_KIND = {}
|
|
80
82
|
|
|
83
|
+
T = TypeVar("T")
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
|
|
86
|
+
class Registry(Generic[T]):
|
|
83
87
|
"""A registry of factories.
|
|
84
88
|
|
|
85
89
|
Parameters
|
|
@@ -287,7 +291,7 @@ class Registry:
|
|
|
287
291
|
|
|
288
292
|
return sorted(self.factories.keys())
|
|
289
293
|
|
|
290
|
-
def create(self, name: str, *args: Any, **kwargs: Any) ->
|
|
294
|
+
def create(self, name: str, *args: Any, **kwargs: Any) -> T:
|
|
291
295
|
"""Create an instance using a factory.
|
|
292
296
|
|
|
293
297
|
Parameters
|
|
@@ -310,7 +314,7 @@ class Registry:
|
|
|
310
314
|
factory = self.lookup(name)
|
|
311
315
|
return factory(*args, **kwargs)
|
|
312
316
|
|
|
313
|
-
def from_config(self, config: Union[str, Dict[str, Any]], *args: Any, **kwargs: Any) ->
|
|
317
|
+
def from_config(self, config: Union[str, Dict[str, Any]], *args: Any, **kwargs: Any) -> T:
|
|
314
318
|
"""Create an instance from a configuration.
|
|
315
319
|
|
|
316
320
|
Parameters
|
|
@@ -13,7 +13,10 @@ import os
|
|
|
13
13
|
import shutil
|
|
14
14
|
import tempfile
|
|
15
15
|
import threading
|
|
16
|
+
import warnings
|
|
17
|
+
from functools import lru_cache
|
|
16
18
|
|
|
19
|
+
import pytest
|
|
17
20
|
from multiurl import download
|
|
18
21
|
|
|
19
22
|
LOG = logging.getLogger(__name__)
|
|
@@ -98,6 +101,9 @@ def get_test_data(path: str, gzipped=False) -> str:
|
|
|
98
101
|
"""
|
|
99
102
|
_check_path(path)
|
|
100
103
|
|
|
104
|
+
if _offline():
|
|
105
|
+
raise RuntimeError("Offline mode: cannot download test data, add @pytest.mark.skipif(not offline(),...)")
|
|
106
|
+
|
|
101
107
|
target = os.path.normpath(os.path.join(_temporary_directory(), path))
|
|
102
108
|
with lock:
|
|
103
109
|
if os.path.exists(target):
|
|
@@ -174,9 +180,84 @@ def packages_installed(*names) -> bool:
|
|
|
174
180
|
Flag indicating if all the packages are installed."
|
|
175
181
|
"""
|
|
176
182
|
|
|
183
|
+
warnings.warn(
|
|
184
|
+
"The 'packages_installed' function is deprecated. Use '@skip_if_missing' instead.",
|
|
185
|
+
DeprecationWarning,
|
|
186
|
+
stacklevel=2,
|
|
187
|
+
)
|
|
188
|
+
|
|
177
189
|
for name in names:
|
|
178
190
|
try:
|
|
179
191
|
__import__(name)
|
|
180
192
|
except ImportError:
|
|
181
193
|
return False
|
|
182
194
|
return True
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def _missing_packages(*names) -> list[str]:
|
|
198
|
+
"""Check if the given packages are missing.
|
|
199
|
+
|
|
200
|
+
Use this function to check if the required packages are missing before running tests.
|
|
201
|
+
|
|
202
|
+
>>> @pytest.mark.skipif(missing_packages("foo", "bar"), reason="Packages 'foo' and 'bar' are not installed")
|
|
203
|
+
>>> def test_foo_bar() -> None:
|
|
204
|
+
>>> ...
|
|
205
|
+
|
|
206
|
+
Parameters
|
|
207
|
+
----------
|
|
208
|
+
names : str
|
|
209
|
+
The names of the packages to check.
|
|
210
|
+
|
|
211
|
+
Returns
|
|
212
|
+
-------
|
|
213
|
+
list[str]:
|
|
214
|
+
List of missing packages.
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
missing = []
|
|
218
|
+
for name in names:
|
|
219
|
+
try:
|
|
220
|
+
__import__(name)
|
|
221
|
+
except ImportError:
|
|
222
|
+
missing.append(name)
|
|
223
|
+
return missing
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def _run_slow_tests() -> bool:
|
|
227
|
+
"""Check if the SLOW_TESTS environment variable is set.
|
|
228
|
+
|
|
229
|
+
Returns
|
|
230
|
+
-------
|
|
231
|
+
bool
|
|
232
|
+
True if the SLOW_TESTS environment variable is set, False otherwise.
|
|
233
|
+
"""
|
|
234
|
+
return int(os.environ.get("SLOW_TESTS", 0))
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
@lru_cache(maxsize=None)
|
|
238
|
+
def _offline() -> bool:
|
|
239
|
+
"""Check if we are offline."""
|
|
240
|
+
|
|
241
|
+
import socket
|
|
242
|
+
|
|
243
|
+
try:
|
|
244
|
+
socket.create_connection(("anemoi.ecmwf.int", 443), timeout=5)
|
|
245
|
+
except OSError:
|
|
246
|
+
return True
|
|
247
|
+
|
|
248
|
+
return False
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
skip_if_offline = pytest.mark.skipif(_offline(), reason="No internet connection")
|
|
252
|
+
skip_slow_tests = pytest.mark.skipif(not _run_slow_tests(), reason="Skipping slow tests")
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
def skip_missing_packages(*names):
|
|
256
|
+
missing = _missing_packages(*names)
|
|
257
|
+
if len(missing) == 0:
|
|
258
|
+
return lambda f: f
|
|
259
|
+
|
|
260
|
+
if len(missing) == 1:
|
|
261
|
+
return pytest.mark.skipif(True, reason=f"Package {missing[0]} is not installed")
|
|
262
|
+
|
|
263
|
+
return pytest.mark.skipif(True, reason=f"Packages {', '.join(missing)} are not installed")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anemoi-utils
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.19
|
|
4
4
|
Summary: A package to hold various functions to support training of ML models on ECMWF data.
|
|
5
5
|
Author-email: "European Centre for Medium-Range Weather Forecasts (ECMWF)" <software.support@ecmwf.int>
|
|
6
6
|
License: Apache License
|
|
@@ -237,6 +237,7 @@ Requires-Dist: anemoi-utils[grib,provenance,s3,text]; extra == "all"
|
|
|
237
237
|
Provides-Extra: dev
|
|
238
238
|
Requires-Dist: anemoi-utils[all,docs,tests]; extra == "dev"
|
|
239
239
|
Provides-Extra: docs
|
|
240
|
+
Requires-Dist: anemoi-utils[all]; extra == "docs"
|
|
240
241
|
Requires-Dist: nbsphinx; extra == "docs"
|
|
241
242
|
Requires-Dist: pandoc; extra == "docs"
|
|
242
243
|
Requires-Dist: requests; extra == "docs"
|
|
@@ -31,6 +31,7 @@ docs/installing.rst
|
|
|
31
31
|
docs/_static/logo.png
|
|
32
32
|
docs/_static/style.css
|
|
33
33
|
docs/_templates/.gitkeep
|
|
34
|
+
docs/_templates/apidoc/package.rst.jinja
|
|
34
35
|
docs/modules/checkpoints.rst
|
|
35
36
|
docs/modules/config.rst
|
|
36
37
|
docs/modules/dates.rst
|
|
@@ -40,6 +41,7 @@ docs/modules/provenance.rst
|
|
|
40
41
|
docs/modules/s3.rst
|
|
41
42
|
docs/modules/testing.rst
|
|
42
43
|
docs/modules/text.rst
|
|
44
|
+
docs/scripts/api_build.sh
|
|
43
45
|
src/anemoi/utils/__init__.py
|
|
44
46
|
src/anemoi/utils/__main__.py
|
|
45
47
|
src/anemoi/utils/_version.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{anemoi_utils-0.4.18 → anemoi_utils-0.4.19}/.github/workflows/pr-label-conventional-commits.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|