Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't hide submodules explicitly, use __dir__()
We hid submodules at the top-level katpoint namespace to aid IPython tab completion, since it is confusing to see both the "target" submodule and the preferred "Target" class in the list. This was done by adding underscores to their names. The downside is that it becomes yucky to import submodules to access internals in the unit tests (and the module can't be reloaded FWIW). Don't rename the submodules but cull their names from __all__ and the output of __dir__() instead. IPython has a love/hate relationship with __all__ (see e.g. ipython/ipykernel#129) and it is currently completely ignored. The newer and shinier __dir__() in Python 3.7 (PEP 562) is respected though. Customise both for good measure. Instead of hiding submodules individually by name, cull all submodules as a group, as well as variables starting with an underscore (except __version__). It would have been nice to sort the output of __dir__() in groups (say classes followed by functions etc) but that is undermined by IPython, which simply sorts everything again at the end.
- Loading branch information