-
-
Notifications
You must be signed in to change notification settings - Fork 328
Deprecate the experimental v3 implementation #1802
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
Merged
jhamman
merged 6 commits into
zarr-developers:main
from
jhamman:dep/experimental-v3-impl
Apr 22, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
97dc187
deprecate(exp-v3): Add a future warning about the pending removal of …
jhamman 775dccd
ignore warning
jhamman af56384
add test
jhamman 8a13553
Merge branch 'main' of https://github.com/zarr-developers/zarr-python…
jhamman 834a3e1
reset warnings before test
jhamman c8e2f12
Merge branch 'main' into dep/experimental-v3-impl
jhamman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import abc | ||
import os | ||
import warnings | ||
from collections import defaultdict | ||
from collections.abc import MutableMapping | ||
from copy import copy | ||
|
@@ -23,9 +24,21 @@ | |
DEFAULT_ZARR_VERSION: ZARR_VERSION = 2 | ||
|
||
v3_api_available = os.environ.get("ZARR_V3_EXPERIMENTAL_API", "0").lower() not in ["0", "false"] | ||
_has_warned_about_v3 = False # to avoid printing the warning multiple times | ||
|
||
|
||
def assert_zarr_v3_api_available(): | ||
# we issue a warning about the experimental v3 implementation when it is first used | ||
global _has_warned_about_v3 | ||
if v3_api_available and not _has_warned_about_v3: | ||
warnings.warn( | ||
"The experimental Zarr V3 implementation in this version of Zarr-Python is not " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ (TIL emoji names are case sensitive) |
||
"in alignment with the final V3 specification. This version will be removed in " | ||
"Zarr-Python 3 in favor of a spec compliant version.", | ||
FutureWarning, | ||
stacklevel=1, | ||
) | ||
_has_warned_about_v3 = True | ||
if not v3_api_available: | ||
raise NotImplementedError( | ||
"# V3 reading and writing is experimental! To enable support, set:\n" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this was the default but 🤷🏽
https://docs.python.org/3/library/warnings.html#the-warnings-filter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I certainly tried this first. It's possible this would have worked if I had put warning elsewhere, but as implemented, the warning is emitted multiple times without this switch. I think this is due to the fact that
assert_zarr_v3_api_available
is used in various places around the library.