Skip to content
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

integration with ArgParse #120

Open
CarloLucibello opened this issue Feb 28, 2020 · 3 comments
Open

integration with ArgParse #120

CarloLucibello opened this issue Feb 28, 2020 · 3 comments

Comments

@CarloLucibello
Copy link

CarloLucibello commented Feb 28, 2020

Hi,
this is a feature request for the integration of Params and https://github.com/carlobaldassi/ArgParse.jl. It would be nice to be able to define an ArgParse table from a @with_kw struct. My macro-fu is next to zero, but I think most of the machinery needed is already part of @with_kw, this is why I'm opening the issue here.

With this feature, it would be very easy to create julia code that can be either be included or used as a script. This is the kind of interface I have in mind:

using Parameters, ArgParse

@with_kw struct Params
   a::Int
   b::String = 2         
   c::Bool = true       # comments could become helpstrings.
end

main(; kws...) = main(Params(; kws...))    # just keywords convenience interface

function main(prms::Params)
    ....
end

if abspath(PROGRAM_FILE) == @__FILE__ 
    # executing as a script: julia myfile.jl
    s = ArgParseSettings()
    @add_arg_table! s Params
    prms = parse_args(ARGS, s)    # return a Params object
    main(prms)
end

@mauro3 do you think this is feasible / worth having?
pinging also @carlobaldassi

@CarloLucibello CarloLucibello changed the title integration with ArgPars integration with ArgParse Feb 28, 2020
@DanielRivasMD
Copy link

I second this thought. It'd be great to have such interface

@xgdgsc
Copy link

xgdgsc commented Jul 18, 2021

This interests me also. I' m looking for something like python' s Hydra that provides composable model parameter configurations.

@HumpyBlumpy
Copy link

I fourth this!
This would be very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants