cosmo: simplifications to `__all__`
If all the other modules manage their __all__ properly then __init__.py files could use wildcard imports and implicit __all__. This is permitted by PEP 8:
There is one defensible use case for a wildcard import, which is to republish an internal interface as part of a public API
I am pointing it out here, but it also applies to other __init__.py files.
Originally posted by @eerovaher in https://github.com/astropy/astropy/pull/18884#discussion_r2524609473
Looking at this more, I'd like to test this with a type checker. I'm confident in __all__, but IDK how importing to public API from a private __init__.py works. If it works well, that'd be very nice.
tl;dr -- Is this just plain refactoring or it changes the user API?
The title of the issue is bad. It's __init__.py files that could be simplified, there should be no changes to any __all__.
No api changes.
Stuff that needs to be fixed:
- https://github.com/astropy/astropy/blob/main/astropy/cosmology/_src/funcs/comparison.py doesn't list
cosmology_equal, but it's in https://github.com/astropy/astropy/blob/main/astropy/cosmology/_src/funcs/init.py.
See main.py in https://play.ty.dev/313a15da-739e-4797-a10b-ae4cace54395 for how imports with a hierarchical structure might be complicated. Needs investigation!
Edit: https://play.ty.dev/313a15da-739e-4797-a10b-ae4cace54395 shows this may work well, with ty at least.