[wip-ish] Make click package optional#26
Open
alberth wants to merge 1 commit intoigordejanovic:masterfrom
Open
[wip-ish] Make click package optional#26alberth wants to merge 1 commit intoigordejanovic:masterfrom
alberth wants to merge 1 commit intoigordejanovic:masterfrom
Conversation
Owner
|
@alberth I fully agree with this. click is usable only during development and should not be required at all during run-time. I agree also with messages in exceptions. I've been bitten by this in several occasions and was planning to rework that part. Please, feel free to hack on that. |
Contributor
Author
|
As parglare doesn't look like the answer to my problem (I am fighting the parser and not the problem I am supposed to solve), and I can't afford to trying to make it work longer, I have to switch to a different more manual solution. As such, I won't work on this problem in the near future. |
Owner
|
No problem. Thanks for stopping by and for all your contributions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not sure how you feel about this, if you don't like it, that's fine, I'll hack it locally then.
While the dominant use-case for a parser is in a batch-oriented program that you run from the command line, parsers are also used in other contexts. One big example is running in the background of an editor as compiler frontend to give GUI feedback while the user is editing. In my case, I intend to use your parser at a web server, as a compile service.
There is no "unix command-line" inside a web server (or an editor). I don't want to install 'click' at the server, as it's completely useless in that environment. If I want fancy coloured and formatted output (and I am far from sure about that currently), it would need to be HTML rather than some terminal escape sequences, or the web client can't display it.
Not installing 'click' currently breaks the parser, due to a
parser -> exceptions -> termui -> clickimport chain. This patch make the final link optional, by allowing the click import to fail, which then falls back to standard Python stuff.I have not tested this extensively yet, since I am still in the process of getting the grammar figured out and attaching actions to it. I thought it to be wise to ask you about this early in the process. If you are not interested, I will just hack a local patch until it works for me.
There is at least one other thing that looks scary to me, all the styled messages in the exceptions. I'll have to test how that behaves, but I need a working grammar/compiler for that first.
One possible direction can be to make exception objects just store the exceptions (and nothing else), and have a separate
parglare.pretty_printmodule, that canpretty_print(my_exception). Slightly less nice thanprint(str(my_exception))but more useful in environments that have no unix terminal.