swansonk14 / typed-argument-parser

Typed argument parser for Python
MIT License
505 stars 40 forks source link

[Feature request] Have `Tap.save` accept a `Path` variable from `pathlib` #103

Closed chen-yingfa closed 1 year ago

chen-yingfa commented 1 year ago

pathlib has been introduced since 3.4, and is much more convenient than strings in managing system paths. But now the save function still raise type error when passing a Path variable.

Workaround for now: use args.save(str(a_path_var))

swansonk14 commented 1 year ago

Hi @donny-chan,

Thank you for bringing this to our attention! We agree and have made the fix in this commit: https://github.com/swansonk14/typed-argument-parser/commit/d26f0b8be624b966635e40e0f3c3b4f8e0894b93. We changed the type of all paths from str to Union[str, os.PathLike]. This fix will be included in the next release.

Best, Jesse and Kyle