# 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/8c/4d/54d38e237ab437f25f191602373d99b89d1d047ad2a3bb5ad0d84ea5daa6/lightning_utilities-0.11.9.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.9",
"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": "85f31305321a12c984405e26fc64b5d521569e9872fb811f4aace8e168099160",
"md5": "e921f64cd9c21ace608dde96be3f08aa",
"sha256": "ac6d4e9e28faf3ff4be997876750fee10dc604753dbc429bf3848a95c5d7e0d2"
},
"downloads": -1,
"filename": "lightning_utilities-0.11.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e921f64cd9c21ace608dde96be3f08aa",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 28356,
"upload_time": "2024-11-19T17:20:00",
"upload_time_iso_8601": "2024-11-19T17:20:00.746361Z",
"url": "https://files.pythonhosted.org/packages/85/f3/1305321a12c984405e26fc64b5d521569e9872fb811f4aace8e168099160/lightning_utilities-0.11.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8c4d54d38e237ab437f25f191602373d99b89d1d047ad2a3bb5ad0d84ea5daa6",
"md5": "4fddb7cb3f0fed9b660e3fc4c38ebdf2",
"sha256": "f5052b81344cc2684aa9afd74b7ce8819a8f49a858184ec04548a5a109dfd053"
},
"downloads": -1,
"filename": "lightning_utilities-0.11.9.tar.gz",
"has_sig": false,
"md5_digest": "4fddb7cb3f0fed9b660e3fc4c38ebdf2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 29362,
"upload_time": "2024-11-19T17:20:01",
"upload_time_iso_8601": "2024-11-19T17:20:01.723919Z",
"url": "https://files.pythonhosted.org/packages/8c/4d/54d38e237ab437f25f191602373d99b89d1d047ad2a3bb5ad0d84ea5daa6/lightning_utilities-0.11.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-19 17:20:01",
"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"
}