edponce commented on a change in pull request #12077:
URL: https://github.com/apache/arrow/pull/12077#discussion_r779372956
##########
File path: python/pyarrow/__init__.py
##########
@@ -75,19 +77,74 @@ def show_versions():
"""
Print various version information, to help with error reporting.
"""
- # TODO: CPU information and flags
+ def print_entry(label, value):
+ print(f"{label: <26}: {value: <8}")
+
print("pyarrow version info\n--------------------")
- print("Package kind: {}".format(cpp_build_info.package_kind
- if len(cpp_build_info.package_kind) > 0
- else "not indicated"))
- print("Arrow C++ library version: {0}".format(cpp_build_info.version))
- print("Arrow C++ compiler: {0} {1}"
- .format(cpp_build_info.compiler_id, cpp_build_info.compiler_version))
- print("Arrow C++ compiler flags: {0}"
- .format(cpp_build_info.compiler_flags))
- print("Arrow C++ git revision: {0}".format(cpp_build_info.git_id))
- print("Arrow C++ git description: {0}"
- .format(cpp_build_info.git_description))
+ print_entry("Package kind", cpp_build_info.package_kind
+ if len(cpp_build_info.package_kind) > 0
+ else "not indicated")
+ print_entry("Arrow C++ library version", cpp_build_info.version)
+ print_entry("Arrow C++ compiler",
+ f"{cpp_build_info.compiler_id}
{cpp_build_info.compiler_version}")
+ print_entry("Arrow C++ compiler flags", cpp_build_info.compiler_flags)
+ print_entry("Arrow C++ git revision", cpp_build_info.git_id)
+ print_entry("Arrow C++ git description", cpp_build_info.git_description)
+
+
+def arrow_info():
+ """
+ Print detailed version and platform information, for error reporting
+ """
+ show_versions()
+
+ def print_entry(label, value):
+ print(f" {label: <20}: {value: <8}")
+
+ print("\nPlatform:")
+ print_entry("OS / Arch", f"{platform.system()} {platform.machine()}")
+ print_entry("SIMD Level", runtime_info().simd_level)
+ print_entry("Detected SIMD Level", runtime_info().detected_simd_level)
+
+ pool = default_memory_pool()
+ print("\nMemory:")
+ print_entry("Default backend", pool.backend_name)
+ print_entry("Bytes allocated", f"{pool.bytes_allocated()} bytes")
+ print_entry("Max memory", f"{pool.max_memory()} bytes")
+ print_entry("Supported Backends", ', '.join(supported_memory_backends()))
+
+ print("\nOptional modules:")
+ modules = ["csv", "cuda", "dataset", "feather", "flight", "fs", "gandiva",
"json",
+ "orc", "parquet", "plasma"]
+ for module in modules:
+ try:
+ importlib.import_module(f'pyarrow.{module}')
+ except ImportError:
+ print(f" {module: <20}: -")
+ else:
+ print(f" {module: <20}: Enabled")
Review comment:
Maybe search
[`sys.modules`](https://docs.python.org/3.7/library/sys.html#sys.modules)
instead trying to import modules.
##########
File path: python/pyarrow/__init__.py
##########
@@ -75,19 +77,74 @@ def show_versions():
"""
Print various version information, to help with error reporting.
"""
- # TODO: CPU information and flags
+ def print_entry(label, value):
+ print(f"{label: <26}: {value: <8}")
+
print("pyarrow version info\n--------------------")
- print("Package kind: {}".format(cpp_build_info.package_kind
- if len(cpp_build_info.package_kind) > 0
- else "not indicated"))
- print("Arrow C++ library version: {0}".format(cpp_build_info.version))
- print("Arrow C++ compiler: {0} {1}"
- .format(cpp_build_info.compiler_id, cpp_build_info.compiler_version))
- print("Arrow C++ compiler flags: {0}"
- .format(cpp_build_info.compiler_flags))
- print("Arrow C++ git revision: {0}".format(cpp_build_info.git_id))
- print("Arrow C++ git description: {0}"
- .format(cpp_build_info.git_description))
+ print_entry("Package kind", cpp_build_info.package_kind
+ if len(cpp_build_info.package_kind) > 0
+ else "not indicated")
+ print_entry("Arrow C++ library version", cpp_build_info.version)
+ print_entry("Arrow C++ compiler",
+ f"{cpp_build_info.compiler_id}
{cpp_build_info.compiler_version}")
+ print_entry("Arrow C++ compiler flags", cpp_build_info.compiler_flags)
+ print_entry("Arrow C++ git revision", cpp_build_info.git_id)
+ print_entry("Arrow C++ git description", cpp_build_info.git_description)
+
+
+def arrow_info():
+ """
+ Print detailed version and platform information, for error reporting
+ """
+ show_versions()
+
+ def print_entry(label, value):
+ print(f" {label: <20}: {value: <8}")
+
+ print("\nPlatform:")
+ print_entry("OS / Arch", f"{platform.system()} {platform.machine()}")
+ print_entry("SIMD Level", runtime_info().simd_level)
+ print_entry("Detected SIMD Level", runtime_info().detected_simd_level)
+
+ pool = default_memory_pool()
Review comment:
If there is a way to have a different memory pool than the default, then
this will not show the correct info?
##########
File path: python/pyarrow/__init__.py
##########
@@ -75,19 +77,74 @@ def show_versions():
"""
Print various version information, to help with error reporting.
"""
- # TODO: CPU information and flags
+ def print_entry(label, value):
+ print(f"{label: <26}: {value: <8}")
+
print("pyarrow version info\n--------------------")
- print("Package kind: {}".format(cpp_build_info.package_kind
- if len(cpp_build_info.package_kind) > 0
- else "not indicated"))
- print("Arrow C++ library version: {0}".format(cpp_build_info.version))
- print("Arrow C++ compiler: {0} {1}"
- .format(cpp_build_info.compiler_id, cpp_build_info.compiler_version))
- print("Arrow C++ compiler flags: {0}"
- .format(cpp_build_info.compiler_flags))
- print("Arrow C++ git revision: {0}".format(cpp_build_info.git_id))
- print("Arrow C++ git description: {0}"
- .format(cpp_build_info.git_description))
+ print_entry("Package kind", cpp_build_info.package_kind
+ if len(cpp_build_info.package_kind) > 0
+ else "not indicated")
+ print_entry("Arrow C++ library version", cpp_build_info.version)
+ print_entry("Arrow C++ compiler",
+ f"{cpp_build_info.compiler_id}
{cpp_build_info.compiler_version}")
+ print_entry("Arrow C++ compiler flags", cpp_build_info.compiler_flags)
+ print_entry("Arrow C++ git revision", cpp_build_info.git_id)
+ print_entry("Arrow C++ git description", cpp_build_info.git_description)
+
+
+def arrow_info():
+ """
+ Print detailed version and platform information, for error reporting
+ """
+ show_versions()
+
+ def print_entry(label, value):
+ print(f" {label: <20}: {value: <8}")
+
+ print("\nPlatform:")
+ print_entry("OS / Arch", f"{platform.system()} {platform.machine()}")
+ print_entry("SIMD Level", runtime_info().simd_level)
+ print_entry("Detected SIMD Level", runtime_info().detected_simd_level)
+
+ pool = default_memory_pool()
+ print("\nMemory:")
+ print_entry("Default backend", pool.backend_name)
+ print_entry("Bytes allocated", f"{pool.bytes_allocated()} bytes")
+ print_entry("Max memory", f"{pool.max_memory()} bytes")
+ print_entry("Supported Backends", ', '.join(supported_memory_backends()))
+
+ print("\nOptional modules:")
+ modules = ["csv", "cuda", "dataset", "feather", "flight", "fs", "gandiva",
"json",
Review comment:
I suggest to create a `show_components()` function for `Optional
modules, Filesystems, Compression Codecs, etc`. This would provide better
readability of `arrow_info()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]