Is there a particular reason we use Antlr 3 instea...
# general
h
Is there a particular reason we use Antlr 3 instead of Antlr 4, beyond not keeping the version up-to-date? I’m investigating Py3 failure and think we may need to upgrade, but not sure yet
Hm, ambiguous results Locally,
backend/codegen/antlr/python:integration
works for me On CI, we get
SourcePackage(u'file:///home/travis/.cache/pants/python_cache/requirements/CPython-3.5.2/antlr_python_runtime-3.1.3.zip') is not translateable by ChainedTranslator(WheelTranslator, EggTranslator, SourceTranslator)
Antlr 3's Py docs state
The following Python versions are supported: 2.4 2.5
Does not sound like Py3 would work then.. which is why I’m surprised the test passes locally
If we choose to stick with Antlr3, I think there’s a dedicated runtime we can download and bootstrap to work with Py3? https://github.com/antlr/antlr3/tree/master/runtime/Python3
a
do we have any examples of graceful degradation with py2/3?
h
We haven’t had to deprecate anything yet (which is amazing). The most we’ve done is upgrade dependencies, e.g. in the process of upgrading Thrift one major version
a
that is amazing
h
P.S. Benjy and I have been DM-ing about this. Antlr3 doesn’t work on Py3, at least what’s available on their website and PyPi (they made some updates on GitHub and never released)
a
i am not familiar with the pants antlr users but it feels to me like we could add antlr 4 and keep our current antlr 3 support and drop it when we drop py2 -- if it's not too much work to support antlr3 with the link you've mentioned then we may not have to do that sort of thing yet
e
what’s available on their website and PyPi
It's subtle, but antlr is not in fact available on pypi 😕 - I was hoping, but alas no.
h
They added it back to PyPi, the Antlr3 runtime: https://pypi.org/project/antlr_python_runtime/. However, the last version published is 3.1.3 whereas the version we would need to run it using Python 3 is v 3.4. Someone made an issue two years ago asking them to publish v3.4, and their response was “use Antlr4” 😕 Benjy authored a good workaround, that we run the Antlr Python tool using a Python 2 subprocess. https://github.com/pantsbuild/pants/pull/6924#pullrequestreview-184854031 He explained to me how this will work even when we change Pants to Py3 under the hood 🎉
e
Eric Arellano [40 minutes ago]
They added it back to PyPi, the Antlr3 runtime: https://pypi.org/project/antlr_python_runtime/
Nope! It is subtle. If you hover over the download link you'll find http://antlr3.org/download/Python/antlr_python_runtime-3.1.3.tar.gz And there is no pypi index link redir so you cannot respolve from pypi (try pip or pex): https://pypi.org/simple/antlr-python-runtime/
h
Oh well that’s no good! Nice catch.