anemoi-utils 0.4.26__tar.gz → 0.4.27__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.

Files changed (102) hide show
  1. anemoi_utils-0.4.27/.release-please-manifest.json +3 -0
  2. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/CHANGELOG.md +7 -0
  3. {anemoi_utils-0.4.26/src/anemoi_utils.egg-info → anemoi_utils-0.4.27}/PKG-INFO +1 -1
  4. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/_version.py +2 -2
  5. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/remote/s3.py +82 -19
  6. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27/src/anemoi_utils.egg-info}/PKG-INFO +1 -1
  7. anemoi_utils-0.4.26/.release-please-manifest.json +0 -3
  8. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.gitattributes +0 -0
  9. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/CODEOWNERS +0 -0
  10. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/ci-hpc-config.yml +0 -0
  11. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/dependabot.yml +0 -0
  12. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/labeler.yml +0 -0
  13. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/pull_request_template.md +0 -0
  14. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/workflows/downstream-ci-hpc.yml +0 -0
  15. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/workflows/pr-conventional-commit.yml +0 -0
  16. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/workflows/pr-label-conventional-commits.yml +0 -0
  17. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/workflows/pr-label-file-based.yml +0 -0
  18. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/workflows/pr-label-public.yml +0 -0
  19. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/workflows/python-publish.yml +0 -0
  20. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/workflows/python-pull-request.yml +0 -0
  21. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/workflows/readthedocs-pr-update.yml +0 -0
  22. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.github/workflows/release-please.yml +0 -0
  23. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.gitignore +0 -0
  24. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.pre-commit-config.yaml +0 -0
  25. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.readthedocs.yaml +0 -0
  26. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/.release-please-config.json +0 -0
  27. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/CONTRIBUTORS.md +0 -0
  28. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/LICENSE +0 -0
  29. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/README.md +0 -0
  30. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/Makefile +0 -0
  31. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/_static/logo.png +0 -0
  32. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/_static/style.css +0 -0
  33. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/_templates/.gitkeep +0 -0
  34. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/_templates/apidoc/package.rst.jinja +0 -0
  35. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/conf.py +0 -0
  36. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/index.rst +0 -0
  37. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/installing.rst +0 -0
  38. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/modules/checkpoints.rst +0 -0
  39. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/modules/config.rst +0 -0
  40. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/modules/dates.rst +0 -0
  41. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/modules/grib.rst +0 -0
  42. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/modules/humanize.rst +0 -0
  43. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/modules/provenance.rst +0 -0
  44. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/modules/s3.rst +0 -0
  45. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/modules/testing.rst +0 -0
  46. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/modules/text.rst +0 -0
  47. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/docs/scripts/api_build.sh +0 -0
  48. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/pyproject.toml +0 -0
  49. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/setup.cfg +0 -0
  50. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/__init__.py +0 -0
  51. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/__main__.py +0 -0
  52. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/caching.py +0 -0
  53. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/checkpoints.py +0 -0
  54. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/cli.py +0 -0
  55. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/commands/__init__.py +0 -0
  56. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/commands/config.py +0 -0
  57. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/commands/metadata.py +0 -0
  58. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/commands/requests.py +0 -0
  59. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/commands/transfer.py +0 -0
  60. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/compatibility.py +0 -0
  61. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/config.py +0 -0
  62. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/dates.py +0 -0
  63. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/devtools.py +0 -0
  64. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/grib.py +0 -0
  65. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/grids.py +0 -0
  66. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/hindcasts.py +0 -0
  67. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/humanize.py +0 -0
  68. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/logs.py +0 -0
  69. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/mars/__init__.py +0 -0
  70. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/mars/mars.yaml +0 -0
  71. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/mars/requests.py +0 -0
  72. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/provenance.py +0 -0
  73. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/registry.py +0 -0
  74. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/remote/__init__.py +0 -0
  75. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/remote/ssh.py +0 -0
  76. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/rules.py +0 -0
  77. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/s3.py +0 -0
  78. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/sanitise.py +0 -0
  79. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/sanitize.py +0 -0
  80. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/schemas/__init__.py +0 -0
  81. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/schemas/errors.py +0 -0
  82. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/testing.py +0 -0
  83. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/text.py +0 -0
  84. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi/utils/timer.py +0 -0
  85. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi_utils.egg-info/SOURCES.txt +0 -0
  86. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi_utils.egg-info/dependency_links.txt +0 -0
  87. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi_utils.egg-info/entry_points.txt +0 -0
  88. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi_utils.egg-info/requires.txt +0 -0
  89. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/src/anemoi_utils.egg-info/top_level.txt +0 -0
  90. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test-transfer-data/directory/b/c/x +0 -0
  91. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test-transfer-data/directory/b/y +0 -0
  92. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test-transfer-data/directory/exotic filename ;^/"'[=.,#]()/303/252/303/274/303/247/303/262/342/234/205.txt" +0 -0
  93. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test-transfer-data/directory/z +0 -0
  94. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test-transfer-data/file +0 -0
  95. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test_caching.py +0 -0
  96. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test_compatibility.py +0 -0
  97. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test_dates.py +0 -0
  98. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test_frequency.py +0 -0
  99. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test_provenance.py +0 -0
  100. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test_remote.py +0 -0
  101. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test_sanetise.py +0 -0
  102. {anemoi_utils-0.4.26 → anemoi_utils-0.4.27}/tests/test_utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.4.27"
3
+ }
@@ -8,6 +8,13 @@ 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.27](https://github.com/ecmwf/anemoi-utils/compare/0.4.26...0.4.27) (2025-06-27)
12
+
13
+
14
+ ### Features
15
+
16
+ * Split s3 config from s3 client code ([#170](https://github.com/ecmwf/anemoi-utils/issues/170)) ([56dacb1](https://github.com/ecmwf/anemoi-utils/commit/56dacb19efa0979acd72edb72a95f058b69d612a))
17
+
11
18
  ## [0.4.26](https://github.com/ecmwf/anemoi-utils/compare/0.4.25...0.4.26) (2025-06-25)
12
19
 
13
20
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anemoi-utils
3
- Version: 0.4.26
3
+ Version: 0.4.27
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
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.4.26'
21
- __version_tuple__ = version_tuple = (0, 4, 26)
20
+ __version__ = version = '0.4.27'
21
+ __version_tuple__ = version_tuple = (0, 4, 27)
@@ -47,8 +47,8 @@ SECRETS = ["aws_access_key_id", "aws_secret_access_key"]
47
47
  thread_local = threading.local()
48
48
 
49
49
 
50
- def s3_client(bucket: str, *, region: str = None, service: str = "s3") -> Any:
51
- """Get an S3 client for the specified bucket and region.
50
+ def _s3_config(bucket: str, *, region: str = None) -> Any:
51
+ """Get an S3 client config for the specified bucket and region.
52
52
 
53
53
  Parameters
54
54
  ----------
@@ -56,31 +56,15 @@ def s3_client(bucket: str, *, region: str = None, service: str = "s3") -> Any:
56
56
  The name of the S3 bucket.
57
57
  region : str, optional
58
58
  The AWS region of the S3 bucket.
59
- service : str, optional
60
- The AWS service to use, default is "s3".
61
59
 
62
60
  Returns
63
61
  -------
64
62
  Any
65
63
  The S3 client.
66
64
  """
67
- import boto3
68
65
  from botocore import UNSIGNED
69
- from botocore.client import Config
70
66
 
71
- if not hasattr(thread_local, "s3_clients"):
72
- thread_local.s3_clients = {}
73
-
74
- key = f"{bucket}-{region}-{service}"
75
-
76
- if key in thread_local.s3_clients:
77
- return thread_local.s3_clients[key]
78
-
79
- boto3_config = dict(
80
- max_pool_connections=25,
81
- request_checksum_calculation="when_required",
82
- response_checksum_validation="when_required",
83
- )
67
+ boto3_config = {}
84
68
 
85
69
  if region:
86
70
  # This is using AWS
@@ -129,6 +113,85 @@ def s3_client(bucket: str, *, region: str = None, service: str = "s3") -> Any:
129
113
  boto3_config.update(options["config"])
130
114
  del options["config"]
131
115
 
116
+ def _(options):
117
+
118
+ def __(k, v):
119
+ if k in SECRETS:
120
+ return "***"
121
+ return v
122
+
123
+ if isinstance(options, dict):
124
+ return {k: __(k, v) for k, v in options.items()}
125
+
126
+ if isinstance(options, list):
127
+ return [_(o) for o in options]
128
+
129
+ return options
130
+
131
+ LOG.debug(f"Using S3 options: {_(options)}")
132
+
133
+ return boto3_config, options
134
+
135
+
136
+ def s3_options(bucket: str, *, region: str = None, service: str = "s3") -> dict:
137
+ """Get the S3 configuration for the specified bucket and region.
138
+
139
+ Parameters
140
+ ----------
141
+ bucket : str
142
+ The name of the S3 bucket.
143
+ region : str, optional
144
+ The AWS region of the S3 bucket.
145
+ service : str, optional
146
+ The AWS service to use, default is "s3".
147
+
148
+ Returns
149
+ -------
150
+ dict
151
+ The S3 configuration.
152
+ """
153
+ _, options = _s3_config(bucket, region=region)
154
+ return options
155
+
156
+
157
+ def s3_client(bucket: str, *, region: str = None, service: str = "s3") -> Any:
158
+ """Get an S3 client for the specified bucket and region.
159
+
160
+ Parameters
161
+ ----------
162
+ bucket : str
163
+ The name of the S3 bucket.
164
+ region : str, optional
165
+ The AWS region of the S3 bucket.
166
+ service : str, optional
167
+ The AWS service to use, default is "s3".
168
+
169
+ Returns
170
+ -------
171
+ Any
172
+ The S3 client.
173
+ """
174
+ import boto3
175
+ from botocore.client import Config
176
+
177
+ if not hasattr(thread_local, "s3_clients"):
178
+ thread_local.s3_clients = {}
179
+
180
+ key = f"{bucket}-{region}-{service}"
181
+
182
+ if key in thread_local.s3_clients:
183
+ return thread_local.s3_clients[key]
184
+
185
+ boto3_config, options = _s3_config(bucket, region=region)
186
+
187
+ boto3_config.update(
188
+ dict(
189
+ max_pool_connections=25,
190
+ request_checksum_calculation="when_required",
191
+ response_checksum_validation="when_required",
192
+ )
193
+ )
194
+
132
195
  options["config"] = Config(**boto3_config)
133
196
 
134
197
  def _(options):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anemoi-utils
3
- Version: 0.4.26
3
+ Version: 0.4.27
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
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.4.26"
3
- }
File without changes
File without changes
File without changes
File without changes