The top level enterprise_gateway.__init__.py contains a couple of imports that get fired whenever someone imports enterprise_gateway or anything below:
https://github.com/jupyter/enterprise_gateway/blob/443708ffb4cac466fb43e6daccddcdf24aed1945/enterprise_gateway/__init__.py#L4-L5
The from ._version... line is harmless, but the from .enterprisegatewayapp import launch_instance is problematic. Basically, the import from enterprisegatewayapp in turn imports most the rest of the code in the enterprise_gateway pkg, which causes some issues:
- Can help cause large slowdowns when fetching install-wide pkg metadata, eg a particular group of entry points
- discussed extensively in this ongoing PR about extending entry points to expose jupyter plugins and other resources
- it breaks monkey-patching
- while not best practice, is currently required for eg overriding builtin
TokenAuthorizationMixin
and last (maybe least?)
- it goes against the zen of python