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

Python 3? #64

Open
efroemling opened this issue Feb 18, 2022 · 9 comments
Open

Python 3? #64

efroemling opened this issue Feb 18, 2022 · 9 comments

Comments

@efroemling
Copy link
Contributor

I was recently reading that the next minor update to macOS (12.3) will finally remove python 2.x (not to mention that 2.x has been EOL for a while now) which got me wondering if porting pycheckers to 3.x would be a big pain.

If someone wants to run a 2to3 pass and set up a test branch or something, I'd be happy to help test it out (at least the mypy3 and pylint checkers). Also happy to set up said branch myself otherwise. Anyone else interested or has anyone tried this already?

@msherry
Copy link
Owner

msherry commented Feb 18, 2022

Hi there - thanks for the issue!

What changes would be involved in porting to py3? AFAIK it currently runs correctly, so would this just involve modernizing the code style in a non-backwards-compatible way (i.e., does this issue really mean dropping support for py2)?

@efroemling
Copy link
Contributor Author

Oh; if it already runs correctly under 3, that's great news. Then maybe the only change needed would be to change the script's shebang to #!/usr/bin/env python3?
(According to Pep-394 python isn't supposed to point at Python 3, though perhaps this is changing now that Python 2 is going away?..)

Perhaps the best option would be allowing specifying the python command to invoke for the script instead of relying on the shebang? (or is this already in there somewhere?)

@efroemling
Copy link
Contributor Author

Actually, on reading over Pep-394 again, it sounds like allowing python to point to a python 3 version might be a more acceptable thing than I remembered. So perhaps nothing at all needs to be done if that is the case?...

Though perhaps configurability or some other smarts could still be useful since plain 'python' is becoming more rare. (and latest macOS currently pops up a scary 'This software needs to be updated' dialog anytime something invokes 'python')

@szykes
Copy link

szykes commented Oct 12, 2022

Hi,

I experienced similar issue that is written in the previous comment.

I use macOS 12.6 and there is no called python just python3. Therefore, when the flychecker-pycheckers runs bin/pycheckers.py, it will result error env: python: No such file or directory.

Changing shebang to python3 solves the problem but this is not the right solution.

Would it be possible to make this change official?

@msherry
Copy link
Owner

msherry commented Oct 13, 2022

@szikes-adam thank you for your comment! If I am understanding your request correctly, you are asking to make this change, correct?

diff --git a/bin/pycheckers.py b/bin/pycheckers.py
index d59bf20..69209c9 100755
--- a/bin/pycheckers.py
+++ b/bin/pycheckers.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 """A hacked up version of the multiple-Python checkers script from EmacsWiki.
 
 Original work taken from http://www.emacswiki.org/emacs/PythonMode, author

This would have the effect of dropping python 2 compatibility. Do you know if it's common to only have python3 on a system, with no executable (symlink or otherwise) called just python?

@szykes
Copy link

szykes commented Oct 14, 2022

This would have the effect of dropping python 2 compatibility. Do you know if it's common to only have python3 on a system, with no executable (symlink or otherwise) called just python?

Yes, I think. I have checked the vanilla Ubuntu 22.04 and it does not contain python binary, only python3. However, Ubuntu has own package the python-is-python3 that solves the issue. But we need to assume not everyone has sudo right on their Linux.

I have been thinking about this problem. Actually the true question is: whether your script will work properly, if the system runs pycheckers.py with python3 and the edited code is python2? I guess the answer is yes and in this case, you can commit your change because the first release of python 3 was in end of 2008.

@bernarduh
Copy link

Hi there.

I'm having trouble running bin/pycheckers.py on a fresh install of Ubuntu 22.04.

The issues I have are:

  • Shebang is using python instead of python3;
  • Running the script output deprecation warnings ("distutils.version" is deprecated).

All issues come down to having this script properly migrated to Python3.

I understand that developers might have to continue supporting Python2 scripts and therefore it could be useful that this script is to be able to lint Python2 scripts. But that doesn't mean running our development environment on a system that still uses Python2. I think it is time for us to migrate this script to Python3 eventought we can try to keep support linting Python2 scripts.

@bernarduh
Copy link

I made some changes regarding the above in a branch. How can I submit the changes for review? Should I fork the repo for this?

@msherry
Copy link
Owner

msherry commented Nov 8, 2022

I think a fork and PR would be great!

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

No branches or pull requests

4 participants