-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Absl flags pathlib support #165
Comments
Internally I do see one recent user contributed library that implements its own flags.disclaim_key_flags() # Prevent absl from attributing flags to this module.
class _PathParser(flags.ArgumentParser):
def parse(self, value):
return pathlib.PurePath(value)
class _PathSerializer(flags.ArgumentSerializer):
def serialize(self, value):
return str(value)
def DEFINE_path(...):
return flags.DEFINE(_PathParser(), name, default, help, flag_values,
_PathSerializer(), **kwargs) I agree, it'd make sense to add something like that to absl itself as pathlib is gaining popularity. Internal source: |
Just wondering if there was any update on this? I'd say the |
Yes this is in my queue, hopefully I can get to it after the holidays if not earlier. |
Perhaps |
_PATH = epath.DEFINE_path('path', None, 'Path to input file.') This is a Googler-project, so may be what gps was describing. Or maybe not :) |
Are there any plans to support a
flags.DEFINE_path
or something similar that utilizes python'spathlib
module to support declaringos.PathLike
operations for the default option?For context, I often find myself doing the following:
It would be awesome if there was an easy way to define a
Path
object from theDEFINE_
definition in the first place. If adding such a feature is not feasible, I'm curious how other people are usingpathlib
withabsl.flags
as well.Thanks!
The text was updated successfully, but these errors were encountered: