microsoft / microsoft/vscode-black-formatter

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

Open
#543 4 comments 0 reactions 1 assignee View on GitHub

@karthiknadig is already working on this.

Since Oct 9, 2024.

bug triage-needed
Dominant language
Python
Stars
196
Forks
49
Avg merge
1d 5h
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.