-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable import
lightning.app
if it is installed (#20059)
- Loading branch information
Showing
7 changed files
with
87 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Package extras | ||
|
||
# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows | ||
on: | ||
push: | ||
branches: [master, "release/*"] | ||
pull_request: | ||
branches: [master, "release/*"] | ||
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped | ||
paths: | ||
- ".github/workflows/ci-pkg-extend.yml" | ||
- "requirements/ci.txt" | ||
- "requirements/app/*" | ||
- "requirements/data/*" | ||
- "src/lightning/app/*" | ||
- "src/lightning/data/*" | ||
- "!*.md" | ||
- "!**/*.md" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} | ||
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
|
||
import-pkg: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: ["ubuntu-22.04", "macOS-12", "windows-2022"] | ||
pkg-name: ["app", "data"] | ||
python-version: ["3.8", "3.11"] | ||
env: | ||
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install package | ||
run: pip install lightning[${{ matrix.pkg-name }}] -f $TORCH_URL | ||
timeout-minutes: 10 | ||
|
||
- name: Try importing | ||
run: from lightning.${{ matrix.pkg-name }} import * | ||
shell: python | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# NOTE: this is here only to expose `pip install lightning[app]`. we don't install or test it in this project's CI | ||
|
||
lightning_app >= 2.3.3, <2.3.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import sys | ||
|
||
from lightning_utilities.core.imports import RequirementCache, module_available | ||
|
||
__all__ = [] | ||
|
||
if not RequirementCache("lightning_app"): | ||
raise ModuleNotFoundError("Please, run `pip install lightning-app`") # E111 | ||
|
||
else: | ||
import lightning_app | ||
|
||
# Enable resolution at least for lower data namespace | ||
sys.modules["lightning.app"] = lightning_app | ||
|
||
from lightning_app.core.app import LightningApp # noqa: E402 | ||
from lightning_app.core.flow import LightningFlow # noqa: E402 | ||
from lightning_app.core.work import LightningWork # noqa: E402 | ||
from lightning_app.plugin.plugin import LightningPlugin # noqa: E402 | ||
from lightning_app.utilities.packaging.build_config import BuildConfig # noqa: E402 | ||
from lightning_app.utilities.packaging.cloud_compute import CloudCompute # noqa: E402 | ||
|
||
if module_available("lightning_app.components.demo"): | ||
from lightning.app.components import demo # noqa: F401 | ||
|
||
__all__ = ["LightningApp", "LightningFlow", "LightningWork", "LightningPlugin", "BuildConfig", "CloudCompute"] |