{"id":15022217,"url":"https://github.com/lightning-ai/utilities","last_synced_at":"2026-02-11T10:05:06.153Z","repository":{"id":45802684,"uuid":"486408006","full_name":"Lightning-AI/utilities","owner":"Lightning-AI","description":"Common Python utilities and GitHub Actions in Lightning Ecosystem","archived":false,"fork":false,"pushed_at":"2025-05-12T18:17:09.000Z","size":68276,"stargazers_count":56,"open_issues_count":2,"forks_count":16,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-16T05:07:00.423Z","etag":null,"topics":["ci-cd","developer-tools","github-actions"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lightning-AI.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-04-28T01:39:16.000Z","updated_at":"2025-05-12T18:16:16.000Z","dependencies_parsed_at":"2023-02-14T03:16:25.119Z","dependency_job_id":"938550ae-1dd3-45ca-aeac-6feed18723e0","html_url":"https://github.com/Lightning-AI/utilities","commit_stats":{"total_commits":316,"total_committers":22,"mean_commits":"14.363636363636363","dds":0.7215189873417722,"last_synced_commit":"c5911de45a563fcfd9043df77ca98f33273899bf"},"previous_names":["lightning-ai/dev-toolbox"],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightning-AI%2Futilities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightning-AI%2Futilities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightning-AI%2Futilities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lightning-AI%2Futilities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lightning-AI","download_url":"https://codeload.github.com/Lightning-AI/utilities/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471060,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci-cd","developer-tools","github-actions"],"created_at":"2024-09-24T19:57:39.432Z","updated_at":"2026-02-11T10:05:06.146Z","avatar_url":"https://github.com/Lightning-AI.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 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/main/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-24.04\n    steps:\n    - uses: actions/checkout@v3\n    - uses: actions/setup-python@v4\n      with:\n        python-version: 3.10\n    - uses: Lightning-AI/utilities/.github/actions/cache\n      with:\n        python-version: 3.10\n        requires: oldest # or latest\n```\n\n## 3. General Python utilities `lightning_utilities.core`\n\n\u003cdetails\u003e\n  \u003csummary\u003eInstallation\u003c/summary\u003e\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\u003c/details\u003e\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\u003cdetails\u003e\n  \u003csummary\u003eInstallation\u003c/summary\u003e\n\nFrom pypi:\n\n```bash\npip install lightning_utilities[cli]\n```\n\n\u003c/details\u003e\n\n__Usage:__\n\n```bash\npython -m lightning_utilities.cli [group] [command]\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eExample for setting min versions\u003c/summary\u003e\n\n```console\n$ cat requirements/test.txt\ncoverage\u003e=5.0\ncodecov\u003e=2.1\npytest\u003e=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\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightning-ai%2Futilities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightning-ai%2Futilities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightning-ai%2Futilities/lists"}