Skip to content
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

stripping out ANSI escape color codes when building jupyter book #77

Closed
edublancas opened this issue Jun 22, 2023 · 1 comment
Closed

Comments

@edublancas
Copy link
Contributor

when a notebook fails during a jupyter-book build running on readthedocs, the traceback is hard to read since it contains ANSI color escape codes. example:

�[0;31m---------------------------------------------------------------------------�[0m
�[0;31mTypeError�[0m                                 Traceback (most recent call last)
Cell �[0;32mIn[4], line 3�[0m
�[1;32m      1�[0m �[38;5;28;01mfrom�[39;00m �[38;5;21;01msklearn_evaluation�[39;00m �[38;5;28;01mimport�[39;00m plot
�[0;32m----> 3�[0m cm �[38;5;241m=�[39m �[43mplot�[49m�[38;5;241;43m.�[39;49m�[43mInteractiveConfusionMatrix�[49m�[38;5;241;43m.�[39;49m�[43mfrom_raw_data�[49m�[43m(�[49m
�[1;32m      4�[0m �[43m    �[49m�[43my_test�[49m�[38;5;241;43m.�[39;49m�[43mtolist�[49m�[43m(�[49m�[43m)�[49m�[43m,�[49m
�[1;32m      5�[0m �[43m    �[49m�[43my_pred�[49m�[38;5;241;43m.�[39;49m�[43mtolist�[49m�[43m(�[49m�[43m)�[49m�[43m,�[49m
�[1;32m      6�[0m �[43m    �[49m�[43mX_test�[49m�[38;5;241;43m=�[39;49m�[43mX_test�[49m�[43m,�[49m
�[1;32m      7�[0m �[43m    �[49m�[43mfeature_subset�[49m�[38;5;241;43m=�[39;49m�[43m[�[49m
�[1;32m      8�[0m �[43m        �[49m�[38;5;124;43m"�[39;49m�[38;5;124;43mMale�[39;49m�[38;5;124;43m"�[39;49m�[43m,�[49m
�[1;32m      9�[0m �[43m        �[49m�[38;5;124;43m"�[39;49m�[38;5;124;43mbody_mass_g�[39;49m�[38;5;124;43m"�[39;49m�[43m,�[49m
�[1;32m     10�[0m �[43m        �[49m�[38;5;124;43m"�[39;49m�[38;5;124;43mbill_depth_mm�[39;49m�[38;5;124;43m"�[39;49m�[43m,�[49m
�[1;32m     11�[0m �[43m        �[49m�[38;5;124;43m"�[39;49m�[38;5;124;43mbill_length_mm�[39;49m�[38;5;124;43m"�[39;49m�[43m,�[49m
�[1;32m     12�[0m �[43m        �[49m�[38;5;124;43m"�[39;49m�[38;5;124;43mflipper_length_mm�[39;49m�[38;5;124;43m"�[39;49m�[43m,�[49m
�[1;32m     13�[0m �[43m    �[49m�[43m]�[49m�[43m,�[49m
�[1;32m     14�[0m �[43m    �[49m�[43mnsample�[49m�[38;5;241;43m=�[39;49m�[38;5;241;43m6�[39;49m�[43m,�[49m
�[1;32m     15�[0m �[43m)�[49m

source: https://readthedocs.org/projects/sklearn-evaluation/builds/21083255/

jupyter-book uses myst-nb to execute notebooks. we can use something like this to remove the escape codes

Unfortunately, to fix this, we'd need to modify other packages as well.

execution is performed by jupyter-cache, which uses nbclient for notebook execution.

even though the fix is simple, it'd take some time since we depend on the package maintainer's approval.

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

No branches or pull requests

1 participant