-
Notifications
You must be signed in to change notification settings - Fork 265
Open
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:
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!
kaparoo, markmcd, JesseFarebro, GMNGeoffrey, chenzizhao and 1 more
Metadata
Metadata
Assignees
Labels
No labels