Skip to content

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

ianhi
Copy link
Contributor

@ianhi ianhi commented Mar 17, 2025

Created the print_debug_info function from #2907
Will render in the issue template like this:

image

example output:

platform: macOS-15.3-arm64-arm-64bit-Mach-O
python: 3.13.2

zarr: 3.0.5.dev8+g71a77687.d20250308

numcodecs: 0.15.1
numpy: 2.2.3
fsspec: 2025.3.0

closes #2907

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • [NA?] New/modified features documented in docs/user-guide/*.rst
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Mar 17, 2025
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Mar 17, 2025
@ianhi ianhi changed the title feat: add function feat: add print_debug_info function Mar 17, 2025
Copy link
Member

@jhamman jhamman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ianhi - I like the concept here. Just a few suggestions to make it a bit more complete.

"""
from zarr import print_debug_info

print_debug_info()
Copy link
Member

Choose a reason for hiding this comment

The 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

print(f"python: {platform.python_version()}\n")

print(f"zarr: {__version__}\n")
for package in ["numcodecs", "numpy", "fsspec", "s3fs", "botocore", "gcsfs"]:
Copy link
Member

Choose a reason for hiding this comment

The 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
Optional dependencies: botocore | cupy-cuda12x | fsspec| numcodecs | rich | s3fs | universal-pathlib | obstore

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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

@ianhi
Copy link
Contributor Author

ianhi commented Mar 28, 2025

After discussino with @jhamman there is a sequencing issue here. If we change the issue template prior to releasing the function it won't be possible to make an issue! So I think the way forward is to merge the function and then added the issue template chagnes later

Copy link
Contributor

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! I left some minor suggestions to improve the formatting which I think are worth considering, but feel free to take them or leave them.

print(f"zarr: {__version__}\n")
print("Required dependencies:")
print_packages(required)
print("Optional dependencies:")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print("Optional dependencies:")
print("Optional dependencies")
print("---------------------")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trouble with this is that it can render as a pagebreak in github markdown and turns the text above into an H2 text which I find a bit confusing for the flow of the isssue

How does using asterisks feel to you?

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't think about the "putting this into markdown on GitHub stage" 🤦 . In that case either asterisks or no change is fine by me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: add print_debug_info() function
3 participants