This is for a cleaner, filtered structure of our Python modules, at least regarding their load time. This is preparation for #29865 (sage-objects).
The idea is that sage.categories should be more abstract than any of the implemented algebraic structures in sage.rings, sage.algebras, sage.modules, ... Therefore it should only have a (module load time) dependence on sage.structure and sage.misc.
The present ticket changes module-level imports to method-level imports so that they are resolved later than at module load time.
At run time, of course, there are additional dependencies. For example, as noted in #29705, the output of .cardinality() must be an integer (ZZ).
Also, obviously the doctests need a larger part of the library.
(split out from #29865)
Depends on #29869
Depends on #16351
CC: @videlec @tscrim @orlitzky @nthiery @timokau @fchapoton
Component: refactoring
Author: Matthias Koeppe
Branch/Commit: 27f2dab
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/29873