This repository covers the following use-cases:
- Reusable GitHub workflows
- Shared GitHub actions
- General Python utilities in
lightning_utilities.core - CLI
python -m lightning_utilities.cli --help
Usage:
name: Check schemaon: [push]jobs:
check-schema:
uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@v0.5.0with:
azure-dir: ""# skip Azure checkcheck-code:
uses: Lightning-AI/utilities/.github/workflows/check-code.yml@mainwith:
actions-ref: main # normally you shall use the same version as the workflowSee usage of other workflows in .github/workflows/ci-use-checks.yaml.
See available composite actions .github/actions/.
Usage:
name: Do something with cacheon: [push]jobs:
pytest:
runs-on: ubuntu-24.04steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4with:
python-version: 3.10
- uses: Lightning-AI/utilities/.github/actions/cachewith:
python-version: 3.10requires: oldest # or latestInstallation
From source:pip install https://github.com/Lightning-AI/utilities/archive/refs/heads/main.zipFrom pypi:
pip install lightning_utilitiesUsage:
Example for optional imports:
fromlightning_utilities.core.importsimportmodule_availableifmodule_available("some_package.something"):
fromsome_packageimportsomethingThe package provides common CLI commands.
Installation
From pypi:
pip install lightning_utilities[cli]Usage:
python -m lightning_utilities.cli [group] [command]Example for setting min versions
$ cat requirements/test.txtcoverage>=5.0codecov>=2.1pytest>=6.0pytest-covpytest-timeout
$ python -m lightning_utilities.cli requirements set-oldest
$ cat requirements/test.txtcoverage==5.0codecov==2.1pytest==6.0pytest-covpytest-timeout