Closed wyli closed 2 years ago
This is speculation but I imagine that this is probably due to just a couple of files within highdicom. The package contains a large part of the DICOM standard specification scraped from the standard itself and placed into nested Python list/dictionary structures within the modules highdicom._modules
and (to a lesser extent) highdicom._iods
. These files are therefore very large and can cause coverage tools to work very slowly (especially the first time, when many build a cache that will speed up subsequent runs).
I'm not an expert on coverage
, but is there some way to manually exclude those files?
Thanks, that's probably the issue. I couldn't find a way to exclude the files. on the other hand, I think it might be useful for highdicom to consider other possibilities of packaging that static standard specification? and perhaps improve the import by loading the module attributes lazily only when the users request them?
@wyli see #196 for a solution to your issue
@wyli see #196 for a solution to your issue
thanks!
There is still room for improvement here, but marking this immediate issue as resolved
thank you, in the colab notebook now it works fine!
!pip install coverage
!pip install git+https://github.com/herrmannlab/highdicom.git
!echo "import highdicom" > my_test.py
!coverage run my_test.py
I came across this issue when importing highdicom with
coverage
:it seems the import always takes a long time, compared with other python packages such as numpy.
here is a minimal example in colab: https://colab.research.google.com/drive/18qCwaHr3CWhvTmdY8dZKA2Pn0dDzlmvR![Screenshot 2022-07-19 at 14 06 27](https://user-images.githubusercontent.com/831580/179757280-9ac62d08-062f-4f9b-975d-b6434c9693ec.png)