# Lightning Utilities
[![PyPI Status](https://badge.fury.io/py/lightning-utilities.svg)](https://badge.fury.io/py/lightning-utilities)
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/Lightning-AI/utilities/blob/master/LICENSE)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/lightning-utilities)](https://pepy.tech/project/lightning-utilities)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/lightning-utilities)](https://pypi.org/project/lightning-utilities/)
[![UnitTests](https://github.com/Lightning-AI/utilities/actions/workflows/ci-testing.yml/badge.svg?event=push)](https://github.com/Lightning-AI/utilities/actions/workflows/ci-testing.yml)
[![Apply checks](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yaml/badge.svg?event=push)](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yaml)
[![Docs Status](https://readthedocs.org/projects/lit-utilities/badge/?version=latest)](https://lit-utilities.readthedocs.io/en/latest/?badge=latest)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Lightning-AI/utilities/main.svg)](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-20.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.8",
"maintainer_email": null,
"keywords": "Utilities, DevOps, CI/CD",
"author": "Lightning AI et al.",
"author_email": "pytorch@lightning.ai",
"download_url": "https://files.pythonhosted.org/packages/46/ab/0c421d19e316420a2d54a2da5ae4a4dcd557928ccf7953dbbe4b4eee34d6/lightning_utilities-0.11.8.tar.gz",
"platform": null,
"description": "# Lightning Utilities\n\n[![PyPI Status](https://badge.fury.io/py/lightning-utilities.svg)](https://badge.fury.io/py/lightning-utilities)\n[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/Lightning-AI/utilities/blob/master/LICENSE)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/lightning-utilities)](https://pepy.tech/project/lightning-utilities)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/lightning-utilities)](https://pypi.org/project/lightning-utilities/)\n\n[![UnitTests](https://github.com/Lightning-AI/utilities/actions/workflows/ci-testing.yml/badge.svg?event=push)](https://github.com/Lightning-AI/utilities/actions/workflows/ci-testing.yml)\n[![Apply checks](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yaml/badge.svg?event=push)](https://github.com/Lightning-AI/utilities/actions/workflows/ci-use-checks.yaml)\n[![Docs Status](https://readthedocs.org/projects/lit-utilities/badge/?version=latest)](https://lit-utilities.readthedocs.io/en/latest/?badge=latest)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Lightning-AI/utilities/main.svg)](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-20.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.11.8",
"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": "",
"digests": {
"blake2b_256": "2e5d4c4672025c23a305231a81bf492f65aa3ea0965a89f9ca369a9ee7d47fd9",
"md5": "30653236b0d3459b760844b719aa84ac",
"sha256": "a57edb34a44258f0c61eed8b8b88926766e9052f5e60bbe69e4871a2b2bfd970"
},
"downloads": -1,
"filename": "lightning_utilities-0.11.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "30653236b0d3459b760844b719aa84ac",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 26816,
"upload_time": "2024-10-15T19:55:08",
"upload_time_iso_8601": "2024-10-15T19:55:08.288296Z",
"url": "https://files.pythonhosted.org/packages/2e/5d/4c4672025c23a305231a81bf492f65aa3ea0965a89f9ca369a9ee7d47fd9/lightning_utilities-0.11.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "46ab0c421d19e316420a2d54a2da5ae4a4dcd557928ccf7953dbbe4b4eee34d6",
"md5": "c2f0e5f785cbeeedc5f564e98a745142",
"sha256": "8dfbdc6c52f9847efc948dc462ab8bebb4f4e9a43bd69c82c1b1da484dac20e6"
},
"downloads": -1,
"filename": "lightning_utilities-0.11.8.tar.gz",
"has_sig": false,
"md5_digest": "c2f0e5f785cbeeedc5f564e98a745142",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 28614,
"upload_time": "2024-10-15T19:55:10",
"upload_time_iso_8601": "2024-10-15T19:55:10.405124Z",
"url": "https://files.pythonhosted.org/packages/46/ab/0c421d19e316420a2d54a2da5ae4a4dcd557928ccf7953dbbe4b4eee34d6/lightning_utilities-0.11.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-15 19:55:10",
"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"
}