grumpyhome / grumpy

Grumpy is a Python to Go source code transcompiler and runtime.
Apache License 2.0
420 stars 18 forks source link

Unvendorize pythonparser (Fixes #108) #117

Closed alanjds closed 5 years ago

alanjds commented 6 years ago

Using PyPI version 1.1 for now. Should pass the last failing test as soon as https://github.com/m-labs/pythonparser/issues/20 got fixed upstream.

The from '__go__'... syntax got implemented via a monkeypatch on pythonparser.parser.Parser. It should be not on upstream as it is clearly not a standard Python syntax, but is there a cleaner way besides a monkeypatch?

I tried to extend Parser class, but it is an old-style class on Python 2 :/

See: https://github.com/m-labs/pythonparser/blob/master/pythonparser/parser.py#L352-L357

class Parser:

    # Generic LL parsing methods
    def __init__(self, lexer, version, diagnostic_engine):
        self._init_version(version)
        self.diagnostic_engine = diagnostic_engine
alanjds commented 6 years ago

pythonparser got a new release by @whitequark. Thank you.

Now this is ready for review and merge.

Question: Why is the construction from '__go__/foo' import ... needed/preferred instead of from __go__.foo import ..., as it is not python-complaint?

alanjds commented 6 years ago

Are you all ok with unvendorizing pythonparser? With no complains I am going to merge this.