Black 24.1.0 was just released and removes support for the deprecated --experimental-string-processing flag (psf/black#4096). This breaks the code in format.py that uses this option:
Traceback (most recent call last):
File ".../python3.11/site-packages/datamodel_code_generator/__main__.py", line 429, in main
generate(
File ".../python3.11/site-packages/datamodel_code_generator/__init__.py", line 463, in generate
results = parser.parse()
^^^^^^^^^^^^^^
File ".../python3.11/site-packages/datamodel_code_generator/parser/base.py", line 1156, in parse
code_formatter: Optional[CodeFormatter] = CodeFormatter(
^^^^^^^^^^^^^^
File ".../python3.11/site-packages/datamodel_code_generator/format.py", line 152, in __init__
self.black_mode = black.FileMode(
^^^^^^^^^^^^^^^
TypeError: Mode.__init__() got an unexpected keyword argument 'experimental_string_processing'
Expected behavior
No crash.
Version:
OS: Linux
Python version: 3.11
datamodel-code-generator version: 0.25.2
black version: 0.24.1
Additional context
Possible mitigation:
add a temporary upper bound to the black version spec in pyproject.toml
same, but in user environment definitions
use --preview --enable-unstable-feature string_processing instead (as suggested by the black release notes).
Describe the bug
Black 24.1.0 was just released and removes support for the deprecated
--experimental-string-processing
flag (psf/black#4096). This breaks the code informat.py
that uses this option:Expected behavior
No crash.
Version:
Additional context
Possible mitigation:
black
version spec in pyproject.toml--preview --enable-unstable-feature string_processing
instead (as suggested by the black release notes).