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

[Feature Request] Support executing with -OO or OPTIMIZE=2 #121

Open
mgiamberardino opened this issue Apr 10, 2023 · 2 comments
Open

[Feature Request] Support executing with -OO or OPTIMIZE=2 #121

mgiamberardino opened this issue Apr 10, 2023 · 2 comments

Comments

@mgiamberardino
Copy link

PLY has the option to support running in optimized mode if we can somehow generate the tables on a first run:
PLY - Using Python's Optimized Mode

If instead of compiling the parser each time we could generate and store them with write_tables=1 we could still run jsonpath-ng using -OO.

def __init__(self, debug=False, lexer_class=None):
        if self.__doc__ is None:
            raise JsonPathParserError(
                'Docstrings have been removed! By design of PLY, '
                'jsonpath-rw requires docstrings. You must not use '
                'PYTHONOPTIMIZE=2 or python -OO.'
            )
@jkugler
Copy link

jkugler commented Nov 16, 2023

Also, the author of PLY created SLY: https://github.com/dabeaz/sly which is more programmatic , and thus doesn't require doc strings. And I'm sure there are other parsers out there which don't require doc strings. This would be a great enhancement, as running -OO is a rather common thing.

@jkugler
Copy link

jkugler commented Nov 16, 2023

Also, in your search for a new parser, finding a parser which is compatible with Apache/MIT/BSD might be good. The fact that PLY has no license could be problematic for some organizations. It looks like SLY has a BSD license which would be a good choice.

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

No branches or pull requests

3 participants