Open chunyang-wen opened 2 years ago
I am not sure if want to amplify the visibility of these internal tools...
What's internal there? They are supposed to be stable with 1.6 as user-interface for power users...
__all__
does not mean you have to expose everything (You can choose what to expose by yourself). Even you do not want to expose the modules, users can still import them. What I suggest here is to use __all__
to remove the #noqa F401
error or comment.
@chunyang-wen Sounds good to me!
(just for the note) I believe this is technically a breaking change for users importing all names:
from pytorch_lightning.accelerators import *
...
Some things like get_nvidia_gpu_stats are in the gpu accelerator module but not in the GPUAccelerator class definition. Will this break those imports?
Yes, it will break users' code if they use modules automatically imported by python.
from pytorch_lightning.accelerators import *
accelerator.blabla
cpu.blabla
for compability, we can also export the modules at the same time.
from pytorch_lightning.accelerators import accelerator
from pytorch_lightning.accelerators.accelerator import Accelerator
__all__ = ["accelerator", "Accelerator"]
Hi, Can I start working on this issue, this will be my first contribution.
I am not sure if there actually was an agreement to do this
thoughts @Lightning-AI/core-lightning
I am fine with this addition of __all__
in each init
Proposed refactor
We can add
__all__
in__init__.py
file in order to remove F401 error and avoids the module imports.Motivation
Remove annoying 401 error.
Pitch
No error reported by mypy or pre-commit
cc @borda @justusschock @awaelchli @akihironitta @rohitgr7