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

Version 1.7.0 (last to support python 2.7) depends on a version of pycodestyle that does not support 2.7 #769

Open
magnus-puresalmon opened this issue Sep 10, 2024 · 1 comment

Comments

@magnus-puresalmon
Copy link

magnus-puresalmon commented Sep 10, 2024

I am, unfortunately, working on a system that is stuck on 2.7 (specifically it's stuck on using jython, which is itself stuck on 2.7).
I wanted to get a code formatter for VSCode that could help, found this GitHub issue: microsoft/vscode-python#21991 and tried doing method 1 there, but I could not install 1.7.0 due to a dependency on pycodestyle 2.9.1, which doesn't support Python 2.7

While I'd like for this to result in some minimal work to make 1.7.0 use a 2.7 compliant version of pycodestyle, I'd expect it'd be simpler to declare 1.7.0 as not supporting 2.7 (which would make the solution where I'm using autopep8 extension for VSCode break, since the extension requires autopep8>=1.7.0 for the autopep8 version if using an external file)


Command Line

$ ./python -m pip install autopep8==1.7.0
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting autopep8==1.7.0
  Downloading autopep8-1.7.0-py2.py3-none-any.whl (45 kB)
Collecting toml
  Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
ERROR: Could not find a version that satisfies the requirement pycodestyle>=2.9.1 (from autopep8==1.7.0) (from versions: 1.8.0.dev0, 2.0.0a1, 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.3.1, 2.4.0, 2.5.0, 2.6.0a1, 2.6.0, 2.7.0, 2.8.0)
ERROR: No matching distribution found for pycodestyle>=2.9.1 (from autopep8==1.7.0)

Your Environment

  • Python version: 2.7.18
  • autopep8 version: 1.7.0
  • Platform: windows 11
@magnus-puresalmon
Copy link
Author

magnus-puresalmon commented Sep 10, 2024

I also tried hacking around the version requirement by editing the source of pycodestyle so it declared support for 2.7, but that broke because pycodestyle 2.9.1 uses f-string syntax which is unavailable when built for 2.7.
On the other hand, autopep8 1.7.0 using pycodestyle 2.8.0 succesfully parses, but fails at runtime due to a unicode-string error (so it is very likely 1.7.0 shouldn't even declare support for python 2.7)

I also had to change a line of code in the VSCode extension so it could read stderr and not stdout, because apparently autopep8 1.7.0 emits --version info to stderr instead of stdout for some reason.

VSCode settings (username omitted):

{
    "python.analysis.typeCheckingMode": "off",
    "[python]": {
        "editor.defaultFormatter": "ms-python.autopep8"
    },
    "autopep8.importStrategy": "fromEnvironment",
    "autopep8.path": [
        "C:/Users/username/AppData/Local/Python/2.7/Scripts/autopep8.exe"
    ],
    "autopep8.interpreter": [
        "C:/Users/username/AppData/Local/Python/Python311-32/python.exe"
    ]
}

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

1 participant