Skip to content

Commit 86455f7

Browse files
committed
fix: update pre-commit configuration and mypy settings
add args: --follow-imports=silent to pass error which have no relationship with src/lerobot/configs
1 parent b05a777 commit 86455f7

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

.pre-commit-config.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
default_language_version:
16-
python: python3.10
16+
python: python3.10
1717

1818
exclude: "tests/artifacts/.*\\.safetensors$"
1919

@@ -24,12 +24,12 @@ repos:
2424
- id: check-useless-excludes
2525
- id: check-hooks-apply
2626

27-
##### General Code Quality & Formatting #####
27+
##### General Code Quality & Formatting #####
2828
- repo: https://github.com/pre-commit/pre-commit-hooks
2929
rev: v5.0.0
3030
hooks:
3131
- id: check-added-large-files
32-
args: ['--maxkb=1024']
32+
args: ["--maxkb=1024"]
3333
- id: debug-statements
3434
- id: check-merge-conflict
3535
- id: check-case-conflict
@@ -54,7 +54,7 @@ repos:
5454
- repo: https://github.com/asottile/pyupgrade
5555
rev: v3.20.0
5656
hooks:
57-
- id: pyupgrade
57+
- id: pyupgrade
5858
args: [--py310-plus]
5959

6060
##### Markdown Quality #####
@@ -80,18 +80,20 @@ repos:
8080
- repo: https://github.com/PyCQA/bandit
8181
rev: 1.8.6
8282
hooks:
83-
- id: bandit
84-
args: ["-c", "pyproject.toml"]
85-
additional_dependencies: ["bandit[toml]"]
83+
- id: bandit
84+
args: ["-c", "pyproject.toml"]
85+
additional_dependencies: ["bandit[toml]"]
8686

8787
# TODO(Steven): Uncomment when ready to use
8888
##### Static Analysis & Typing #####
89-
# - repo: https://github.com/pre-commit/mirrors-mypy
90-
# rev: v1.16.0
91-
# hooks:
92-
# - id: mypy
93-
# args: [--python-version=3.10]
94-
89+
- repo: https://github.com/pre-commit/mirrors-mypy
90+
rev: v1.16.0
91+
hooks:
92+
- id: mypy
93+
args: [--python-version=3.10, --follow-imports=silent]
94+
files: ^src/lerobot/configs/
95+
additional_dependencies:
96+
["numpy", "torch", "huggingface_hub", "draccus"]
9597
##### Docstring Checks #####
9698
# - repo: https://github.com/akaihola/darglint2
9799
# rev: v1.8.2

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ default.extend-ignore-identifiers-re = [
257257
# color = true
258258
# paths = ["src/lerobot"]
259259

260-
# [tool.mypy]
261-
# python_version = "3.10"
262-
# warn_return_any = true
263-
# warn_unused_configs = true
264-
# ignore_missing_imports = false
260+
[tool.mypy]
261+
python_version = "3.10"
262+
warn_return_any = true
263+
warn_unused_configs = true
264+
ignore_missing_imports = false

src/lerobot/configs/policies.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class PreTrainedConfig(draccus.ChoiceRegistry, HubMixin, abc.ABC):
6363
# automatic gradient scaling is used.
6464
use_amp: bool = False
6565

66-
push_to_hub: bool = True # type: ignore[assignment]
66+
push_to_hub: bool = True # type: ignore[assignment] # TODO: use a different name to avoid override
6767
repo_id: str | None = None
6868

6969
# Upload on private repository on the Hugging Face hub.
@@ -196,6 +196,9 @@ def from_pretrained(
196196
if config_file is None:
197197
raise FileNotFoundError(f"{CONFIG_NAME} not found in {model_id}")
198198

199+
if config_file is None:
200+
raise FileNotFoundError(f"{CONFIG_NAME} not found in {model_id}")
201+
199202
with open(config_file) as f:
200203
config = json.load(f)
201204

src/lerobot/configs/train.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,5 @@ def from_pretrained(
188188
@dataclass(kw_only=True)
189189
class TrainRLServerPipelineConfig(TrainPipelineConfig):
190190
# NOTE: In RL, we don't need an offline dataset
191+
# TODO: Make `TrainPipelineConfig.dataset` optional
191192
dataset: DatasetConfig | None = None # type: ignore[assignment] # because the parent class has made it's type non-optional

0 commit comments

Comments
 (0)