Skip to content

Conversation

@kaby76
Copy link
Contributor

@kaby76 kaby76 commented Jun 21, 2023

This PR fixes #4325.

This change removes the python2 target from Antlr. Github Actions removed support of any testing of Python 2.x on June 20, 2023. In addition, official support from python.org for 2.x stopped several years ago.

The instructions for the Python target have been updated with explicit code examples for a minimal parser driver, and the use of a visitor and listener to evaluate an expression of an expression grammar.

@ericvergnaud
Copy link
Contributor

We can't maintain a target without testing so this PR should also remove the Python 2 target altogether

@kaby76
Copy link
Contributor Author

kaby76 commented Jun 21, 2023

We can't maintain a target without testing so this PR should also remove the Python 2 target altogether

If we remove the target testing, then I don't think the next release can be 4.13.1. A "patch" version number change implies fixes to current features, i.e., Python2 targets. I can remove this code from the runtime/ directory, as well as similar directories (e.g., this, grep . -R -i -e python2, etc).

Does anyone know why we are getting this non-deterministic build issue with masos? A build that is not robust in the face of timeouts, network errors, is a bug in itself.

@ericvergnaud
Copy link
Contributor

Yes I guess the next release would 4.14.
You also need to remove the test code, and the codegen code
Should be pretty straightforward

@kaby76
Copy link
Contributor Author

kaby76 commented Jun 21, 2023

Yes, looks easy.

grep . -R -i -e python2 | grep -v '[.]git'
grep . -R -i -e "python 2" | grep -v '[.]git'"
find . -iname 'python2'
grep . -R -i -e "python targets" | grep -v '[.]git'

The examples from the ANTLR 4 book converted to Python are [here](https://github.com/jszheng/py3antlr4book).

There are 2 Python targets: `Python2` and `Python3`. This is because there is only limited compatibility between those 2 versions of the language. Please refer to the [Python documentation](https://wiki.python.org/moin/Python2orPython3) for full details.
There is ONE Python target: `Python3`. This is because there is only limited compatibility between those 2 versions of the language. Please refer to the [Python documentation](https://wiki.python.org/moin/Python3) for full details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this can be rephrased a bit ?

## Where can I get the runtime?

Once you've generated the lexer and/or parser code, you need to download the runtime. The Python runtimes are available from PyPI:
Once you've generated the lexer and/or parser code, you need to download the runtime. The Python runtime are available from PyPI:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are -> is

@kaby76
Copy link
Contributor Author

kaby76 commented Jun 21, 2023

Thanks. I was about to Grammarly/ChatGPT the crap out of these files. I think I'll move the "Target Agnostic Format" into a completely different page. I now have some experience in getting target-agnostic working for all targets--probably more than anyone else.

@kaby76 kaby76 marked this pull request as draft June 22, 2023 09:19
@kaby76
Copy link
Contributor Author

kaby76 commented Jun 23, 2023

I rewrote the entire python-target.md file.

  • The style of the English is more formal.
  • Contractions are removed.
  • Unclear antecedants are removed.
  • Code snippets for hypothetical examples are replaced with real-world examples.

@kaby76
Copy link
Contributor Author

kaby76 commented Jun 23, 2023

https://github.com/antlr/antlr4/pull/4326/checks?check_run_id=14489678593, and specifically: in every commit.

This is a bit of unnecessary overhead. Git records the author name and email already in the commit. The author information is also in the /readme.md.

The info is already all there. git show displays it all.

$ git show  9eaa38ffaa2647b9c1144f3c2557d4b131df4d04
commit 9eaa38ffaa2647b9c1144f3c2557d4b131df4d04
Author: Ken Domino <[email protected]>
Date:   Wed Jun 21 11:37:56 2023 -0400

    Fix for @4325--python2 testing not available on Github Actions.

diff --git a/.github/workflows/hosted.yml b/.github/workflows/hosted.yml
index 01deeaea0..1511fbf80 100644
--- a/.github/workflows/hosted.yml
+++ b/.github/workflows/hosted.yml
@@ -174,7 +174,6 @@ jobs:
           javascript,
           typescript,
           php,
-          python2,
           python3,
           # swift,
         ]
@@ -233,13 +232,6 @@ jobs:
       if: startswith(matrix.os, 'windows') && (matrix.target == 'cpp')
       uses: microsoft/[email protected]

-    - name: Set up Python 2
-      if: matrix.target == 'python2'
-      uses: actions/setup-python@v4
-      with:
-        python-version: '2.x'
-        architecture: 'x64'
-
     - name: Set up Python 3
       if: matrix.target == 'python3'
       uses: actions/setup-python@v4
@@ -316,7 +308,6 @@ jobs:

The more I look at this, the more I think the DCO add-in doesn't work.

@ericvergnaud
Copy link
Contributor

I agree that the DCO add-in isn't clever enough. If you can propose a better solution I will likely support it :-)

@kaby76
Copy link
Contributor Author

kaby76 commented Jun 23, 2023

According to the DCO code, there is a isRequiredFor(author.login) test. Assuming auhor.login is not null, it all goes to where it fails commit.verification.verified, then onto the code that computes verification, and outputs the message here. So, getSignOffs returns a zero-length object. Is it that you have to have the exact string "Signed-off-by:" in the message itself, even though it is all over the git record? Who wrote this piece of poorly thought-out crap?

@kaby76
Copy link
Contributor Author

kaby76 commented Jun 23, 2023

-s -S are git command-level options. (Git in itself is warped because there is so much authentication already happening.) I have been using Github Desktop for commits. (Unfortunately, I flip among different front ends because they all suck.) But, Github Desktop doesn't have a way to specify the -s -S options. desktop/desktop#5351 Blocked from using Github Desktop.

@ericvergnaud
Copy link
Contributor

ericvergnaud commented Jun 23, 2023 via email

@ericvergnaud
Copy link
Contributor

Let's move this DCO stuff to a conversation?

@kaby76
Copy link
Contributor Author

kaby76 commented Jun 23, 2023

I use SourceTreeEnvoyé de mon iPhoneLe 23 juin 2023 à 13:54, Ken Domino @.> a écrit : -s -S are git command options. Git in itself is warped because there is so much authentication already happening. I have been using Github Desktop for commits (I flip among different front ends because they all suck). But, Github Desktop doesn't have a way to specify the -s -S options. desktop/desktop#5351 Blocked from using Github Desktop. —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.>

Yes, I also use SourceTree, but it also has issues, especially on Windows. They can't seem to get the UI working. But, there was something else, and I can't remember why I started using Github Desktop predominately for the last few months.

@kaby76
Copy link
Contributor Author

kaby76 commented Jun 25, 2023

Closing and reopening as another PR because git rebase does not work (conflicts), git commit doesn't work (insists on user name and password which does not work anymore with Github.com), etc., etc., etc. #4331

@kaby76 kaby76 closed this Jun 25, 2023
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.

[CI testing] Build fails because Python2 is no longer supported on Github Actions.

2 participants