lightning-app


Namelightning-app JSON
Version 2.3.2 PyPI version JSON
download
home_pagehttps://github.com/Lightning-AI/lightning
SummaryUse Lightning Apps to build everything from production-ready, multi-cloud ML systems to simple research demos.
upload_time2024-07-02 20:54:12
maintainerNone
docs_urlNone
authorLightning-AI et al.
requires_python>=3.8
licenseApache-2.0
keywords deep learning pytorch ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">

<img src="https://pl-flash-data.s3.amazonaws.com/brandmark.png" width="400px">

**With Lightning Apps, you build exactly what you need: from production-ready, multi-cloud ML systems to simple research demos.**

______________________________________________________________________

<p align="center">
  <a href="https://lightning.ai/">Website</a> •
  <a href="https://lightning.ai/lightning-docs">Docs</a> •
  <a href="#getting-started">Getting started</a> •
  <a href="#asking-for-help">Help</a> •
  <a href="https://www.pytorchlightning.ai/community">Slack</a>
</p>

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/lightning_app)](https://pypi.org/project/lightning_app/)
[![PyPI Status](https://badge.fury.io/py/lightning_app.svg)](https://badge.fury.io/py/lightning_app)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/lightning-app)](https://pepy.tech/project/lightning-app)
[![Conda](https://img.shields.io/conda/v/conda-forge/lightning_app?label=conda&color=success)](https://anaconda.org/conda-forge/lightning_app)

![readme-gif](https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/lightning-gif-888777nslpiijdbcvctyvwhe.gif)

</div>

## From production-ready, multi-cloud ML systems to simple research demos.

Lightning Apps enable researchers, data scientists, and software engineers to build, share and iterate on highly scalable, complex AI workflows using the tools and technologies of their choice without any of the cloud boilerplate.

With Lightning Apps, your favorite components can work together on any machine at any scale.

# Getting started

## Install Lightning

<details>

<summary>Prerequisites</summary>

> TIP: We strongly recommend creating a virtual environment first.
> Don’t know what this is? Follow our [beginner guide here](https://lightning.ai/docs/stable/install/installation.html).

- Python 3.8.x or later (3.8.x, 3.9.x, 3.10.x, ...)
- Git
- Set up an alias for python=python3
- Add the root folder of Lightning to the Environment Variables to PATH
- (quick-start app requirement) Install Z shell (zsh)

</details>

```bash
pip install -U lightning
```

## Run your first Lightning App

1. Install a simple training and deployment app by typing:

```bash
lightning install app lightning/quick-start
```

2. If everything was successful, move into the new directory:

```bash
cd lightning-quick-start
```

3. Run the app locally

```bash
lightning run app app.py
```

4. Alternatively, run it on the public Lightning Cloud to share your app!

```bash
lightning run app app.py --cloud
```

[Read this guide](https://lightning.ai/docs/stable/levels/basic/) to learn the basics of Lightning Apps in 15 minutes.

# Features

Lightning Apps consist of a root [LightningFlow](https://lightning.ai/docs/stable/glossary/app_tree.html) component, that optionally contains a tree of 2 types of components: [LightningFlow](https://lightning.ai/lightning-docs/core_api/lightning_flow.html) 🌊 and [LightningWork](https://lightning.ai/lightning-docs/core_api/lightning_work/) ⚒️. Key functionality includes:

- A shared state between components.
- A constantly running event loop for reactivity.
- Dynamic attachment of components at runtime.
- Start and stop functionality of your works.

Lightning Apps can run [locally](https://lightning.ai/lightning-docs/workflows/run_on_private_cloud.html) 💻 or [on the cloud](https://lightning.ai/lightning-docs/core_api/lightning_work/compute.html) 🌩️.

Easy communication 🛰️ between components is supported with:

- [Directional state updates](https://lightning.ai/lightning-docs/core_api/lightning_app/communication.html?highlight=directional%20state) from the Works to the Flow creating an event: When creating interactive apps, you will likely want your components to share information with each other. You might to rely on that information to control their execution, share progress in the UI, trigger a sequence of operations, or more.
- [Storage](https://lightning.ai/lightning-docs/api_reference/storage.html): The Lightning Storage system makes it easy to share files between LightningWork so you can run your app both locally and in the cloud without changing the code.
  - [Path](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.storage.path.Path.html#lightning_app.storage.path.Path): The Path object is a reference to a specific file or directory from a LightningWork and can be used to transfer those files to another LightningWork (one way, from source to destination).
  - [Payload](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.storage.payload.Payload.html#lightning_app.storage.payload.Payload): The Payload object enables transferring of Python objects from one work to another in a similar fashion as Path.
  - [Drive](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.storage.drive.Drive.html#lightning_app.storage.drive.Drive): The Drive object provides a central place for your components to share data. The drive acts as an isolated folder and any component can access it by knowing its name.

Lightning Apps have built-in support for [adding UIs](https://lightning.ai/lightning-docs/workflows/add_web_ui/) 🎨:

- [StaticWebFrontEnd](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.frontend.web.StaticWebFrontend.html#lightning_app.frontend.web.StaticWebFrontend): A frontend that serves static files from a directory using FastAPI.
- [StreamlitFrontend](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.frontend.stream_lit.StreamlitFrontend.html#lightning_app.frontend.stream_lit.StreamlitFrontend): A frontend for wrapping Streamlit code in your LightingFlow.
- [ServeGradio](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.components.serve.gradio_server.ServeGradio.html#servegradio): This class enables you to quickly create a `gradio` based UI for your Lightning App.

[Scheduling](https://lightning.ai/lightning-docs/glossary/scheduling.html) ⏲️: The Lightning Scheduling system makes it easy to schedule your components execution with any arbitrary conditions.

Advanced users who need full control over the environment a LightningWork runs in can [specify a custom Docker image](https://lightning.ai/lightning-docs/glossary/build_config/build_config_advanced.html?highlight=docker) 🐋 that will be deployed in the cloud.

[Environment variables](https://lightning.ai/lightning-docs/glossary/environment_variables.html?highlight=environment%20variables) 💬: If your app is using secrets or values, such as API keys or access tokens, use environment variables to avoid sticking them in the source code.

Ready to use [built-in components](https://lightning.ai/lightning-docs/api_reference/components.html?highlight=built%20components) 🧱:

- [PopenPythonScript](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.components.python.popen.PopenPythonScript.html#lightning_app.components.python.popen.PopenPythonScript): This class enables you to easily run a Python Script.
- [ModelInferenceAPI](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.components.serve.serve.ModelInferenceAPI.html#lightning_app.components.serve.serve.ModelInferenceAPI): This class enables you to easily get your model served.

# App gallery

The [Lightning AI website](https://lightning.ai/) features a curated gallery of Lightning Apps and components that makes it easy to get started. A few highlights:

| App                            | Description                                                                                                                                                                                                  |
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Train & Demo PyTorch Lightning | Train a model using PyTorch Lightning and deploy it to an interactive demo. Use this Lightning App as a starting point for building more complex apps around your models.                                    |
| Lightning Sweeper              | Run a hyperparameter sweep over any model script across hundreds of cloud machines at once. This Lightning App uses Optuna to provide advanced tuning algorithms (from grid and random search to Hyperband). |
| Flashy                         | Flashy, the auto-AI Lightning App, selects the best deep learning model for your image or text datasets. It automatically uses state-of-the-art models from Torchision, TIMM and Hugging Face.               |

## Current limitations

- Lightning requires Python 3.8.x or later (3.8.x, 3.9.x, 3.10.x).
- For now, you can only run a single app locally at a time.
- You are required to install the Lightning App requirements locally, even when starting the app on the cloud.
- Multiple works cannot share the same machine.
- To run on the cloud, you will need access to a browser.
- Frontends only support the HTTP protocol. TCP support is coming in the future.
- App Flow Frontends cannot be changed after startup, but you the layout can be updated reactively.
- Authentication is not supported.

## Asking for help

If you have any questions please:

1. [Read the docs](https://lightning.ai/lightning-docs/).
1. [Search through existing Discussions](https://github.com/Lightning-ai/lightning/discussions), or [add a new question](https://github.com/Lightning-ai/lightning/discussions/new)
1. [Join our Discord community ](https://discord.gg/VptPCZkGNa).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Lightning-AI/lightning",
    "name": "lightning-app",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "deep learning, pytorch, AI",
    "author": "Lightning-AI et al.",
    "author_email": "name@pytorchlightning.ai",
    "download_url": "https://files.pythonhosted.org/packages/72/53/86fc26bd642900350fdb06ba066a2440da11eefb233b7b9a6f8611c9aa8a/lightning-app-2.3.2.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n<img src=\"https://pl-flash-data.s3.amazonaws.com/brandmark.png\" width=\"400px\">\n\n**With Lightning Apps, you build exactly what you need: from production-ready, multi-cloud ML systems to simple research demos.**\n\n______________________________________________________________________\n\n<p align=\"center\">\n  <a href=\"https://lightning.ai/\">Website</a> \u2022\n  <a href=\"https://lightning.ai/lightning-docs\">Docs</a> \u2022\n  <a href=\"#getting-started\">Getting started</a> \u2022\n  <a href=\"#asking-for-help\">Help</a> \u2022\n  <a href=\"https://www.pytorchlightning.ai/community\">Slack</a>\n</p>\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/lightning_app)](https://pypi.org/project/lightning_app/)\n[![PyPI Status](https://badge.fury.io/py/lightning_app.svg)](https://badge.fury.io/py/lightning_app)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/lightning-app)](https://pepy.tech/project/lightning-app)\n[![Conda](https://img.shields.io/conda/v/conda-forge/lightning_app?label=conda&color=success)](https://anaconda.org/conda-forge/lightning_app)\n\n![readme-gif](https://pl-bolts-doc-images.s3.us-east-2.amazonaws.com/lightning-gif-888777nslpiijdbcvctyvwhe.gif)\n\n</div>\n\n## From production-ready, multi-cloud ML systems to simple research demos.\n\nLightning Apps enable researchers, data scientists, and software engineers to build, share and iterate on highly scalable, complex AI workflows using the tools and technologies of their choice without any of the cloud boilerplate.\n\nWith Lightning Apps, your favorite components can work together on any machine at any scale.\n\n# Getting started\n\n## Install Lightning\n\n<details>\n\n<summary>Prerequisites</summary>\n\n> TIP: We strongly recommend creating a virtual environment first.\n> Don\u2019t know what this is? Follow our [beginner guide here](https://lightning.ai/docs/stable/install/installation.html).\n\n- Python 3.8.x or later (3.8.x, 3.9.x, 3.10.x, ...)\n- Git\n- Set up an alias for python=python3\n- Add the root folder of Lightning to the Environment Variables to PATH\n- (quick-start app requirement) Install Z shell (zsh)\n\n</details>\n\n```bash\npip install -U lightning\n```\n\n## Run your first Lightning App\n\n1. Install a simple training and deployment app by typing:\n\n```bash\nlightning install app lightning/quick-start\n```\n\n2. If everything was successful, move into the new directory:\n\n```bash\ncd lightning-quick-start\n```\n\n3. Run the app locally\n\n```bash\nlightning run app app.py\n```\n\n4. Alternatively, run it on the public Lightning Cloud to share your app!\n\n```bash\nlightning run app app.py --cloud\n```\n\n[Read this guide](https://lightning.ai/docs/stable/levels/basic/) to learn the basics of Lightning Apps in 15 minutes.\n\n# Features\n\nLightning Apps consist of a root [LightningFlow](https://lightning.ai/docs/stable/glossary/app_tree.html) component, that optionally contains a tree of 2 types of components: [LightningFlow](https://lightning.ai/lightning-docs/core_api/lightning_flow.html) \ud83c\udf0a and [LightningWork](https://lightning.ai/lightning-docs/core_api/lightning_work/) \u2692\ufe0f. Key functionality includes:\n\n- A shared state between components.\n- A constantly running event loop for reactivity.\n- Dynamic attachment of components at runtime.\n- Start and stop functionality of your works.\n\nLightning Apps can run [locally](https://lightning.ai/lightning-docs/workflows/run_on_private_cloud.html) \ud83d\udcbb or [on the cloud](https://lightning.ai/lightning-docs/core_api/lightning_work/compute.html) \ud83c\udf29\ufe0f.\n\nEasy communication \ud83d\udef0\ufe0f between components is supported with:\n\n- [Directional state updates](https://lightning.ai/lightning-docs/core_api/lightning_app/communication.html?highlight=directional%20state) from the Works to the Flow creating an event: When creating interactive apps, you will likely want your components to share information with each other. You might to rely on that information to control their execution, share progress in the UI, trigger a sequence of operations, or more.\n- [Storage](https://lightning.ai/lightning-docs/api_reference/storage.html): The Lightning Storage system makes it easy to share files between LightningWork so you can run your app both locally and in the cloud without changing the code.\n  - [Path](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.storage.path.Path.html#lightning_app.storage.path.Path): The Path object is a reference to a specific file or directory from a LightningWork and can be used to transfer those files to another LightningWork (one way, from source to destination).\n  - [Payload](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.storage.payload.Payload.html#lightning_app.storage.payload.Payload): The Payload object enables transferring of Python objects from one work to another in a similar fashion as Path.\n  - [Drive](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.storage.drive.Drive.html#lightning_app.storage.drive.Drive): The Drive object provides a central place for your components to share data. The drive acts as an isolated folder and any component can access it by knowing its name.\n\nLightning Apps have built-in support for [adding UIs](https://lightning.ai/lightning-docs/workflows/add_web_ui/) \ud83c\udfa8:\n\n- [StaticWebFrontEnd](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.frontend.web.StaticWebFrontend.html#lightning_app.frontend.web.StaticWebFrontend): A frontend that serves static files from a directory using FastAPI.\n- [StreamlitFrontend](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.frontend.stream_lit.StreamlitFrontend.html#lightning_app.frontend.stream_lit.StreamlitFrontend): A frontend for wrapping Streamlit code in your LightingFlow.\n- [ServeGradio](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.components.serve.gradio_server.ServeGradio.html#servegradio): This class enables you to quickly create a `gradio` based UI for your Lightning App.\n\n[Scheduling](https://lightning.ai/lightning-docs/glossary/scheduling.html) \u23f2\ufe0f: The Lightning Scheduling system makes it easy to schedule your components execution with any arbitrary conditions.\n\nAdvanced users who need full control over the environment a LightningWork runs in can [specify a custom Docker image](https://lightning.ai/lightning-docs/glossary/build_config/build_config_advanced.html?highlight=docker) \ud83d\udc0b that will be deployed in the cloud.\n\n[Environment variables](https://lightning.ai/lightning-docs/glossary/environment_variables.html?highlight=environment%20variables) \ud83d\udcac: If your app is using secrets or values, such as API keys or access tokens, use environment variables to avoid sticking them in the source code.\n\nReady to use [built-in components](https://lightning.ai/lightning-docs/api_reference/components.html?highlight=built%20components) \ud83e\uddf1:\n\n- [PopenPythonScript](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.components.python.popen.PopenPythonScript.html#lightning_app.components.python.popen.PopenPythonScript): This class enables you to easily run a Python Script.\n- [ModelInferenceAPI](https://lightning.ai/docs/app/stable/api_reference/generated/lightning.app.components.serve.serve.ModelInferenceAPI.html#lightning_app.components.serve.serve.ModelInferenceAPI): This class enables you to easily get your model served.\n\n# App gallery\n\nThe [Lightning AI website](https://lightning.ai/) features a curated gallery of Lightning Apps and components that makes it easy to get started. A few highlights:\n\n| App                            | Description                                                                                                                                                                                                  |\n| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| Train & Demo PyTorch Lightning | Train a model using PyTorch Lightning and deploy it to an interactive demo. Use this Lightning App as a starting point for building more complex apps around your models.                                    |\n| Lightning Sweeper              | Run a hyperparameter sweep over any model script across hundreds of cloud machines at once. This Lightning App uses Optuna to provide advanced tuning algorithms (from grid and random search to Hyperband). |\n| Flashy                         | Flashy, the auto-AI Lightning App, selects the best deep learning model for your image or text datasets. It automatically uses state-of-the-art models from Torchision, TIMM and Hugging Face.               |\n\n## Current limitations\n\n- Lightning requires Python 3.8.x or later (3.8.x, 3.9.x, 3.10.x).\n- For now, you can only run a single app locally at a time.\n- You are required to install the Lightning App requirements locally, even when starting the app on the cloud.\n- Multiple works cannot share the same machine.\n- To run on the cloud, you will need access to a browser.\n- Frontends only support the HTTP protocol. TCP support is coming in the future.\n- App Flow Frontends cannot be changed after startup, but you the layout can be updated reactively.\n- Authentication is not supported.\n\n## Asking for help\n\nIf you have any questions please:\n\n1. [Read the docs](https://lightning.ai/lightning-docs/).\n1. [Search through existing Discussions](https://github.com/Lightning-ai/lightning/discussions), or [add a new question](https://github.com/Lightning-ai/lightning/discussions/new)\n1. [Join our Discord community ](https://discord.gg/VptPCZkGNa).\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Use Lightning Apps to build everything from production-ready, multi-cloud ML systems to simple research demos.",
    "version": "2.3.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/Lightning-AI/lightning/issues",
        "Documentation": "https://lightning.ai/lightning-docs",
        "Download": "https://github.com/Lightning-AI/lightning",
        "Homepage": "https://github.com/Lightning-AI/lightning",
        "Source Code": "https://github.com/Lightning-AI/lightning"
    },
    "split_keywords": [
        "deep learning",
        " pytorch",
        " ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9b0f47826b657217d641cabffd36877f92ebc436ca027d3de634b05830d48b1e",
                "md5": "bcb3dd3205a1065d4490e5a3da85506a",
                "sha256": "1f01bb8ca075656993e36bb9c44d69c7d46db5f7ad6b5ebebe31a81afce05443"
            },
            "downloads": -1,
            "filename": "lightning_app-2.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bcb3dd3205a1065d4490e5a3da85506a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 1204614,
            "upload_time": "2024-07-02T20:54:08",
            "upload_time_iso_8601": "2024-07-02T20:54:08.694225Z",
            "url": "https://files.pythonhosted.org/packages/9b/0f/47826b657217d641cabffd36877f92ebc436ca027d3de634b05830d48b1e/lightning_app-2.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "725386fc26bd642900350fdb06ba066a2440da11eefb233b7b9a6f8611c9aa8a",
                "md5": "9fdd8f7c002452356ade24ccf3482044",
                "sha256": "6275e91e8d1698f03ad5b319d8b417bd7d694019d6bae6183cfd3cefabd4e52d"
            },
            "downloads": -1,
            "filename": "lightning-app-2.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "9fdd8f7c002452356ade24ccf3482044",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1095061,
            "upload_time": "2024-07-02T20:54:12",
            "upload_time_iso_8601": "2024-07-02T20:54:12.002279Z",
            "url": "https://files.pythonhosted.org/packages/72/53/86fc26bd642900350fdb06ba066a2440da11eefb233b7b9a6f8611c9aa8a/lightning-app-2.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-02 20:54:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Lightning-AI",
    "github_project": "lightning",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "lightning-app"
}
        
Elapsed time: 0.23942s