KeyError: 'metadata'
MarcoGorelli opened this issue · 1 comments
MarcoGorelli commented
Here is my setup.cfg
file:
[bumpversion]
current_version = 0.2.1
[flake8]
ignore = E203,E503,W504
max-line-length = 120
exclude = venv,.*
[pydocstyle]
add-ignore = D104
[mypy]
disallow_untyped_defs = True
[mypy-pytest]
ignore_missing_imports = True
[mypy-_pytest.capture]
ignore_missing_imports = True
[mypy-setuptools]
ignore_missing_imports = True
[mypy-setup]
ignore_errors = True
[mypy-conf]
ignore_errors = True
Here's the error from pre-commit run --all
:
setup-cfg-fmt............................................................Failed
- hook id: setup-cfg-fmt
- exit code: 1
Traceback (most recent call last):
File "/home/marco/.cache/pre-commit/repoowkkinfn/py_env-python3/bin/setup-cfg-fmt", line 8, in <module>
sys.exit(main())
File "/home/marco/.cache/pre-commit/repoowkkinfn/py_env-python3/lib/python3.8/site-packages/setup_cfg_fmt.py", line 456, in main
if format_file(
File "/home/marco/.cache/pre-commit/repoowkkinfn/py_env-python3/lib/python3.8/site-packages/setup_cfg_fmt.py", line 331, in format_file
cfg['metadata']['name'] = cfg['metadata']['name'].replace('-', '_')
File "/usr/lib/python3.8/configparser.py", line 960, in __getitem__
raise KeyError(key)
KeyError: 'metadata'
asottile commented
yeah setup-cfg-fmt
assumes you're using some amount of declarative metadata already -- you probably want to run setup-py-upgrade first