Skip to content

Commit c4fb15b

Browse files
[pre-commit.ci] pre-commit suggestions & bump py3.9 (#110)
* [pre-commit.ci] pre-commit suggestions updates: - [github.com/pre-commit/mirrors-prettier: v3.1.0 → v4.0.0-alpha.8](pre-commit/mirrors-prettier@v3.1.0...v4.0.0-alpha.8) - [github.com/astral-sh/ruff-pre-commit: v0.11.12 → v0.12.2](astral-sh/ruff-pre-commit@v0.11.12...v0.12.2) * Apply suggestions from code review * bump py3.9 * --unsafe-fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jirka Borovec <[email protected]> Co-authored-by: Jirka B <[email protected]>
1 parent 5c0ee00 commit c4fb15b

File tree

7 files changed

+16
-17
lines changed

7 files changed

+16
-17
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ repos:
5454
exclude: CHANGELOG.md
5555

5656
- repo: https://github.com/astral-sh/ruff-pre-commit
57-
rev: v0.11.12
57+
rev: v0.12.2
5858
hooks:
5959
- id: ruff
6060
args: ["--fix"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ warn_no_return = false
8484

8585
[tool.ruff]
8686
line-length = 120
87-
target-version = 'py38'
87+
target-version = 'py39'
8888
exclude = [
8989
"build",
9090
"dist",

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ def _prepare_extras(requirements_dir: str = _PATH_REQUIRES, skip_files: tuple =
9393
# Specify the Python versions you support here. In particular, ensure
9494
# that you indicate whether you support Python 2, Python 3 or both.
9595
"Programming Language :: Python :: 3",
96-
"Programming Language :: Python :: 3.8",
9796
"Programming Language :: Python :: 3.9",
9897
"Programming Language :: Python :: 3.10",
9998
"Programming Language :: Python :: 3.11",

src/litmodels/integrations/checkpoints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import threading
55
from abc import ABC
66
from datetime import datetime
7-
from functools import lru_cache
7+
from functools import cache
88
from pathlib import Path
99
from typing import TYPE_CHECKING, Any, Optional, Union
1010

@@ -33,7 +33,7 @@
3333

3434

3535
# Create a singleton upload manager
36-
@lru_cache(maxsize=None)
36+
@cache
3737
def get_model_manager() -> "ModelManager":
3838
"""Get or create the singleton upload manager."""
3939
return ModelManager()

src/litmodels/integrations/mixins.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import warnings
55
from abc import ABC
66
from pathlib import Path
7-
from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Union
7+
from typing import TYPE_CHECKING, Any, Optional, Union
88

99
from lightning_utilities.core.rank_zero import rank_zero_warn
1010

@@ -43,7 +43,7 @@ def download_model(
4343

4444
def _setup(
4545
self, name: Optional[str] = None, temp_folder: Union[str, Path, None] = None
46-
) -> Tuple[str, str, Union[str, Path]]:
46+
) -> tuple[str, str, Union[str, Path]]:
4747
"""Parse and validate the model name and temporary folder."""
4848
if name is None:
4949
name = model_name = self.__class__.__name__
@@ -56,7 +56,7 @@ def _setup(
5656
return name, model_name, temp_folder
5757

5858
def _upload_model_files(
59-
self, name: str, path: Union[str, Path, List[Union[str, Path]]], metadata: Optional[dict] = None
59+
self, name: str, path: Union[str, Path, list[Union[str, Path]]], metadata: Optional[dict] = None
6060
) -> None:
6161
"""Upload the model files to the registry."""
6262
if not metadata:

src/litmodels/io/cloud.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# http://www.apache.org/licenses/LICENSE-2.0
44
#
55
from pathlib import Path
6-
from typing import TYPE_CHECKING, Dict, List, Optional, Union
6+
from typing import TYPE_CHECKING, Optional, Union
77

88
from lightning_sdk.lightning_cloud.env import LIGHTNING_CLOUD_URL
99
from lightning_sdk.models import _extend_model_name_with_teamspace, _parse_org_teamspace_model_version
@@ -45,11 +45,11 @@ def _print_model_link(name: str, verbose: Union[bool, int]) -> None:
4545

4646
def upload_model_files(
4747
name: str,
48-
path: Union[str, Path, List[Union[str, Path]]],
48+
path: Union[str, Path, list[Union[str, Path]]],
4949
progress_bar: bool = True,
5050
cloud_account: Optional[str] = None,
5151
verbose: Union[bool, int] = 1,
52-
metadata: Optional[Dict[str, str]] = None,
52+
metadata: Optional[dict[str, str]] = None,
5353
) -> "UploadedModelInfo":
5454
"""Upload a local checkpoint file to the model store.
5555
@@ -83,7 +83,7 @@ def download_model_files(
8383
name: str,
8484
download_dir: Union[str, Path] = ".",
8585
progress_bar: bool = True,
86-
) -> Union[str, List[str]]:
86+
) -> Union[str, list[str]]:
8787
"""Download a checkpoint from the model store.
8888
8989
Args:
@@ -103,7 +103,7 @@ def download_model_files(
103103
)
104104

105105

106-
def _list_available_teamspaces() -> Dict[str, dict]:
106+
def _list_available_teamspaces() -> dict[str, dict]:
107107
"""List available teamspaces for the authenticated user.
108108
109109
Returns:

src/litmodels/io/gateway.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import tempfile
33
from pathlib import Path
4-
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
4+
from typing import TYPE_CHECKING, Any, Optional, Union
55

66
from litmodels.io.cloud import download_model_files, upload_model_files
77
from litmodels.io.utils import _KERAS_AVAILABLE, _PYTORCH_AVAILABLE, dump_pickle, load_pickle
@@ -22,7 +22,7 @@ def upload_model(
2222
progress_bar: bool = True,
2323
cloud_account: Optional[str] = None,
2424
verbose: Union[bool, int] = 1,
25-
metadata: Optional[Dict[str, str]] = None,
25+
metadata: Optional[dict[str, str]] = None,
2626
) -> "UploadedModelInfo":
2727
"""Upload a checkpoint to the model store.
2828
@@ -60,7 +60,7 @@ def save_model(
6060
cloud_account: Optional[str] = None,
6161
staging_dir: Optional[str] = None,
6262
verbose: Union[bool, int] = 1,
63-
metadata: Optional[Dict[str, str]] = None,
63+
metadata: Optional[dict[str, str]] = None,
6464
) -> "UploadedModelInfo":
6565
"""Upload a checkpoint to the model store.
6666
@@ -119,7 +119,7 @@ def download_model(
119119
name: str,
120120
download_dir: Union[str, Path] = ".",
121121
progress_bar: bool = True,
122-
) -> Union[str, List[str]]:
122+
) -> Union[str, list[str]]:
123123
"""Download a checkpoint from the model store.
124124
125125
Args:

0 commit comments

Comments
 (0)