Skip to content

Commit 1dc2ebd

Browse files
Tavish9brentyikerrj
authored
Fix cli bug in high version of tyro (#3567)
* limited the tyro version up to 0.9.2 * bump tyro>=0.9.8 * Bump typeguard * Runtime checking with jaxtyping hook instead of typeguard * Fix test for Python >=3.11, caused by missing default_factory --------- Co-authored-by: Brent Yi <[email protected]> Co-authored-by: Justin Kerr <[email protected]>
1 parent 3057c68 commit 1dc2ebd

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

docs/developer_guides/new_methods.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ The `NERFSTUDIO_METHOD_CONFIGS` environment variable additionally accepts a func
8383
```python
8484
"""my_method/my_config.py"""
8585

86-
from dataclasses import dataclass
86+
from dataclasses import dataclass, field
8787
from nerfstudio.engine.trainer import TrainerConfig
8888
from nerfstudio.plugins.types import MethodSpecification
8989

@@ -95,7 +95,7 @@ def MyMethodFunc():
9595

9696
@dataclass
9797
class MyMethodClass(MethodSpecification):
98-
config: TrainerConfig = TrainerConfig(...)
98+
config: TrainerConfig = field(default_factory=lambda: TrainerConfig(...))
9999
description: str = "Custom description"
100100
```
101101

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies = [
1818
"av>=9.2.0",
1919
"comet_ml>=3.33.8",
2020
"cryptography>=38",
21-
"tyro>=0.6.6",
21+
"tyro>=0.9.8",
2222
"gdown>=4.6.0",
2323
"ninja>=1.10",
2424
"h5py>=2.9.0",
@@ -93,7 +93,6 @@ dev = [
9393
"pre-commit==3.3.2",
9494
"pytest==7.1.2",
9595
"pytest-xdist==2.5.0",
96-
"typeguard==2.13.3",
9796
"ruff>=0.6.1",
9897
"sshconf==0.2.5",
9998
"pycolmap>=0.3.0", # NOTE: pycolmap==0.3.0 is not available on newer python versions
@@ -146,7 +145,7 @@ include = ["nerfstudio*"]
146145
"*" = ["*.cu", "*.json", "py.typed", "setup.bash", "setup.zsh"]
147146

148147
[tool.pytest.ini_options]
149-
addopts = "-n=4 --typeguard-packages=nerfstudio --disable-warnings"
148+
addopts = "-n=4 --jaxtyping-packages=nerfstudio --disable-warnings"
150149
testpaths = [
151150
"tests",
152151
]

tests/plugins/test_registry.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020

2121
@dataclass
2222
class TestConfigClass(MethodSpecification):
23-
config: TrainerConfig = TrainerConfig(
24-
method_name="test-method",
25-
pipeline=VanillaPipelineConfig(),
26-
optimizers={},
23+
config: TrainerConfig = field(
24+
default_factory=lambda: TrainerConfig(
25+
method_name="test-method",
26+
pipeline=VanillaPipelineConfig(),
27+
optimizers={},
28+
)
2729
)
2830
description: str = "Test description"
2931

0 commit comments

Comments
 (0)