Skip to content

Deprecation of hyphens in setup.cfg #1950

@ozcodes

Description

@ozcodes

Background
Installing typing with setuptools will soon fail because of hyphens deprecation by setuptools.

Details
setup.cfg is using hyphens for license-file inside metadata, installing it with setuptools version v78.0.1 fails with the following error:

root@39f18ead41c7:/# pip install setuptools==78.0.1
Collecting setuptools==78.0.1
  Downloading setuptools-78.0.1-py3-none-any.whl.metadata (6.6 kB)
Downloading setuptools-78.0.1-py3-none-any.whl (1.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.3/1.3 MB 4.8 MB/s eta 0:00:00
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 65.5.1
    Uninstalling setuptools-65.5.1:
      Successfully uninstalled setuptools-65.5.1
Successfully installed setuptools-78.0.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
root@39f18ead41c7:/# pip install typing
Collecting typing
  Downloading typing-3.7.4.3.tar.gz (78 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-g7b0tk37/typing_decbf43b89854eefba7001bc2ca56d94/setup.py", line 57, in <module>
          setup(name='typing',
        File "/usr/local/lib/python3.11/site-packages/setuptools/__init__.py", line 116, in setup
          _install_setup_requires(attrs)
        File "/usr/local/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in _install_setup_requires
          dist.parse_config_files(ignore_option_errors=True)
        File "/usr/local/lib/python3.11/site-packages/setuptools/dist.py", line 730, in parse_config_files
          self._parse_config_files(filenames=inifiles)
        File "/usr/local/lib/python3.11/site-packages/setuptools/dist.py", line 599, in _parse_config_files
          opt = self._enforce_underscore(opt, section)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/local/lib/python3.11/site-packages/setuptools/dist.py", line 629, in _enforce_underscore
          raise InvalidConfigError(
      setuptools.errors.InvalidConfigError: Invalid dash-separated key 'license-file' in 'metadata' (setup.cfg), please use the underscore name 'license_file' instead.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Test environment details:

  • Macbook Pro M1
  • macOS 15.3.2
  • Docker image python:3.11.11

Note:
The latest versions of setuptools still support hyphens, they decided to postpone the deprecation to 2026.
Reference: https://setuptools.pypa.io/en/stable/history.html#v78-0-2

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: otherOther topics not covered

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions