From 282122e07ec238d8f33e5c9d9458a209d01cfe6d Mon Sep 17 00:00:00 2001 From: awaelchli Date: Thu, 3 Nov 2022 11:53:10 +0100 Subject: [PATCH 01/16] Add LightningLite to top level imports --- src/lightning/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lightning/__init__.py b/src/lightning/__init__.py index 62275b02b0fc6..18e2ec4be39f1 100644 --- a/src/lightning/__init__.py +++ b/src/lightning/__init__.py @@ -38,7 +38,8 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: from lightning.pytorch.callbacks import Callback # noqa: E402 from lightning.pytorch.core import LightningDataModule, LightningModule # noqa: E402 from lightning.pytorch.trainer import Trainer # noqa: E402 -from lightning.pytorch.utilities.seed import seed_everything # noqa: E402 +from lightning.lite.utilities.seed import seed_everything # noqa: E402 +from lightning.lite import LightningLite # noqa: E402 import lightning.app # isort: skip # noqa: E402 @@ -56,4 +57,5 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: "Callback", "seed_everything", "storage", + "LightningLite", ] From 44a26c3013a878b999d0dc470f8cabdd50e3a4de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Nov 2022 10:55:23 +0000 Subject: [PATCH 02/16] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lightning/__init__.py b/src/lightning/__init__.py index 18e2ec4be39f1..1dee7754dbf22 100644 --- a/src/lightning/__init__.py +++ b/src/lightning/__init__.py @@ -35,11 +35,11 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: from lightning.app.core.work import LightningWork # noqa: E402 from lightning.app.utilities.packaging.build_config import BuildConfig # noqa: E402 from lightning.app.utilities.packaging.cloud_compute import CloudCompute # noqa: E402 +from lightning.lite import LightningLite # noqa: E402 +from lightning.lite.utilities.seed import seed_everything # noqa: E402 from lightning.pytorch.callbacks import Callback # noqa: E402 from lightning.pytorch.core import LightningDataModule, LightningModule # noqa: E402 from lightning.pytorch.trainer import Trainer # noqa: E402 -from lightning.lite.utilities.seed import seed_everything # noqa: E402 -from lightning.lite import LightningLite # noqa: E402 import lightning.app # isort: skip # noqa: E402 From 60f20ee441d881eb9794a55601d7f55ebb615721 Mon Sep 17 00:00:00 2001 From: awaelchli Date: Thu, 3 Nov 2022 13:43:40 +0100 Subject: [PATCH 03/16] debug --- src/lightning/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lightning/__init__.py b/src/lightning/__init__.py index 1dee7754dbf22..2a26dcd797bda 100644 --- a/src/lightning/__init__.py +++ b/src/lightning/__init__.py @@ -36,7 +36,7 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: from lightning.app.utilities.packaging.build_config import BuildConfig # noqa: E402 from lightning.app.utilities.packaging.cloud_compute import CloudCompute # noqa: E402 from lightning.lite import LightningLite # noqa: E402 -from lightning.lite.utilities.seed import seed_everything # noqa: E402 +from lightning.pytorch.utilities.seed import seed_everything # noqa: E402 from lightning.pytorch.callbacks import Callback # noqa: E402 from lightning.pytorch.core import LightningDataModule, LightningModule # noqa: E402 from lightning.pytorch.trainer import Trainer # noqa: E402 From 2e6ea4f1a4661926de1dff74b66eb63d7311b594 Mon Sep 17 00:00:00 2001 From: awaelchli Date: Thu, 3 Nov 2022 13:44:23 +0100 Subject: [PATCH 04/16] debug --- src/lightning/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lightning/__init__.py b/src/lightning/__init__.py index 2a26dcd797bda..185c7afcedb69 100644 --- a/src/lightning/__init__.py +++ b/src/lightning/__init__.py @@ -35,7 +35,7 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: from lightning.app.core.work import LightningWork # noqa: E402 from lightning.app.utilities.packaging.build_config import BuildConfig # noqa: E402 from lightning.app.utilities.packaging.cloud_compute import CloudCompute # noqa: E402 -from lightning.lite import LightningLite # noqa: E402 +from lightning.lite.lite import LightningLite # noqa: E402 from lightning.pytorch.utilities.seed import seed_everything # noqa: E402 from lightning.pytorch.callbacks import Callback # noqa: E402 from lightning.pytorch.core import LightningDataModule, LightningModule # noqa: E402 From 717258b424218fdbaec822af46bca0ea0d7e39b6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Nov 2022 12:50:22 +0000 Subject: [PATCH 05/16] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lightning/__init__.py b/src/lightning/__init__.py index 185c7afcedb69..6311936e4bd00 100644 --- a/src/lightning/__init__.py +++ b/src/lightning/__init__.py @@ -36,10 +36,10 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: from lightning.app.utilities.packaging.build_config import BuildConfig # noqa: E402 from lightning.app.utilities.packaging.cloud_compute import CloudCompute # noqa: E402 from lightning.lite.lite import LightningLite # noqa: E402 -from lightning.pytorch.utilities.seed import seed_everything # noqa: E402 from lightning.pytorch.callbacks import Callback # noqa: E402 from lightning.pytorch.core import LightningDataModule, LightningModule # noqa: E402 from lightning.pytorch.trainer import Trainer # noqa: E402 +from lightning.pytorch.utilities.seed import seed_everything # noqa: E402 import lightning.app # isort: skip # noqa: E402 From bc11d31ba576f17bf5eadcdc68da0ce34ffdea4d Mon Sep 17 00:00:00 2001 From: awaelchli Date: Fri, 11 Nov 2022 15:54:42 +0100 Subject: [PATCH 06/16] debug --- src/lightning/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lightning/__init__.py b/src/lightning/__init__.py index 2ee5821a4b11f..95e70a0443fd4 100644 --- a/src/lightning/__init__.py +++ b/src/lightning/__init__.py @@ -43,6 +43,7 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: from lightning.pytorch.utilities.seed import seed_everything # noqa: E402 import lightning.app # isort: skip # noqa: E402 +import lightning.lite # isort: skip # noqa: E402 lightning.app._PROJECT_ROOT = os.path.dirname(lightning.app._PROJECT_ROOT) @@ -60,7 +61,7 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: "LightningModule", "Callback", "seed_everything", - "storage", "LightningLite", + "storage", "pdb", ] From 7bdb62561394fc0f3c73a05b611856d3a9f47400 Mon Sep 17 00:00:00 2001 From: awaelchli Date: Fri, 11 Nov 2022 16:03:34 +0100 Subject: [PATCH 07/16] debug --- src/lightning_lite/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lightning_lite/__init__.py b/src/lightning_lite/__init__.py index 7274adde0b9b3..6194998cc154c 100644 --- a/src/lightning_lite/__init__.py +++ b/src/lightning_lite/__init__.py @@ -25,5 +25,10 @@ __all__ = ["LightningLite", "seed_everything"] +__package_name__ = "lightning_lite".split(".")[0] + +_PACKAGE_ROOT = os.path.dirname(__file__) +_PROJECT_ROOT = os.path.dirname(os.path.dirname(_PACKAGE_ROOT)) + # for compatibility with namespace packages __import__("pkg_resources").declare_namespace(__name__) From 940c77e93f8515372eb5d76531a3a4d0089fa0c2 Mon Sep 17 00:00:00 2001 From: awaelchli Date: Fri, 11 Nov 2022 16:17:54 +0100 Subject: [PATCH 08/16] delete --- .github/workflows/ci-pkg-install.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index b1fad271779fc..c503e5b433d6b 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -64,5 +64,6 @@ jobs: - name: DocTest package run: | + find . -name \*.pyc -delete PKG_NAME=$(python -c "print({'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning'}['${{matrix.pkg-name}}'])") python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**" From 9721318ebe64b2a355dcc6a785f68e5d4ad4e04e Mon Sep 17 00:00:00 2001 From: awaelchli Date: Fri, 11 Nov 2022 16:21:25 +0100 Subject: [PATCH 09/16] try --- .github/workflows/ci-pkg-install.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index c503e5b433d6b..76860840d0c70 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -67,3 +67,5 @@ jobs: find . -name \*.pyc -delete PKG_NAME=$(python -c "print({'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning'}['${{matrix.pkg-name}}'])") python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**" + env: + PY_IGNORE_IMPORTMISMATCH=1 # needed for Python 3.7 From 55b642565f8fb11f1544b277d318bf893e01d5ac Mon Sep 17 00:00:00 2001 From: awaelchli Date: Fri, 11 Nov 2022 16:23:05 +0100 Subject: [PATCH 10/16] fix --- .github/workflows/ci-pkg-install.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index 76860840d0c70..c6bb7757484a8 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -63,9 +63,8 @@ jobs: run: python -m lightning --version - name: DocTest package + env: + PY_IGNORE_IMPORTMISMATCH: 1 # needed for Python 3.7 run: | - find . -name \*.pyc -delete PKG_NAME=$(python -c "print({'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning'}['${{matrix.pkg-name}}'])") python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**" - env: - PY_IGNORE_IMPORTMISMATCH=1 # needed for Python 3.7 From 3ff2a5adf92ce28d16dd693cc3dd5bc4a2367fb2 Mon Sep 17 00:00:00 2001 From: awaelchli Date: Fri, 11 Nov 2022 16:28:56 +0100 Subject: [PATCH 11/16] revert --- src/lightning_lite/__init__.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/lightning_lite/__init__.py b/src/lightning_lite/__init__.py index 6194998cc154c..7274adde0b9b3 100644 --- a/src/lightning_lite/__init__.py +++ b/src/lightning_lite/__init__.py @@ -25,10 +25,5 @@ __all__ = ["LightningLite", "seed_everything"] -__package_name__ = "lightning_lite".split(".")[0] - -_PACKAGE_ROOT = os.path.dirname(__file__) -_PROJECT_ROOT = os.path.dirname(os.path.dirname(_PACKAGE_ROOT)) - # for compatibility with namespace packages __import__("pkg_resources").declare_namespace(__name__) From 722b3b1c8a26f2f5e89ac7c28c6a05030031d0ec Mon Sep 17 00:00:00 2001 From: awaelchli Date: Fri, 11 Nov 2022 16:29:41 +0100 Subject: [PATCH 12/16] revert --- src/lightning/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lightning/__init__.py b/src/lightning/__init__.py index 95e70a0443fd4..2755ce57e48b3 100644 --- a/src/lightning/__init__.py +++ b/src/lightning/__init__.py @@ -43,7 +43,6 @@ def _detail(self: Any, message: str, *args: Any, **kwargs: Any) -> None: from lightning.pytorch.utilities.seed import seed_everything # noqa: E402 import lightning.app # isort: skip # noqa: E402 -import lightning.lite # isort: skip # noqa: E402 lightning.app._PROJECT_ROOT = os.path.dirname(lightning.app._PROJECT_ROOT) From 18a4db87d36ac597353a82cf261a0b8593614655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Fri, 11 Nov 2022 10:39:54 -0500 Subject: [PATCH 13/16] Update .github/workflows/ci-pkg-install.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Carlos MocholĂ­ --- .github/workflows/ci-pkg-install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index c6bb7757484a8..560e3c688bc53 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -64,7 +64,7 @@ jobs: - name: DocTest package env: - PY_IGNORE_IMPORTMISMATCH: 1 # needed for Python 3.7 + PY_IGNORE_IMPORTMISMATCH: ${{ matrix.python-version == "3.7" }} run: | PKG_NAME=$(python -c "print({'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning'}['${{matrix.pkg-name}}'])") python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**" From f36c15ddd610753f61a3cb0e8b2c9799eee69ab1 Mon Sep 17 00:00:00 2001 From: awaelchli Date: Sat, 12 Nov 2022 01:51:36 +0100 Subject: [PATCH 14/16] use single quotes --- .github/workflows/ci-pkg-install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index 560e3c688bc53..e8c9de0602927 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -64,7 +64,7 @@ jobs: - name: DocTest package env: - PY_IGNORE_IMPORTMISMATCH: ${{ matrix.python-version == "3.7" }} + PY_IGNORE_IMPORTMISMATCH: ${{ matrix.python-version == '3.7' }} run: | PKG_NAME=$(python -c "print({'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning'}['${{matrix.pkg-name}}'])") python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**" From 7249f9b82e8bbbfbeb20698bb82b992532056200 Mon Sep 17 00:00:00 2001 From: awaelchli Date: Sat, 12 Nov 2022 02:04:02 +0100 Subject: [PATCH 15/16] the conditional did not work --- .github/workflows/ci-pkg-install.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index 29c459906a073..584c729e622bf 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -61,9 +61,11 @@ jobs: if: ${{ matrix.pkg-name == 'lightning' }} run: python -m lightning --version + - name: Ignore import mismatch on Python 3.7 + if: ${{ matrix.python-version == '3.7' }} + run: export PY_IGNORE_IMPORTMISMATCH=1 + - name: DocTest package - env: - PY_IGNORE_IMPORTMISMATCH: ${{ matrix.python-version == '3.7' }} run: | PKG_NAME=$(python -c "print({'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning'}['${{matrix.pkg-name}}'])") python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**" From d7f8f0a69a8f487c5db57a7abc847150be619dd5 Mon Sep 17 00:00:00 2001 From: awaelchli Date: Sat, 12 Nov 2022 02:14:54 +0100 Subject: [PATCH 16/16] it does not work! --- .github/workflows/ci-pkg-install.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-pkg-install.yml b/.github/workflows/ci-pkg-install.yml index 584c729e622bf..3a7313690ce9d 100644 --- a/.github/workflows/ci-pkg-install.yml +++ b/.github/workflows/ci-pkg-install.yml @@ -61,11 +61,9 @@ jobs: if: ${{ matrix.pkg-name == 'lightning' }} run: python -m lightning --version - - name: Ignore import mismatch on Python 3.7 - if: ${{ matrix.python-version == '3.7' }} - run: export PY_IGNORE_IMPORTMISMATCH=1 - - name: DocTest package + env: + PY_IGNORE_IMPORTMISMATCH: 1 run: | PKG_NAME=$(python -c "print({'app': 'lightning_app', 'lite': 'lightning_lite', 'pytorch': 'pytorch_lightning', 'lightning': 'lightning'}['${{matrix.pkg-name}}'])") python -m pytest src/${PKG_NAME} --ignore-glob="**/cli/*-template/**"