-
-
Notifications
You must be signed in to change notification settings - Fork 330
feat: add print_debug_info
function
#2913
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
Changes from 3 commits
5020d13
35ef9a8
35d0c86
a0ac6b6
809c7a0
2939e16
6344c0b
2268275
7df75ac
e8afd1d
adb361b
f1a2495
4550a5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added a `print_debug_info` function for bug reports. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,25 @@ | |
# in case setuptools scm screw up and find version to be 0.0.0 | ||
assert not __version__.startswith("0.0.0") | ||
|
||
|
||
def print_debug_info() -> None: | ||
""" | ||
Print version info for use in bug reports. | ||
""" | ||
import platform | ||
from importlib import import_module | ||
|
||
print(f"platform: {platform.platform()}") | ||
print(f"python: {platform.python_version()}\n") | ||
|
||
print(f"zarr: {__version__}\n") | ||
for package in ["numcodecs", "numpy", "fsspec", "s3fs", "botocore", "gcsfs"]: | ||
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. can we include the full list of required and optional dependencies here? Required dependencies: donfig | numcodecs | numpy | packaging | typing-extensions 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. I added all of them. They're in a list because introspecting the package to grab it's own dependencies seemed to add a bit of unnecessary complication |
||
try: | ||
print(f"{package}: {import_module(package).__version__}") | ||
except ModuleNotFoundError: | ||
continue | ||
|
||
|
||
__all__ = [ | ||
"Array", | ||
"AsyncArray", | ||
|
@@ -65,6 +84,7 @@ | |
"open_consolidated", | ||
"open_group", | ||
"open_like", | ||
"print_debug_info", | ||
"save", | ||
"save_array", | ||
"save_group", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,12 @@ def test_exports() -> None: | |
|
||
for export in __all__: | ||
getattr(zarr, export) | ||
|
||
|
||
def test_print_debug_info() -> None: | ||
""" | ||
Ensure that print_debug_info does not raise an error | ||
""" | ||
from zarr import print_debug_info | ||
|
||
print_debug_info() | ||
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. to make this test a bit more meaningful, let's capture the output and assert that it matches our basic expectations. https://docs.pytest.org/en/stable/how-to/capture-stdout-stderr.html#accessing-captured-output-from-a-test-function 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. I tested two outputs that should always be there. I didn't test every output because at some point that just becomes rewriting the fucntion |
Uh oh!
There was an error while loading. Please reload this page.