-
Notifications
You must be signed in to change notification settings - Fork 124
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
clikt 4.X grew in jar size to over 8mb #507
Comments
Thanks for the kind words! I don't have plans to make mordant optional, because I don't want to maintain a second copy of all the multiplatform terminal output, text formatting, and help formatting. I'm curious, what does your project look like that a couple MB of package size matters? |
Adding my vote for removing whatever dependencies are possible to remove. I make lots of small programs that use clikt so each dependency clikt has gets multiplied by a lot in my build. |
Mordant is Clikt's only dependency. It provides multiplatform output, prompting, text color and formatting, markdown rendering and more. It's also part of Clikt's public API, so there's no easy way to make it optional. Even if I did, you'd have to supply your own help formatter, prompt implementation, etc. Would you willing to write all that code just to remove a single dependency? If binary size is important, you should be build with R8 or proguard, which would eliminate all the unused code and make removing mordant mostly pointless anyway. |
Doesn't Mordant carry transitive dependencies? Based on Mordant's build script:
So Clikt has at least 4 dependencies for every target right?
No, if Mordant is totally intertwined with Clikt then it is what it is. I'm not complaining, and Mordant seems really cool. I just think that if at any point this library is at a crossroads and has a reasonable decision to make regarding adding/keeping/removing dependencies, I'd lean in the direction of keeping this minimal. If there's no easy and practical changes that can be made right now then I see no issue. I do imagine it might be cool to see a |
I do minimize dependencies; Mordant is Clikt's only direct dependency, and I plan on keeping it that way. I don't even use common libraries like kotlinx.coroutines. I've experimented with a zero-dependency core module in the past, but given how much functionality you'd lose, I'm skeptical that's there's actually a strong enough use case to justify the extra maintenance burden. |
I see two potential and separate improvements that I think could be argued for:
Now let's say both of those changes are made, there's one more argument: Should Clikt have built-in markdown parsing? Personally I have only used this once. I think you could probably argue that the built-in help should respect double newlines but otherwise reflow text. Separately, a Whether that happens I think is less important than the first two points. Those seems like pretty clear wins. |
A lot of the time I am only use Clikt as a typesafe argument parser, since it has a really nicely written API for this. What I am gathering from this conversation is that the current dependencies are required for output. Fancy terminal output is nice and often I want it, but it is not strictly required. Maybe a "core" module would not render output, or would only render extremely minimal simple strings. We have been discussing in #503 about modularizing the "runner" out so that we could have a suspend runner, coroutine runner, etc. Maybe in a similar way, we can modularize out the "renderer". Here is an idea. A ClickCommand will have a abstract class BaseCliktCommand<T> {
open protected val renderer: OutputRenderer = SimplePrintingRenderer
}
interface OutputRenderer {
fun info()
fun warning()
fun prompt()
} Looking at the The main pro here is that a zero-dependency core becomes possible. The main con is maybe adding more code to maintain. A secondary pro is having some sort of pluggable
Are you usually maintaining this project alone? I trust your judgement about what is realistically possible. |
|
Hi,
first of all, like #178, I also consider this to be the most ergonomic cli parsing library out there! Thanks for making it!.
I just noticed that my bundled dependencies grew by a lot.
Some investigations led to clikt:
and it's transitive dependencies like:
As far as I understand the new markdown feature introduced in 4.0 led to the increase of dependencies.
Is it still possible for you to make the markdown (other visualization methods than just text) optional?
The text was updated successfully, but these errors were encountered: