-
Notifications
You must be signed in to change notification settings - Fork 25
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
Comparison with DocOpt.jl #134
Comments
Comonicon.jl eagerly generates and saves Julia AST for the main function so there's almost no loading time overhead while still provides you all the easy-usability of DocOpt.jl or ArgParse.jl. You'll simply be annoyed if calling a CLI tool spends more than 2s in loading ArgParse and parsing the inputs, especially when the main functionality of your CLI took less than a second. |
Thanks for the question, to be short, the syntax of DocOpt is not designed for Julia but for Python, it is not Julian but Pythonic, there is also a discourse announcement: https://discourse.julialang.org/t/comonicon-jl-fast-simple-and-light-weight-cli-generator/43744 On the other hand, DocOpt is much more mature and will not change much anymore since it's been there for a while, but Comonicon but let me clarify a bit more and maybe even compare with some more packages SyntaxIn general, I believe the design of Comonicon is much less invasive, which is like google/fire, you won't need to learn much special syntax or API, only a For single command CLIthere is no big difference for the interface if one only has a single function to use as CLI and only writes a script (say For multi command CLIHowever, you will find things become inconvenient for DocOpt/ArgParse when there are multiple commands (nested commands), this is because the parsed output comes from However, google/fire has the disadvantage when you write the documentation, thus, Python community created docopt.org aims to remove the duplication between docstring of a CLI However, all existing Julia solutions seems to only copy the design from Python instead of taking this seriously before Comonicon. Shell Completionwe are the only implementation supports shell completions (tho only ZSH is supported at the moment) PerformanceThe compile latency problem is quite well known, Comonicon aims to reduce this latency by making things as easy as possible for Julia to compile, so that Julia compiler won't panic. I believe @johnnychen94 however, from v0.11.x I'm thinking on a design choice not supporting compile cache for scripts, since most of the time scripts in Julia is slow anyway, this makes the start up time much slower for scripts at the moment. maintaining Comonicon's own Beyond CLIsComonicon is not just a CLI generator, it is actually a complete compiler that compiles an embeded DSL in Julia to other targets, this is why it also supports shell auto-completion and even in principle support So in summary, I don't see any reason why would one wants to use DocOpt/ArgParse at all except Comonicon is less mature. |
Thank you all for the clarifications. It would be nice to see this information in the README 💯 |
actually I think instead of generating compile cache, using deamon mode for scripts will be a better approach, but I prob won't have time to do it recently. |
I' m quite confused about it being like fire. Is there an example in doc that is similar to the function of https://github.com/orangeSi/Jfire.jl ? The example at quickstart:
is confusing |
As pointed out by its own description the spirit of Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. No there is no similar interface the point of Comonicon is to not use any non-Julian interface for Julian CLI, I think the implementation of Jfire will suffer latency problem if anyone has interested to revive that old code. What is similar here is both Fire and Comonicon transform an object to CLI, and in Julia the object is limited to modules and functions.
Where do you find that example? The quick start example is here: https://comonicon.org/stable/ there is also an example in README |
Thanks, I found that at https://comonicon.org/stable/ , you can search for the first line |
I see. Yeah that is not well written indeed, I suggest you read the CLI project section instead https://comonicon.org/dev/project/ and try run it. There are more examples in the examples folder.
I'm not sure why Comonicon has more developer time than JFire, the only thing is to put I'm not sure what's your use case, but |
Closing as discussion. There is no issue to be solved here. |
Could you explain the main differences so that I can more easily choose between the available approaches in future projects?
https://github.com/docopt/DocOpt.jl
Perhaps adding a section to the README would be helpful.
The text was updated successfully, but these errors were encountered: