Absl flags pathlib support
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 279
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 1
Description
Are there any plans to support a `flags.DEFINE_path` or something similar that utilizes python's `pathlib` module to support declaring `os.PathLike` operations for the default option?
For context, I often find myself doing the following:
```py
from absl import app, flags
from pathlib import Path
FLAGS = flags.FLAGS
flags.DEFINE_string("filepath", "path/to/some.txt", "Input filepath for program")
def main(argv_):
# Override FLAGS.filepath with a pathlib.Path version
FLAGS.filepath = Path(FLAGS.filepath)
# Rest of program uses pathlib for path operations
if __name__ == "__main__":
app.run(main)
```
It would be awesome if there was an easy way to define a `Path` object from the `DEFINE_` definition in the first place. If adding such a feature is not feasible, I'm curious how other people are using `pathlib` with `absl.flags` as well.
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.