Skip to content

Commit e8b239a

Browse files
authored
Update setuptools to fix safety issue (#562)
* update deps to solve safety issue * document lazy loading and ignore in linter
1 parent 43a618d commit e8b239a

File tree

4 files changed

+1243
-1107
lines changed

4 files changed

+1243
-1107
lines changed

src/mdio/commands/copy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def copy( # noqa: PLR0913
6363
flags. The function supports custom storage options for both input and output, enabling
6464
compatibility with various filesystems via FSSpec.
6565
"""
66-
from mdio.api.convenience import copy_mdio
66+
# Lazy import to reduce CLI startup time
67+
from mdio.api.convenience import copy_mdio # noqa: PLC0415
6768

6869
copy_mdio(
6970
source_mdio_path,

src/mdio/commands/info.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def info(mdio_path: str, output_format: str, access_pattern: str) -> None:
4343
By default, this returns human-readable information about the grid and stats for the dataset.
4444
If output-format is set to 'json' then a JSON is returned to facilitate parsing.
4545
"""
46-
from mdio import MDIOReader
46+
# Lazy import to reduce CLI startup time
47+
from mdio import MDIOReader # noqa: PLC0415
4748

4849
reader = MDIOReader(mdio_path, access_pattern=access_pattern, return_metadata=True)
4950

@@ -101,17 +102,19 @@ def parse_access_patterns(reader: MDIOReader) -> dict[str, Any]:
101102

102103
def json_print(mdio_info: dict[str, Any]) -> None:
103104
"""Convert MDIO Info to JSON and pretty print."""
104-
from json import dumps as json_dumps
105+
# Lazy import to reduce CLI startup time
106+
from json import dumps as json_dumps # noqa: PLC0415
105107

106-
from rich import print # noqa: A004
108+
from rich import print # noqa: A004, PLC0415
107109

108110
print(json_dumps(mdio_info, indent=2))
109111

110112

111113
def pretty_print(mdio_info: dict[str, Any]) -> None:
112114
"""Print pretty MDIO Info table to console."""
113-
from rich.console import Console
114-
from rich.table import Table
115+
# Lazy import to reduce CLI startup time
116+
from rich.console import Console # noqa: PLC0415
117+
from rich.table import Table # noqa: PLC0415
115118

116119
console = Console()
117120

src/mdio/commands/segy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ def segy_import( # noqa: PLR0913
315315
--chunk-size 8,2,256,512
316316
--grid-overrides '{"HasDuplicates": True}'
317317
"""
318-
from mdio import segy_to_mdio
318+
# Lazy import to reduce CLI startup time
319+
from mdio import segy_to_mdio # noqa: PLC0415
319320

320321
segy_to_mdio(
321322
segy_path=segy_path,
@@ -386,7 +387,8 @@ def segy_export(
386387
387388
The input MDIO can be local or cloud based. However, the output SEG-Y will be generated locally.
388389
"""
389-
from mdio import mdio_to_segy
390+
# Lazy import to reduce CLI startup time
391+
from mdio import mdio_to_segy # noqa: PLC0415
390392

391393
mdio_to_segy(
392394
mdio_path_or_buffer=mdio_file,

0 commit comments

Comments
 (0)