Skip to content

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

@Snoopy1866

Description

@Snoopy1866

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

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugtriage-neededIssue is not triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions