As noted in #188, importing highdicom requires importing the very large data structures in highdicom._iods and highdicom._modules. This slows down imports somewhat, but more importantly slows down coverage based tests like coverage run very considerably when often this is unnecessary because the data will not actually be used.
This PR swaps all imports from these modules to be lazily evaluated. With this change, the test that @wyli reported took an very long time now completes almost instantaneously. Of course coverage tests that run on functions that make use of the data in these modules will still be slow, but at least now simple tests will run faster.
As far as I'm aware, there are no significant downsides to this.
As noted in #188, importing highdicom requires importing the very large data structures in
highdicom._iods
andhighdicom._modules
. This slows down imports somewhat, but more importantly slows down coverage based tests likecoverage run
very considerably when often this is unnecessary because the data will not actually be used.This PR swaps all imports from these modules to be lazily evaluated. With this change, the test that @wyli reported took an very long time now completes almost instantaneously. Of course coverage tests that run on functions that make use of the data in these modules will still be slow, but at least now simple tests will run faster.
As far as I'm aware, there are no significant downsides to this.