Skip to content
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/ci-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
with:
actions-ref: 86fe1b20b4609835ba9e8c8739cd39707ba76868
extra-typing: "typing"
python-version: "3.11"

check-schema:
uses: Lightning-AI/utilities/.github/workflows/check-schema.yml@86fe1b20b4609835ba9e8c8739cd39707ba76868 # v0.15.3
Expand All @@ -34,7 +35,7 @@ jobs:
testing-matrix: |
{
"os": ["ubuntu-latest", "macos-latest", "windows-latest"],
"python-version": ["3.10", "3.12"]
"python-version": ["3.11", "3.12"]
}

# check-docs:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ci-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "macOS-14", "windows-2022"]
python-version: ["3.10"]
python-version: ["3.11"]
requires: ["latest"]
include:
- { os: "ubuntu-22.04", python-version: "3.10", requires: "oldest" }
- { os: "ubuntu-22.04", python-version: "3.11", requires: "oldest" }

# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 25
Expand All @@ -34,6 +34,8 @@ jobs:

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0

- name: Install uv and set Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
Expand All @@ -46,7 +48,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", "pyproject.toml"]'
python -m lightning_utilities.cli requirements set-oldest --req_files='["pyproject.toml"]'

- name: Install package & dependencies
run: |
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-24.04", "macOS-14", "windows-2022"]
python-version: ["3.10", "3.12"]
python-version: ["3.11", "3.12"]
requires: ["latest"]
dependency: ["lightning"]
dependency_package: ["lightning"]
include:
- {
os: "ubuntu-22.04",
python-version: "3.10",
python-version: "3.11",
requires: "oldest",
dependency: "lightning",
dependency_package: "lightning",
Expand Down Expand Up @@ -67,6 +67,8 @@ jobs:

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0

- name: Install uv and set Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
Expand All @@ -79,7 +81,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", "pyproject.toml"]'
python -m lightning_utilities.cli requirements set-oldest --req_files='["pyproject.toml"]'

- name: Adjust requirements
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ jobs:
UV_EXCLUDE_NEWER: "2 days"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0

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

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ jobs:

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0

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

Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ exclude tests
recursive-exclude docs *
exclude docs

# Include the Requirements
include requirements.txt

# Exclude Makefile
exclude Makefile

Expand Down
19 changes: 10 additions & 9 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import re
import sys
from importlib.metadata import requires
from importlib.util import module_from_spec, spec_from_file_location

import pt_lightning_sphinx_theme
Expand Down Expand Up @@ -288,13 +289,13 @@ def setup(app):

# Ignoring Third-party packages
# https://stackoverflow.com/questions/15889621/sphinx-how-to-exclude-imports-in-automodule
def _package_list_from_file(file):
def _package_list_from_metadata(package):
list_pkgs = []
with open(file) as fp:
lines = fp.readlines()
for ln in lines:
found = [ln.index(ch) for ch in list(",=<>#") if ch in ln]
pkg = ln[: min(found)] if found else ln
for requirement in requires(package) or []:
if "extra ==" in requirement:
continue
found = [requirement.index(ch) for ch in list(",=<>!~;[") if ch in requirement]
pkg = requirement[: min(found)] if found else requirement
if pkg.rstrip():
list_pkgs.append(pkg.rstrip())
return list_pkgs
Expand All @@ -303,13 +304,13 @@ def _package_list_from_file(file):
# define mapping from PyPI names to python imports
PACKAGE_MAPPING = {
"PyYAML": "yaml",
"lightning-sdk": "lightning_sdk",
"lightning-utilities": "lightning_utilities",
}
MOCK_PACKAGES = []
if SPHINX_MOCK_REQUIREMENTS:
# mock also base packages when we are on RTD since we don't install them there
MOCK_PACKAGES += _package_list_from_file(
os.path.join(_PATH_ROOT, "requirements.txt")
)
MOCK_PACKAGES += _package_list_from_metadata("litmodels")
MOCK_PACKAGES = [PACKAGE_MAPPING.get(pkg, pkg) for pkg in MOCK_PACKAGES]

autodoc_mock_imports = MOCK_PACKAGES
Expand Down
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build-system]
requires = [
"setuptools>=69",
"setuptools>=80",
"setuptools-scm[simple]>=9.2",
"wheel",
]
build-backend = "setuptools.build_meta"
Expand All @@ -13,7 +14,7 @@ license = { file = "LICENSE" }
authors = [
{ name = "Lightning-AI et al.", email = "community@lightning.ai" },
]
requires-python = ">=3.10"
requires-python = ">=3.11"
keywords = ["deep learning", "pytorch", "AI"]
classifiers = [
"Environment :: Console",
Expand All @@ -25,12 +26,16 @@ classifiers = [
"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"]
dynamic = ["version"]
dependencies = [
"litlogger >=2026.8.28",
"lightning-sdk >=2026.8.5",
"lightning-utilities <=0.15.3",
]

[project.urls]
"Bug Tracker" = "https://github.com/Lightning-AI/litModels/issues"
Expand Down Expand Up @@ -86,11 +91,6 @@ zip-safe = false
[tool.setuptools.packages.find]
where = ["src"]

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


[tool.check-manifest]
ignore = [
"*.yml",
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

4 changes: 3 additions & 1 deletion src/litmodels/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
__version__ = "0.1.8"
from importlib.metadata import version

__version__ = version("litmodels")
__author__ = "Lightning-AI et al."
__author_email__ = "community@lightning.ai"
__license__ = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions src/litmodels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import os

from litlogger.models import download_model, load_model, save_model, upload_model, upload_model_files # noqa: F401

from litmodels.__about__ import * # noqa: F401, F403

_PACKAGE_ROOT = os.path.dirname(__file__)
_PROJECT_ROOT = os.path.dirname(_PACKAGE_ROOT)

from litmodels.io import download_model, load_model, save_model, upload_model, upload_model_files # noqa: F401

__all__ = ["download_model", "upload_model", "load_model", "save_model"]
16 changes: 1 addition & 15 deletions src/litmodels/integrations/checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
from typing import TYPE_CHECKING, Any, Optional

from lightning_sdk.lightning_cloud.login import Auth
from lightning_sdk.utils.resolve import _resolve_teamspace
from lightning_utilities import StrEnum
from lightning_utilities.core.rank_zero import rank_zero_debug, rank_zero_only, rank_zero_warn

from litmodels import upload_model
from litmodels.integrations.imports import _LIGHTNING_AVAILABLE, _PYTORCHLIGHTNING_AVAILABLE
from litmodels.io.cloud import _list_available_teamspaces, delete_model_version
from litmodels.io.cloud import delete_model_version

if _LIGHTNING_AVAILABLE:
from lightning.pytorch.callbacks import ModelCheckpoint as _LightningModelCheckpoint
Expand Down Expand Up @@ -243,19 +242,6 @@ def _update_model_name(self, pl_model: "pl.LightningModule") -> None:
elif count_slashes_in_name == 0:
if not self.model_registry:
self.model_registry = default_model_name
teamspace = _resolve_teamspace(None, None, None)
if teamspace:
# case you use default model name and teamspace determined from env. variables aka running in studio
self.model_registry = f"{teamspace.owner.name}/{teamspace.name}/{self.model_registry}"
else: # try to load default users teamspace
ts_names = list(_list_available_teamspaces().keys())
if len(ts_names) == 1:
self.model_registry = f"{ts_names[0]}/{self.model_registry}"
else:
options = "\n\t".join(ts_names)
raise RuntimeError(
f"Teamspace is not defined and there are multiple teamspaces available:\n{options}"
)
else:
raise RuntimeError(f"Invalid model name: '{self.model_registry}'")

Expand Down
12 changes: 9 additions & 3 deletions src/litmodels/io/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
"""Root package for Input/output."""

from litmodels.io.cloud import download_model_files, upload_model_files # noqa: F401
from litmodels.io.gateway import download_model, load_model, save_model, upload_model
from litlogger.models import (
download_model,
download_model_files,
load_model,
save_model,
upload_model,
upload_model_files,
)

__all__ = ["download_model", "upload_model", "upload_model_files", "load_model", "save_model"]
__all__ = ["download_model", "download_model_files", "upload_model", "upload_model_files", "load_model", "save_model"]
Loading
Loading