Skip to content

ENH: Added display modes for show_runtime - #26255

Merged
mattip merged 17 commits into
numpy:mainfrom
ganesh-k13:show_runtime_modes
Sep 22, 2026
Merged

mattip merged 17 commits into
numpy:mainfrom
ganesh-k13:show_runtime_modes

Conversation

@ganesh-k13

@ganesh-k13 ganesh-k13 commented Apr 10, 2024 •

Copy link
Copy Markdown
Member

Changes

  • ENH: Added display modes for show_runtime

Allowed modes are same as show_config

`dicts` mode
In [2]: np.show_runtime(mode='dicts')
Out[2]:   
[{'numpy_version': '2.1.0.dev0+git20240410.6e3b392',
  'python': '3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]',
  'uname': {'machine': 'x86_64',
   'node': 'ganesh-MS-7B86',
   'processor': 'x86_64',
   'release': '5.15.0-100-generic',
   'system': 'Linux',
   'version': '#110-Ubuntu SMP Wed Feb 7 13:27:48 UTC 2024'}},
 {'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
   'found': ['SSSE3',
    'SSE41', 
    'POPCNT', 
    'SSE42',    
    'AVX',      
    'F16C',     
    'FMA3',     
    'AVX2'],    
   'not_found': ['AVX512F',
    'AVX512CD',    
    'AVX512_KNL',                                                                                
    'AVX512_KNM',       
    'AVX512_SKX',
    'AVX512_CLX',    
    'AVX512_CNL',          
    'AVX512_ICL']}},
 {'user_api': 'blas',
  'internal_api': 'openblas',
  'num_threads': 12,
  'prefix': 'libopenblas',
  'filepath': '/usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so',
  'version': '0.3.20',
  'threading_layer': 'pthreads',
  'architecture': 'Zen'}]

`stdout` mode (default)
In [3]: np.show_runtime()
- numpy_version: 2.1.0.dev0+git20240410.6e3b392
  python: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
  uname:
    machine: x86_64
    node: ganesh-MS-7B86
    processor: x86_64
    release: 5.15.0-100-generic
    system: Linux
    version: '#110-Ubuntu SMP Wed Feb 7 13:27:48 UTC 2024'
- simd_extensions:
    baseline:
    - SSE
    - SSE2
    - SSE3
    found:
    - SSSE3
    - SSE41
    - POPCNT
    - SSE42
    - AVX
    - F16C
    - FMA3
    - AVX2
    not_found:
    - AVX512F
    - AVX512CD
    - AVX512_KNL
    - AVX512_KNM
    - AVX512_SKX
    - AVX512_CLX
    - AVX512_CNL
    - AVX512_ICL
- architecture: Zen
  filepath: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so
  internal_api: openblas
  num_threads: 12
  prefix: libopenblas
  threading_layer: pthreads
  user_api: blas
  version: 0.3.20

ToDo

  • Typing changes
  • Release notes

Notes

resolves: https://mail.python.org/archives/list/[email protected]/thread/NF7ET6O5ELCLXGEIN7P2AUO5S4MESMSK/

@ganesh-k13
ganesh-k13 requested a review from rgommers April 10, 2024 13:51
@ganesh-k13 ganesh-k13 self-assigned this Apr 10, 2024
ganesh-k13 added a commit to ganesh-k13/numpy that referenced this pull request Apr 10, 2024
ganesh-k13 added a commit to ganesh-k13/numpy that referenced this pull request Apr 10, 2024
ganesh-k13 added a commit to ganesh-k13/numpy that referenced this pull request Apr 10, 2024
Comment thread numpy/__init__.pyi Outdated
@mattip

mattip commented Jul 3, 2024

Copy link
Copy Markdown
Member

@ganesh-k13 will you be continuing with this?

@ganesh-k13

Copy link
Copy Markdown
Member Author

@mattip , I'll pick it up this weekend. Got a bit busy lately.

@ganesh-k13
ganesh-k13 force-pushed the show_runtime_modes branch from 52f335a to 525373d Compare July 5, 2024 10:53
ganesh-k13 added a commit to ganesh-k13/numpy that referenced this pull request Jul 5, 2024
@ganesh-k13
ganesh-k13 marked this pull request as ready for review July 5, 2024 11:15
@mattip

mattip commented Jan 26, 2026

Copy link
Copy Markdown
Member

@ganesh-k13 it would be nice to push this over the finish line. There are merge conflicts.

@ganesh-k13

Copy link
Copy Markdown
Member Author

Thanks for looking into this. I'll get the merge conflicts resolved this week.

ganesh-k13 added a commit to ganesh-k13/numpy that referenced this pull request Jan 29, 2026
@ganesh-k13
ganesh-k13 force-pushed the show_runtime_modes branch 2 times, most recently from 180c3ea to 342e368 Compare January 29, 2026 05:40
@rgommers

Copy link
Copy Markdown
Member

mypy and stubtest have some complaints that look straightforward to resolve. Other that that, please do ask for re-review when ready.

@ganesh-k13

ganesh-k13 commented Jan 30, 2026 •

Copy link
Copy Markdown
Member Author

Debugging why basedpyright check is failing, I'm getting:

0.9995201535508638
Coverage 100.0% is below minimum required 100%

But it's quite hard to narrow down what is actually failing. Will fix this today.

[edit]

Made some tweaks and got the failing fns:

{'category': 'function', 'name': 'numpy.show_runtime', 'referenceCount': 1, 'isExported': True, 'isTypeKnown': False, 'isTypeAmbiguous': False, 'diagnostics': [{'file': '/Users/gakathir/Documents/os/numpy/build-install/usr/lib/python3.13/site-packages/numpy/lib/_utils_impl.pyi', 'severity': 'warning', 'message': 'No docstring found for function "numpy.show_runtime"', 'range': {'start': {'line': 586, 'character': 4}, 'end': {'line': 586, 'character': 16}}}, {'file': '/Users/gakathir/Documents/os/numpy/build-install/usr/lib/python3.13/site-packages/numpy/lib/_utils_impl.pyi', 'severity': 'error', 'message': 'Return type is partially unknown\n\xa0\xa0Return type is "dict[Unknown, Unknown] | None"\n\xa0\xa0\xa0\xa0Type argument 1 for class "dict" has unknown type\n\xa0\xa0\xa0\xa0Type argument 2 for class "dict" has unknown type', 'range': {'start': {'line': 586, 'character': 4}, 'end': {'line': 586, 'character': 16}}}]}
{'category': 'function', 'name': 'numpy.matlib.show_runtime', 'referenceCount': 1, 'isExported': True, 'isTypeKnown': False, 'isTypeAmbiguous': False, 'diagnostics': [{'file': '/Users/gakathir/Documents/os/numpy/build-install/usr/lib/python3.13/site-packages/numpy/__init__.pyi', 'severity': 'warning', 'message': 'No docstring found for function "numpy.matlib.show_runtime"', 'range': {'start': {'line': 416, 'character': 4}, 'end': {'line': 416, 'character': 16}}}, {'file': '/Users/gakathir/Documents/os/numpy/build-install/usr/lib/python3.13/site-packages/numpy/__init__.pyi', 'severity': 'error', 'message': 'Return type is partially unknown\n\xa0\xa0Return type is "dict[Unknown, Unknown] | None"\n\xa0\xa0\xa0\xa0Type argument 1 for class "dict" has unknown type\n\xa0\xa0\xa0\xa0Type argument 2 for class "dict" has unknown type', 'range': {'start': {'line': 416, 'character': 4}, 'end': {'line': 416, 'character': 16}}}]}

@ganesh-k13

Copy link
Copy Markdown
Member Author

I used Claude for 5a039dd, please do have a look as I'm not sure if it's optimal and can be somehow combined into one line. I think @jorenham might know?

Comment thread numpy/lib/_utils_impl.pyi Outdated

@jorenham jorenham left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The static typing changes are good now :)

ganesh-k13 added a commit to ganesh-k13/numpy that referenced this pull request Sep 7, 2026

@mattip mattip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM and brings show_runtime into line with show_config. @jorenham are you happy with the last changes? CI is passing.

Comment thread numpy/_utils/_config_helpers.py
Comment thread numpy/_utils/_config_helpers.py Outdated
Comment thread numpy/lib/_utils_impl.pyi
Comment thread numpy/__config__.py.in Outdated
ganesh-k13 added a commit to ganesh-k13/numpy that referenced this pull request Sep 8, 2026
Comment thread requirements/typing_requirements.txt Outdated
@jorenham
jorenham self-requested a review September 21, 2026 19:04

@jorenham jorenham left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The typing changes look right 👌

@mattip
mattip merged commit 69ea672 into numpy:main Sep 22, 2026
93 checks passed
@mattip

mattip commented Sep 22, 2026

Copy link
Copy Markdown
Member

Thanks @ganesh-k13

Riaz1729 pushed a commit to Riaz1729/numpy that referenced this pull request Sep 23, 2026
Co-authored-by: Joren Hammudoglu <[email protected]>
Co-authored-by: Ralf Gommers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants