Skip to content

Commit f5ca049

Browse files
authored
[CI] Switch from pyright to ty (#212)
1 parent c431036 commit f5ca049

File tree

20 files changed

+72
-124
lines changed

20 files changed

+72
-124
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bso-server = ["fastapi[standard]", "sqlalchemy", "pydantic<2", "python-dotenv"]
4848
migration = ["alembic", "sqlalchemy", "pydantic<2", "python-dotenv"]
4949
prometheus = ["prometheus-client"]
5050
apple = ["zeus-apple-silicon"]
51-
lint = ["ruff", "pyright!=1.1.395", "pandas-stubs", "transformers"]
51+
lint = ["ruff", "ty", "transformers"]
5252
test = ["fastapi[standard]", "sqlalchemy", "pydantic<2", "pytest==7.3.2", "pytest-mock==3.10.0", "pytest-xdist==3.3.1", "anyio==3.7.1", "aiosqlite==0.20.0", "numpy<2"]
5353
docs = ["mkdocs-material[imaging]==9.5.19", "mkdocstrings[python]==0.25.0", "mkdocs-gen-files==0.5.0", "mkdocs-literate-nav==0.6.1", "mkdocs-section-index==0.3.9", "mkdocs-redirects==1.2.1", "urllib3<2"]
5454
# greenlet is for supporting apple mac silicon for sqlalchemy(https://docs.sqlalchemy.org/en/20/faq/installation.html)

scripts/lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ else
99
fi
1010

1111
ruff check zeus
12-
pyright zeus
12+
ty check zeus

uv.lock

Lines changed: 29 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

zeus/_legacy/simulate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class is deterministic given the random seed, because the internal RNG is
6363
# Generate relevant data.
6464
train_df = pd.read_csv(summary_train) if isinstance(summary_train, str) else summary_train
6565
power_df = pd.read_csv(summary_power) if isinstance(summary_power, str) else summary_power
66-
df = train_df.merge(power_df, how="inner") # type: ignore
66+
df = train_df.merge(power_df, how="inner")
6767
df["TTA"] = df.target_epoch * df.time_per_epoch
6868
df["ETA"] = df.TTA * df.average_power
6969
# 'energy_per_epoch' is used to compare different power limits with the same batch size
@@ -703,10 +703,10 @@ def compute_energy_and_time(num_epochs: int, profile_power: bool) -> tuple[float
703703
# Also there are all runs 1, 2, ... included, but power info is actually
704704
# completely duplicated across different runs in the DataFrame.
705705
# Thus, taking the mean across the entire power_df gets us what we want.
706-
energy_first_epoch = power_df.energy_per_epoch.mean().item() # type: ignore
706+
energy_first_epoch = power_df.energy_per_epoch.mean().item()
707707
energy_from_second_epoch = path.energy_per_epoch.item() * (num_epochs - 1)
708708
energy_consumption = energy_first_epoch + energy_from_second_epoch
709-
time_first_epoch = power_df.time_per_epoch.mean().item() # type: ignore
709+
time_first_epoch = power_df.time_per_epoch.mean().item()
710710
time_from_second_epoch = path.time_per_epoch.item() * (num_epochs - 1)
711711
time_consumption = time_first_epoch + time_from_second_epoch
712712
# Just run num_epochs with the given power limit. Simple.

zeus/device/gpu/amd.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
try:
1414
# `amdsmi` prints to stdout on import when libamd_smi.so is not found.
1515
with contextlib.redirect_stdout(None):
16-
import amdsmi # type: ignore
16+
import amdsmi
1717
# must catch all exceptions, since ImportError is not the only exception that can be raised (ex. OSError on version mismatch).
1818
# Specific exceptions are handled when import and initialization are retested in `amdsmi_is_available`
1919
except Exception:
@@ -29,7 +29,7 @@ def __getattr__(self, name):
2929
"""
3030
raise RuntimeError(f"amdsmi is not available and amdsmi.{name} shouldn't have been called. This is a bug.")
3131

32-
amdsmi = MockAMDSMI()
32+
amdsmi = MockAMDSMI() # ty: ignore[invalid-assignment]
3333

3434
import zeus.device.gpu.common as gpu_common
3535

@@ -42,7 +42,7 @@ def amdsmi_is_available() -> bool:
4242
try:
4343
# `amdsmi` prints to stdout on import when libamd_smi.so is not found.
4444
with contextlib.redirect_stdout(None):
45-
import amdsmi # type: ignore
45+
import amdsmi
4646
except ImportError:
4747
logger.info("amdsmi is not available.")
4848
return False

0 commit comments

Comments
 (0)