Skip to content

Conversation

littlebullGit
Copy link
Contributor

@littlebullGit littlebullGit commented Jun 11, 2025

What does this PR do?

This PR refactors the [accelerators/init.py]file to use Python's __all__ for explicit exports instead of using # noqa: F401 comments. This change makes the public API more explicit and follows Python best practices.

Key Changes:

  • Added __all__ list at the top of the file to explicitly define exported symbols
  • Removed # noqa: F401 comments from imports
  • Maintained all existing functionality while improving code quality

Motivation:

  • Makes the public API more explicit and self-documenting
  • Follows Python best practices for module exports
  • Improves code maintainability and IDE support
  • Removes linter workarounds

Fixes #11592

Before submitting

  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (not needed)
  • Did you write any new necessary tests? (not needed)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request? (none)
  • Did you update the CHANGELOG? (not needed for this refactor)

Notes:

  • This is a non-breaking change that only affects internal imports
  • No functionality has been changed
  • All existing tests pass with these changes

📚 Documentation preview 📚: https://pytorch-lightning--20889.org.readthedocs.build/en/20889/

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Jun 11, 2025
@Borda Borda merged commit cce06ec into Lightning-AI:master Jun 11, 2025
84 checks passed
Borda pushed a commit that referenced this pull request Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pl Generic label for PyTorch Lightning package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove 401 by use __all__

2 participants