Skip to content

Commit a94d867

Browse files
committed
Initial Commit
0 parents  commit a94d867

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+12935
-0
lines changed

.github/CODEOWNERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This is a comment.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# These owners will be the default owners for everything in
5+
# the repo. Unless a later match takes precedence,
6+
# @global-owner1 and @global-owner2 will be requested for
7+
# review when someone opens a pull request.
8+
* @tchaton @ethanwharris @KaelanDt @justusschock

.github/dependabot.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Basic dependabot.yml file with minimum configuration for two package managers
2+
3+
version: 2
4+
updates:
5+
# Enable version updates for python
6+
- package-ecosystem: "pip"
7+
directory: "/"
8+
schedule:
9+
interval: "daily"
10+
labels: ["dependencies"]
11+
pull-request-branch-name:
12+
separator: "-"
13+
allow:
14+
- dependency-name: "lighting-sdk"
15+
reviewers:
16+
- "borda"
17+
18+
# Enable version updates for GitHub Actions
19+
- package-ecosystem: "github-actions"
20+
directory: "/"
21+
schedule:
22+
interval: "monthly"
23+
labels: ["CI"]
24+
pull-request-branch-name:
25+
# Separate sections of the branch name with a hyphen for example, `dependabot-npm_and_yarn-next_js-acorn-6.4.1`
26+
separator: "-"
27+
# Allow up to 5 open pull requests for GitHub Actions
28+
open-pull-requests-limit: 5
29+
reviewers:
30+
- "borda"
31+
groups:
32+
GHA-updates:
33+
patterns:
34+
- "*"

.github/workflows/ci-examples.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: examples
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
release:
7+
types:
8+
- created
9+
pull_request:
10+
types: [ opened, reopened, ready_for_review, synchronize ]
11+
12+
jobs:
13+
run-examples:
14+
runs-on: ${{ matrix.os }}
15+
if: github.event.pull_request.draft == false
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: ["ubuntu-latest"]
20+
auth_mode: ["guest", "user"]
21+
example: ["standalone_usage.py", "lightning_autoencoder.py"]
22+
python-version: ["3.10", "3.12"]
23+
24+
timeout-minutes: 15
25+
env:
26+
LIGHTNING_CLOUD_URL: https://staging.gridai.dev
27+
UV_TORCH_BACKEND: cpu
28+
29+
steps:
30+
- uses: actions/checkout@v5
31+
- name: Install uv and setup python
32+
uses: astral-sh/setup-uv@v6
33+
with:
34+
activate-environment: true
35+
python-version: ${{ matrix.python-version }}
36+
enable-cache: true
37+
38+
- name: Install dependencies
39+
run: |
40+
uv sync --group tests
41+
uv pip list
42+
43+
- name: Enable Guest Mode
44+
if: matrix.auth_mode == 'guest'
45+
shell: bash
46+
run: echo "TEST_GUEST_MODE=1" >> $GITHUB_ENV
47+
48+
- name: Set Auth Credentials
49+
if: matrix.auth_mode == 'user'
50+
shell: bash
51+
run: |
52+
echo "LIGHTNING_USER_ID=${{ secrets.LIGHTNING_STAGING_USER_ID }}" >> $GITHUB_ENV
53+
echo "LIGHTNING_API_KEY=${{ secrets.LIGHTNING_STAGING_API_KEY }}" >> $GITHUB_ENV
54+
55+
- name: Run example
56+
run: |
57+
uv run python examples/${{ matrix.example }}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: teamspace integration
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
release:
7+
types:
8+
- created
9+
pull_request:
10+
types: [ opened, reopened, ready_for_review, synchronize ] # added `ready_for_review` since draft is skipped
11+
12+
jobs:
13+
cpu:
14+
runs-on: ${{ matrix.os }}
15+
if: github.event.pull_request.draft == false
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
20+
auth_mode: ["user", "guest"]
21+
python-version: ["3.10", "3.11", "3.12", "3.13"]
22+
requires: ["latest"]
23+
include:
24+
- python-version: "3.10"
25+
requires: "oldest"
26+
os: "ubuntu-latest"
27+
auth_mode: "guest"
28+
- python-version: "3.10"
29+
requires: "oldest"
30+
os: "ubuntu-latest"
31+
auth_mode: "user"
32+
33+
timeout-minutes: 20
34+
env:
35+
LIGHTNING_CLOUD_URL: https://staging.gridai.dev
36+
UV_TORCH_BACKEND: cpu
37+
38+
steps:
39+
- uses: actions/checkout@v5
40+
- name: Install uv and setup python
41+
uses: astral-sh/setup-uv@v6
42+
with:
43+
activate-environment: true
44+
python-version: ${{ matrix.python-version }}
45+
enable-cache: true
46+
47+
- name: Set min. dependencies
48+
if: matrix.requires == 'oldest'
49+
run: |
50+
uv pip install 'lightning-utilities[cli]>=0.15.1'
51+
uv run python -m lightning_utilities.cli requirements set-oldest --req_files=pyproject.toml
52+
53+
- name: Install dependencies
54+
run: |
55+
uv sync --group tests
56+
uv pip list
57+
58+
- name: Enable Guest Mode
59+
if: matrix.auth_mode == 'guest'
60+
shell: bash
61+
run: echo "TEST_GUEST_MODE=1" >> $GITHUB_ENV
62+
63+
- name: Set Auth Credentials
64+
if: matrix.auth_mode == 'user'
65+
shell: bash
66+
run: |
67+
echo "LIGHTNING_USER_ID=${{ secrets.LIGHTNING_STAGING_USER_ID }}" >> $GITHUB_ENV
68+
echo "LIGHTNING_API_KEY=${{ secrets.LIGHTNING_STAGING_API_KEY }}" >> $GITHUB_ENV
69+
70+
- name: Tests
71+
working-directory: tests/
72+
run: |
73+
uv run pytest integrations/ -vvs
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: UnitTest
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
release:
7+
types:
8+
- created
9+
pull_request:
10+
types: [ opened, reopened, ready_for_review, synchronize ] # added `ready_for_review` since draft is skipped
11+
schedule:
12+
- cron: "0 0 * * *" # every day at midnight UTC
13+
14+
jobs:
15+
pytester:
16+
runs-on: ${{ matrix.os }}
17+
if: github.event.pull_request.draft == false
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
22+
python-version: ["3.10", "3.11", "3.12", "3.13"]
23+
dependency: ["lightning"]
24+
requires: ["latest"]
25+
include:
26+
- { os: "ubuntu-latest", python-version: "3.10", dependency: "lightning", requires: "oldest" }
27+
timeout-minutes: 20
28+
env:
29+
LIGHTNING_CLOUD_URL: https://staging.gridai.dev
30+
UV_TORCH_BACKEND: cpu
31+
32+
steps:
33+
- uses: actions/checkout@v5
34+
- name: Install uv and setup python
35+
uses: astral-sh/setup-uv@v6
36+
with:
37+
activate-environment: true
38+
python-version: ${{ matrix.python-version }}
39+
enable-cache: true
40+
41+
- name: Set min. dependencies
42+
if: matrix.requires == 'oldest'
43+
run: |
44+
uv pip install 'lightning-utilities[cli]>=0.15.1'
45+
uv run python -m lightning_utilities.cli requirements set-oldest --req_files=pyproject.toml
46+
47+
- name: Adjust lightning dependency
48+
if: matrix.dependency != 'lightning'
49+
run: |
50+
uv pip install 'lightning-utilities[cli]>=0.15.2'
51+
uv run python -m lightning_utilities.cli requirements replace-pkg --req_files=pyproject.toml \
52+
--old_package=lightning --new_package=${{ matrix.dependency }}
53+
54+
- name: Install package & dependencies
55+
run: |
56+
uv sync --group tests
57+
uv pip list
58+
# validate that the dependency is installed
59+
uv run python -c "import ${{ matrix.dependency }}"
60+
61+
- name: simulate missing git folder (posix)
62+
if: matrix.os != 'windows-latest'
63+
run: rm -rf .git
64+
- name: simulate missing git folder (windows)
65+
if: matrix.os == 'windows-latest'
66+
run: rm -r -fo .git
67+
68+
- name: Tests
69+
working-directory: tests/
70+
run: |
71+
# NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003
72+
uv run coverage run --source litlogger -m pytest unittests/ -vv -s
73+
env: # the following values are just dummies since the actual http calls are mocked out
74+
LIGHTNING_USER_ID: ${{ secrets.LIGHTNING_STAGING_USER_ID }}
75+
LIGHTNING_API_KEY: ${{ secrets.LIGHTNING_STAGING_API_KEY }}
76+
- name: Statistics
77+
working-directory: tests/
78+
run: |
79+
coverage report
80+
coverage xml
81+
82+
guardian-unittest:
83+
runs-on: ubuntu-latest
84+
needs: pytester
85+
if: always()
86+
steps:
87+
- run: echo "${{ needs.pytester.result }}"
88+
- name: failing...
89+
if: needs.pytester.result == 'failure'
90+
run: exit 1
91+
- name: cancelled or skipped...
92+
if: contains(fromJSON('["cancelled", "skipped"]'), needs.pytester.result)
93+
timeout-minutes: 1
94+
run: sleep 90
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: General checks
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
types: [ opened, reopened, ready_for_review, synchronize ] # added `ready_for_review` since draft is skipped
8+
branches: [main]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
12+
cancel-in-progress: ${{ ! (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) }}
13+
14+
jobs:
15+
check-schema:
16+
uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@main
17+
with:
18+
azure-dir: ''
19+
20+
check-package:
21+
if: github.event.pull_request.draft == false
22+
uses: Lightning-AI/utilities/.github/workflows/check-package.yml@main
23+
with:
24+
actions-ref: main
25+
artifact-name: dist-packages-${{ github.sha }}
26+
import-name: "litlogger"
27+
install-flags: "--extra-index-url https://download.pytorch.org/whl/cpu"
28+
testing-matrix: |
29+
{
30+
"os": ["ubuntu-22.04", "ubuntu-24.04", "macos-14"],
31+
"python-version": ["3.10", "3.11", "3.12", "3.13"],
32+
}
33+
34+
pre-commit:
35+
uses: Lightning-AI/utilities/.github/workflows/check-precommit.yml@main

.github/workflows/push_wheel.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Push wheel
2+
3+
# https://help.github.com/en/actions/reference/events-that-trigger-workflows
4+
on: # Trigger the workflow on push or pull request, but only for the main branch
5+
push:
6+
branches: [main, "release/*"]
7+
tags: ["*"]
8+
pull_request:
9+
branches: [main]
10+
release:
11+
types: [published]
12+
13+
14+
jobs:
15+
# based on https://github.com/pypa/gh-action-pypi-publish
16+
build-package:
17+
runs-on: "ubuntu-22.04"
18+
timeout-minutes: 10
19+
steps:
20+
- uses: actions/checkout@v5
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.8"
24+
cache: "pip"
25+
26+
- name: Install dependencies
27+
run: pip install -U setuptools wheel build
28+
29+
- name: Overview Readme for release
30+
run: echo "# Lit Logger" > README.md
31+
32+
- name: Build packages
33+
run: |
34+
# todo: add sdist once public
35+
python -m build --wheel
36+
ls -lh dist/
37+
38+
- name: Upload to release
39+
if: ${{ github.event_name == 'release' }}
40+
continue-on-error: true
41+
uses: AButler/[email protected]
42+
with:
43+
files: "dist/*"
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
45+
46+
# We do this, since failures on test.pypi aren't that bad
47+
- name: Publish to Test PyPI
48+
if: startsWith(github.event.ref, 'refs/tags')
49+
uses: pypa/[email protected]
50+
with:
51+
user: __token__
52+
password: ${{ secrets.test_pypi_password }}
53+
repository_url: https://test.pypi.org/legacy/
54+
verbose: true
55+
56+
- name: Publish distribution 📦 to PyPI
57+
if: startsWith(github.event.ref, 'refs/tags')
58+
uses: pypa/[email protected]
59+
with:
60+
user: __token__
61+
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)