guberti commented on PR #13689: URL: https://github.com/apache/tvm/pull/13689#issuecomment-1377675817
For what it's worth, I've never been a fan of how we need to add the following to _every_ tutorial: ```python # sphinx_gallery_start_ignore from tvm import testing testing.utils.install_request_hook(depth=3) # sphinx_gallery_end_ignore ``` Instead, we could use [`reset_modules`](https://sphinx-gallery.github.io/stable/advanced.html#custom-reset) from sphinx-gallery's configuration to run code before every example. It would be pretty straightforward: ```python from tvm import testing def add_hook(gallery_conf, fname): testing.utils.install_request_hook(depth=3) sphinx_gallery_conf = { ... 'reset_modules': (add_hook), } ``` If we needed the hook for `pytest` as well, we could add a `conf.py` file to the `gallery` directory as well. We shouldn't change this here, but it might be worth considering in the future @driazati. -- 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]
