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

invalid value for '--target-version' because of not supporting py313 in black 24.8.0 #543

Closed
Snoopy1866 opened this issue Oct 9, 2024 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Issue is not triaged.

Comments

@Snoopy1866
Copy link

Diagnostic Data

  • Python version (& distribution if applicable, e.g., Anaconda): 3.13.0
  • Type of virtual environment used (e.g., conda, venv, virtualenv, etc.): venv
  • Operating system (and version): Windows 10 22H2 19045.5011
  • Version of tool extension you are using: v2024.2.0

Behaviour

Expected Behavior

formatOnSave work at python 3.13.0

Actual Behavior

Black format is not work, below is the log:

2024-10-09 15:02:52.919 [info] [Trace - 15:02:52] Sending request 'textDocument/formatting - (3)'.
2024-10-09 15:02:52.922 [info] [Trace - 15:02:52] Received notification 'window/logMessage'.
2024-10-09 15:02:52.922 [info] c:\Users\wtwang\Documents\GitHub\PyStatPower\PyStatPower\.venv\Scripts\python.exe -m black --stdin-filename c:\Users\wtwang\Documents\GitHub\PyStatPower\PyStatPower\src\pystatpower\numeric.py -
2024-10-09 15:02:52.922 [info] [Trace - 15:02:52] Received notification 'window/logMessage'.
2024-10-09 15:02:52.922 [info] CWD formatter: c:\Users\wtwang\Documents\GitHub\PyStatPower\PyStatPower
2024-10-09 15:02:52.924 [info] [Trace - 15:02:52] Received notification 'window/logMessage'.
2024-10-09 15:02:52.924 [info] Usage: black [OPTIONS] SRC ...
Try 'black -h' for help.

Error: Invalid value for '-t' / '--target-version': 'py313' is not one of 'py33', 'py34', 'py35', 'py36', 'py37', 'py38', 'py39', 'py310', 'py311', 'py312'.

2024-10-09 15:02:52.924 [info] [Trace - 15:02:52] Received response 'textDocument/formatting - (3)' in 5ms.

Reproduction Steps:

  1. vscode settings:
"[python]": {
    "diffEditor.ignoreTrimWhitespace": false,
    "editor.formatOnType": true,
    "editor.wordBasedSuggestions": "off",
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.formatOnSave": true
  },
  1. modify any .py file
  2. click CTRL+S
  3. nothing happened

Logs:

Click here for detailed logs

Outcome When Attempting Debugging Steps:

Did running it from the command line work?

Extra Details

@Snoopy1866 Snoopy1866 added the bug Issue identified by VS Code Team member as probable bug label Oct 9, 2024
@github-actions github-actions bot added the triage-needed Issue is not triaged. label Oct 9, 2024
@Snoopy1866
Copy link
Author

I think just update the black verison to 24.10.0 is enough. Because it works when i run black . in the terminal.

@karthiknadig karthiknadig self-assigned this Oct 9, 2024
@karthiknadig
Copy link
Member

black==24.10.0 drops support for python 3.8. So we will likely have to change minimum supported for this. So we will publish a new version of the extension after 3.8 support is dropped by python.org

If you want to use the latest black, you can set "black-formatter.importStrategy": "fromEnvironment", or `"black-formatter.path: ["${intepreter}", "-m", "black"]

@Snoopy1866
Copy link
Author

Thanks for your suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Issue is not triaged.
Projects
None yet
Development

No branches or pull requests

2 participants