# Lightning Utilities
[](https://badge.fury.io/py/lightning-utilities)
[](https://github.com/Lightning-AI/utilities/blob/main/LICENSE)
[](https://pepy.tech/project/lightning-utilities)
[](https://pypi.org/project/lightning-utilities/)
[](https://github.com/Lightning-AI/utilities/actions/workflows/ci-testing.yml)
[](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yaml)
[](https://lit-utilities.readthedocs.io/en/latest/?badge=latest)
[](https://results.pre-commit.ci/latest/github/Lightning-AI/utilities/main)
__This repository covers the following use-cases:__
1. _Reusable GitHub workflows_
2. _Shared GitHub actions_
3. _General Python utilities in `lightning_utilities.core`_
4. _CLI `python -m lightning_utilities.cli --help`_
## 1. Reusable workflows
__Usage:__
```yaml
name: Check schema
on: [push]
jobs:
check-schema:
uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@v0.5.0
with:
azure-dir: "" # skip Azure check
check-code:
uses: Lightning-AI/utilities/.github/workflows/check-code.yml@main
with:
actions-ref: main # normally you shall use the same version as the workflow
```
See usage of other workflows in [.github/workflows/ci-use-checks.yaml](https://github.com/Lightning-AI/utilities/tree/main/.github/workflows/ci-use-checks.yaml).
## 2. Reusable composite actions
See available composite actions [.github/actions/](https://github.com/Lightning-AI/utilities/tree/main/.github/actions).
__Usage:__
```yaml
name: Do something with cache
on: [push]
jobs:
pytest:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: Lightning-AI/utilities/.github/actions/cache
with:
python-version: 3.9
requires: oldest # or latest
```
## 3. General Python utilities `lightning_utilities.core`
<details>
<summary>Installation</summary>
From source:
```bash
pip install https://github.com/Lightning-AI/utilities/archive/refs/heads/main.zip
```
From pypi:
```bash
pip install lightning_utilities
```
</details>
__Usage:__
Example for optional imports:
```python
from lightning_utilities.core.imports import module_available
if module_available("some_package.something"):
from some_package import something
```
## 4. CLI `lightning_utilities.cli`
The package provides common CLI commands.
<details>
<summary>Installation</summary>
From pypi:
```bash
pip install lightning_utilities[cli]
```
</details>
__Usage:__
```bash
python -m lightning_utilities.cli [group] [command]
```
<details>
<summary>Example for setting min versions</summary>
```console
$ cat requirements/test.txt
coverage>=5.0
codecov>=2.1
pytest>=6.0
pytest-cov
pytest-timeout
$ python -m lightning_utilities.cli requirements set-oldest
$ cat requirements/test.txt
coverage==5.0
codecov==2.1
pytest==6.0
pytest-cov
pytest-timeout
```
</details>
Raw data
{
"_id": null,
"home_page": "https://github.com/Lightning-AI/utilities",
"name": "lightning-utilities",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "Utilities, DevOps, CI/CD",
"author": "Lightning AI et al.",
"author_email": "developer@lightning.ai",
"download_url": "https://files.pythonhosted.org/packages/09/2a/3f347a83b61449ea204505fcbe3885ec17ea406c5ac34687631c0caff01f/lightning_utilities-0.15.0.tar.gz",
"platform": null,
"description": "# Lightning Utilities\n\n[](https://badge.fury.io/py/lightning-utilities)\n[](https://github.com/Lightning-AI/utilities/blob/main/LICENSE)\n[](https://pepy.tech/project/lightning-utilities)\n[](https://pypi.org/project/lightning-utilities/)\n\n[](https://github.com/Lightning-AI/utilities/actions/workflows/ci-testing.yml)\n[](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yaml)\n[](https://lit-utilities.readthedocs.io/en/latest/?badge=latest)\n[](https://results.pre-commit.ci/latest/github/Lightning-AI/utilities/main)\n\n__This repository covers the following use-cases:__\n\n1. _Reusable GitHub workflows_\n2. _Shared GitHub actions_\n3. _General Python utilities in `lightning_utilities.core`_\n4. _CLI `python -m lightning_utilities.cli --help`_\n\n## 1. Reusable workflows\n\n__Usage:__\n\n```yaml\nname: Check schema\n\non: [push]\n\njobs:\n\n check-schema:\n uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@v0.5.0\n with:\n azure-dir: \"\" # skip Azure check\n\n check-code:\n uses: Lightning-AI/utilities/.github/workflows/check-code.yml@main\n with:\n actions-ref: main # normally you shall use the same version as the workflow\n```\n\nSee usage of other workflows in [.github/workflows/ci-use-checks.yaml](https://github.com/Lightning-AI/utilities/tree/main/.github/workflows/ci-use-checks.yaml).\n\n## 2. Reusable composite actions\n\nSee available composite actions [.github/actions/](https://github.com/Lightning-AI/utilities/tree/main/.github/actions).\n\n__Usage:__\n\n```yaml\nname: Do something with cache\n\non: [push]\n\njobs:\n pytest:\n runs-on: ubuntu-24.04\n steps:\n - uses: actions/checkout@v3\n - uses: actions/setup-python@v4\n with:\n python-version: 3.9\n - uses: Lightning-AI/utilities/.github/actions/cache\n with:\n python-version: 3.9\n requires: oldest # or latest\n```\n\n## 3. General Python utilities `lightning_utilities.core`\n\n<details>\n <summary>Installation</summary>\nFrom source:\n\n```bash\npip install https://github.com/Lightning-AI/utilities/archive/refs/heads/main.zip\n```\n\nFrom pypi:\n\n```bash\npip install lightning_utilities\n```\n\n</details>\n\n__Usage:__\n\nExample for optional imports:\n\n```python\nfrom lightning_utilities.core.imports import module_available\n\nif module_available(\"some_package.something\"):\n from some_package import something\n```\n\n## 4. CLI `lightning_utilities.cli`\n\nThe package provides common CLI commands.\n\n<details>\n <summary>Installation</summary>\n\nFrom pypi:\n\n```bash\npip install lightning_utilities[cli]\n```\n\n</details>\n\n__Usage:__\n\n```bash\npython -m lightning_utilities.cli [group] [command]\n```\n\n<details>\n <summary>Example for setting min versions</summary>\n\n```console\n$ cat requirements/test.txt\ncoverage>=5.0\ncodecov>=2.1\npytest>=6.0\npytest-cov\npytest-timeout\n$ python -m lightning_utilities.cli requirements set-oldest\n$ cat requirements/test.txt\ncoverage==5.0\ncodecov==2.1\npytest==6.0\npytest-cov\npytest-timeout\n```\n\n</details>\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Lightning toolbox for across the our ecosystem.",
"version": "0.15.0",
"project_urls": {
"Bug Tracker": "https://github.com/Lightning-AI/utilities/issues",
"Documentation": "https://dev-toolbox.rtfd.io/en/latest/",
"Download": "https://github.com/Lightning-AI/utilities",
"Homepage": "https://github.com/Lightning-AI/utilities",
"Source Code": "https://github.com/Lightning-AI/utilities"
},
"split_keywords": [
"utilities",
" devops",
" ci/cd"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d05ed2ddba803d14c17812f132beb1db8a5e6b60273d764694316e0616451972",
"md5": "71a0b202fe9ad5aa5c74b2a0f8424d7b",
"sha256": "652fea9ca0523418fc731e081485744c7cafea2054f5fff12eea1b2d04441b06"
},
"downloads": -1,
"filename": "lightning_utilities-0.15.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "71a0b202fe9ad5aa5c74b2a0f8424d7b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 29427,
"upload_time": "2025-07-26T08:47:35",
"upload_time_iso_8601": "2025-07-26T08:47:35.763823Z",
"url": "https://files.pythonhosted.org/packages/d0/5e/d2ddba803d14c17812f132beb1db8a5e6b60273d764694316e0616451972/lightning_utilities-0.15.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "092a3f347a83b61449ea204505fcbe3885ec17ea406c5ac34687631c0caff01f",
"md5": "4efaa989ecf8558fe0e0790ee59a8099",
"sha256": "3e934ae9c2a77e2f617a4377750e2564d614c391445368d2116a2efe70143ebc"
},
"downloads": -1,
"filename": "lightning_utilities-0.15.0.tar.gz",
"has_sig": false,
"md5_digest": "4efaa989ecf8558fe0e0790ee59a8099",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 31023,
"upload_time": "2025-07-26T08:47:36",
"upload_time_iso_8601": "2025-07-26T08:47:36.942347Z",
"url": "https://files.pythonhosted.org/packages/09/2a/3f347a83b61449ea204505fcbe3885ec17ea406c5ac34687631c0caff01f/lightning_utilities-0.15.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-26 08:47:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Lightning-AI",
"github_project": "utilities",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "lightning-utilities"
}