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

[wip-ish] Make click package optional #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alberth
Copy link
Contributor

@alberth alberth commented Feb 7, 2018

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 -> click import 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_print module, that can pretty_print(my_exception). Slightly less nice than print(str(my_exception)) but more useful in environments that have no unix terminal.

@coveralls
Copy link

coveralls commented Feb 7, 2018

Coverage Status

Coverage decreased (-0.09%) to 85.1% when pulling aa60618 on alberth:unglue-clicker into db66177 on igordejanovic:master.

@igordejanovic
Copy link
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.

@alberth
Copy link
Contributor Author

alberth commented Feb 9, 2018

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.

@igordejanovic
Copy link
Owner

No problem. Thanks for stopping by and for all your contributions.

@GabDug GabDug mentioned this pull request Jul 12, 2022
7 tasks
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

Successfully merging this pull request may close these issues.

3 participants