Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions .github/workflows/ci-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,7 @@ defaults:
shell: bash

jobs:
access-secrets:
# try to access secrets to ensure they are available
# if not set job output to be false
runs-on: ubuntu-latest
outputs:
secrets_available: ${{ steps.check_secrets.outputs.secrets_available }}
steps:
- name: Check secrets
id: check_secrets
run: |
if [[ -z "${{ secrets.LIGHTNING_USER_ID }}" || -z "${{ secrets.LIGHTNING_API_KEY }}" ]]; then
echo "Secrets are not set. Exiting..."
echo "secrets_available=false" >> $GITHUB_OUTPUT
else
echo "Secrets are available."
echo "secrets_available=true" >> $GITHUB_OUTPUT
fi

integration:
needs: access-secrets
if: needs.access-secrets.outputs.secrets_available == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -49,6 +29,7 @@ jobs:
TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html"
DISABLE_MPS: ${{ matrix.os == 'macOS-14' && '1' || '0' }}
UV_TORCH_BACKEND: "cpu"
LIGHTNING_CLOUD_URL: https://staging.gridai.dev

steps:
- uses: actions/checkout@v5
Expand All @@ -64,7 +45,7 @@ jobs:
if: matrix.requires == 'oldest'
run: |
uv pip install 'lightning-utilities[cli]'
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]'
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "pyproject.toml"]'

- name: Install package & dependencies
run: |
Expand Down
40 changes: 32 additions & 8 deletions .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,36 @@ jobs:
python-version: ["3.10", "3.12"]
requires: ["latest"]
dependency: ["lightning"]
dependency_package: ["lightning"]
include:
- { os: "ubuntu-22.04", python-version: "3.10", requires: "oldest", dependency: "lightning" }
- { os: "ubuntu-24.04", python-version: "3.12", requires: "latest", dependency: "pytorch_lightning" }
- { os: "windows-2022", python-version: "3.12", requires: "latest", dependency: "pytorch_lightning" }
- { os: "macOS-14", python-version: "3.12", requires: "latest", dependency: "pytorch_lightning" }
- {
os: "ubuntu-22.04",
python-version: "3.10",
requires: "oldest",
dependency: "lightning",
dependency_package: "lightning",
}
- {
os: "ubuntu-24.04",
python-version: "3.12",
requires: "latest",
dependency: "pytorch_lightning",
dependency_package: "pytorch-lightning",
}
- {
os: "windows-2022",
python-version: "3.12",
requires: "latest",
dependency: "pytorch_lightning",
dependency_package: "pytorch-lightning",
}
- {
os: "macOS-14",
python-version: "3.12",
requires: "latest",
dependency: "pytorch_lightning",
dependency_package: "pytorch-lightning",
}

# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 35
Expand All @@ -53,16 +78,15 @@ jobs:
if: matrix.requires == 'oldest'
run: |
uv pip install 'lightning-utilities[cli]'
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]'
python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "pyproject.toml"]'

- name: Adjust requirements
run: |
uv pip install 'lightning-utilities[cli]' -q
python -m lightning_utilities.cli requirements replace-pkg \
--old_package="lightning" \
--new_package="${{matrix.dependency}}" \
--req_files='["_requirements/extra.txt"]'
cat _requirements/extra.txt
--new_package="${{ matrix.dependency_package }}" \
--req_files='["pyproject.toml"]'

- name: Install package & dependencies
run: |
Expand Down
27 changes: 24 additions & 3 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,30 @@ on:

jobs:
build-docs:
uses: Lightning-AI/utilities/.github/workflows/check-docs.yml@main
with:
requirements-file: "_requirements/_docs.txt"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Install uv and set Python 3.10
uses: astral-sh/setup-uv@v7
with:
python-version: "3.10"
activate-environment: true
enable-cache: true

- name: Install package & docs dependencies
run: uv pip install -e '.[docs]'

- name: Build docs
env:
SPHINX_MOCK_REQUIREMENTS: "0"
run: python -m sphinx -b html -W --keep-going docs/source docs/build/html

- name: Upload prepared docs
uses: actions/upload-artifact@v4
with:
name: docs-html-${{ github.sha }}
path: docs/build/html

# https://github.com/marketplace/actions/deploy-to-github-pages
docs-deploy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- name: Install dependencies
run: |
uv pip install -U -r _requirements/_ci.txt
uv pip install -U '.[build]'
uv pip list

- name: Build package
Expand Down
3 changes: 1 addition & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ recursive-exclude __pycache__ *.py[cod] *.orig

# Include the README and CHANGELOG
include *.md
include pyproject.toml
recursive-include src *.md

# Include the license file
include LICENSE

# Exclude build configs
exclude *.sh
exclude *.toml
exclude *.svg
exclude *.yml
exclude *.yaml
Expand All @@ -28,7 +28,6 @@ exclude docs

# Include the Requirements
include requirements.txt
recursive-include _requirements *.tx;t

# Exclude Makefile
exclude Makefile
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ export SLURM_LOCALID=0
export SPHINX_MOCK_REQUIREMENTS=0

test: clean
pip install -q -r requirements.txt
pip install -q -r _requirements/test.txt
pip install -q -e '.[test,extra]'

# use this to run tests
python -m coverage run --source litmodels -m pytest src tests -v --flake8
python -m coverage report

docs: clean
pip install . --quiet -r _requirements/docs.txt
python -m sphinx -b html -W --keep-going docs/source docs/build
pip install --quiet -e '.[docs]'
python -m sphinx -b html -W --keep-going docs/source docs/build/html

clean:
# clean all temp runs
Expand Down
2 changes: 0 additions & 2 deletions _requirements/_ci.txt

This file was deleted.

15 changes: 0 additions & 15 deletions _requirements/_docs.txt

This file was deleted.

3 changes: 0 additions & 3 deletions _requirements/extra.txt

This file was deleted.

9 changes: 0 additions & 9 deletions _requirements/test.txt

This file was deleted.

1 change: 0 additions & 1 deletion _requirements/typing.txt

This file was deleted.

93 changes: 87 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,94 @@
[metadata]
license_file = "LICENSE"
description-file = "README.md"

[build-system]
requires = [
"setuptools",
"setuptools>=69",
"wheel",
]
build-backend = "setuptools.build_meta"

[project]
name = "litmodels"
description = "Lightning AI Model hub."
readme = "README.md"
license = { file = "LICENSE" }
authors = [
{ name = "Lightning-AI et al.", email = "community@lightning.ai" },
]
requires-python = ">=3.8"
keywords = ["deep learning", "pytorch", "AI"]
classifiers = [
"Environment :: Console",
"Natural Language :: English",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Information Analysis",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dynamic = ["version", "dependencies"]

[project.urls]
"Bug Tracker" = "https://github.com/Lightning-AI/litModels/issues"
Documentation = "https://lightning-ai.github.io/litModels/"
"Source Code" = "https://github.com/Lightning-AI/litModels"
Homepage = "https://github.com/Lightning-AI/litModels"
Download = "https://github.com/Lightning-AI/litModels"

[project.optional-dependencies]
build = [
"build ==1.4.*",
"twine ==6.2.*",
]
docs = [
"sphinx >=6.0,<8.0",
"myst-parser >=2.0.0",
"nbsphinx >=0.8.5",
"pandoc >=1.0",
"pypandoc-binary",
"docutils >=0.16",
"sphinxcontrib-fulltoc >=1.0",
"sphinxcontrib-mockautodoc",
"sphinx-autodoc-typehints >=1.0",
"sphinx-paramlinks >=0.5.1",
"sphinx-togglebutton >=0.2",
"sphinx-copybutton >=0.3",
"pt-lightning-sphinx-theme @ https://github.com/Lightning-AI/lightning_sphinx_theme/archive/master.zip",
]
extra = [
"lightning >= 2.0.0",
"numpy <2.0.0 ; platform_system == 'Darwin'",
"joblib >= 1.0.0",
]
test = [
"coverage >=5.0",
"pytest >=6.0",
"pytest-cov",
"pytest-mock",
"pytorch-lightning >=2.0",
"scikit-learn >=1.0",
"huggingface-hub >=0.29.0",
"tensorflow >=2.0",
]
typing = [
"mypy ==1.19.1",
]

[tool.setuptools]
package-dir = {"" = "src"}
include-package-data = true
zip-safe = false

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.dynamic]
version = { attr = "litmodels.__about__.__version__" }
dependencies = { file = ["requirements.txt"] }


[tool.check-manifest]
Expand Down Expand Up @@ -118,7 +200,6 @@ ignore = [
]

[tool.ruff.lint.per-file-ignores]
"setup.py" = ["D100", "SIM115"]
"__about__.py" = ["D100"]
"__init__.py" = ["D100", "E402"]
"examples/**" = ["D"] # todo
Expand Down
Loading
Loading