File tree Expand file tree Collapse file tree 1 file changed +3
-30
lines changed
Expand file tree Collapse file tree 1 file changed +3
-30
lines changed Original file line number Diff line number Diff line change @@ -119,49 +119,22 @@ logger.info(rich.pretty.pretty_repr(config))
119119pydantic 사용법은 공식 문서를 참고하세요.
120120
121121
122- # # typer를 이용한 방법
122+ # # cyclopts를 이용한 방법
123123
124- Typer는 argparse보다 장점이 많습니다.
124+ cyclopts는 argparse보다 장점이 많습니다.
125125
1261261. typing을 이용해 명확하게 parameter를 정의할 수 있음.
1271272. command line 프로그램이 쉽게 API로 노출됨.
128128 - 예: ` my-program run --batch-size 32` 를 ` import my_program; my_program.run(batch_size=32)` 로 사용 가능
1291293. shell completion도 쉽게 설치해 사용 가능.
130130
131- 복잡한 config 대신 typer를 이용해 command line argument로 사용하는 것도 좋은 방법입니다. 특히 다음과 같은 경우에 유용합니다.
131+ 복잡한 config 대신 cyclopts를 이용해 command line argument로 사용하는 것도 좋은 방법입니다. 특히 다음과 같은 경우에 유용합니다.
132132
1331331. 변수 개수가 몇 개 없는 경우
134134
135135
136136# # dataclass과 환경변수를 이용한 방법
137137
138- 사용법을 먼저 보여드리자면,
139-
140- # ## ::: ml_project.utils.config._ExampleConfig
141- options:
142- show_docstring_description: true
143- show_docstring_examples: false
144- members: false
145- show_bases: false
146- show_source: true
147-
148- # ## ::: ml_project.utils.config._ExampleConfig
149- options:
150- show_docstring_description: false
151- show_docstring_examples: true
152- members: false
153- show_bases: false
154- show_source: false
155-
156- BaseConfig 소스코드:
157- # ## ::: ml_project.utils.config.BaseConfig
158- options:
159- show_docstring_description: false
160- show_docstring_examples: false
161- members: false
162- show_bases: false
163- show_source: true
164-
165138# ## 장점
166139
1671401. 간단 명료한 dataclass를 만들어 typing 및 default 값 pylance의 go to definition 기능으로 확인하기 좋음.
You can’t perform that action at this time.
0 commit comments