Skip to content

Fix/tcolor preserve metadata#20046

Open
aviralgarg05 wants to merge 3 commits intoroot-project:masterfrom
aviralgarg05:fix/tcolor-preserve-metadata
Open

Fix/tcolor preserve metadata#20046
aviralgarg05 wants to merge 3 commits intoroot-project:masterfrom
aviralgarg05:fix/tcolor-preserve-metadata

Conversation

@aviralgarg05
Copy link

This Pull request:

Changes or fixes:

  • Add import functools to enable metadata preservation
  • Decorate wrapper function with @functools.wraps(original_init) to maintain name, doc, and wrapped attributes
  • Fixes TColor.DefinedColors(1) failure in Jupyter notebooks
  • Ensures proper method resolution in introspection-heavy environments

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #20018

@github-actions
Copy link

github-actions bot commented Oct 7, 2025

Test Results

    22 files      22 suites   3d 22h 39m 47s ⏱️
 3 781 tests  3 776 ✅ 0 💤  5 ❌
81 252 runs  81 227 ✅ 0 💤 25 ❌

For more details on these failures, see this check.

Results for commit 104c3c9.

♻️ This comment has been updated with latest results.

@dpiparo dpiparo assigned linev and guitargeek and unassigned linev Oct 8, 2025
@dpiparo dpiparo requested a review from guitargeek October 8, 2025 05:00
@dpiparo
Copy link
Member

dpiparo commented Oct 8, 2025

Thanks for this code. In order to start the review we would need to also have a test that reproduces the problem. Notebook tests are in this directory https://github.com/root-project/root/tree/master/roottest/python/JupyROOT

@aviralgarg05 aviralgarg05 requested a review from bellenot as a code owner October 8, 2025 08:01
…ps (fixes Jupyter TColor.DefinedColors behavior)
@aviralgarg05 aviralgarg05 force-pushed the fix/tcolor-preserve-metadata branch from a4fcac7 to 126b87a Compare October 9, 2025 15:42
@aviralgarg05
Copy link
Author

I'll go through them and solve

@aviralgarg05 aviralgarg05 force-pushed the fix/tcolor-preserve-metadata branch from 30c8fe7 to 104c3c9 Compare November 29, 2025 21:41
Add notebook test and unit test to verify that TColor.__init__ metadata
is preserved after pythonization. This ensures that introspection-heavy
environments like Jupyter can properly inspect the method.

- Add tcolor_definedcolors.ipynb: reproduces original issue root-project#20018
- Add test_tcolor_metadata.py: unit tests for metadata preservation
- Update CMakeLists.txt: register notebook test in test suite

Fixes root-project#20018
@aviralgarg05 aviralgarg05 force-pushed the fix/tcolor-preserve-metadata branch from 104c3c9 to 8d65248 Compare December 19, 2025 18:15
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.

ROOT.TColor.DefinedColors(1) problematic in jupyter notebooks

6 participants