Skip to content

Commit

Permalink
refactor path to root preventing circular import (#18357)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

(cherry picked from commit fbdbe63)
  • Loading branch information
Borda committed Aug 28, 2023
1 parent 028b4f2 commit 743ff99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/lightning/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Root package info."""
import logging
import os

# explicitly don't set root logger's propagation and leave this to subpackages to manage
_logger = logging.getLogger(__name__)
Expand All @@ -27,9 +26,7 @@
from lightning.pytorch.core import LightningDataModule, LightningModule # noqa: E402
from lightning.pytorch.trainer import Trainer # noqa: E402

import lightning.app # isort: skip # noqa: E402

lightning.app._PROJECT_ROOT = os.path.dirname(lightning.app._PROJECT_ROOT)
import lightning.app # isort: skip # noqa: E402 F401


__all__ = [
Expand Down
3 changes: 3 additions & 0 deletions src/lightning/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@

_PACKAGE_ROOT = os.path.dirname(__file__)
_PROJECT_ROOT = os.path.dirname(os.path.dirname(_PACKAGE_ROOT))
if __package_name__ == "lightning":
_PACKAGE_ROOT = os.path.dirname(_PACKAGE_ROOT)
_PROJECT_ROOT = os.path.dirname(_PROJECT_ROOT)

__all__ = ["LightningApp", "LightningFlow", "LightningWork", "LightningPlugin", "BuildConfig", "CloudCompute"]

0 comments on commit 743ff99

Please sign in to comment.