Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a219451

Browse filesBrowse files
authored
Revert removals introduced in v78.0.0 (#4911)
2 parents 5450f57 + d4326dd commit a219451
Copy full SHA for a219451

File tree

Expand file treeCollapse file tree

4 files changed

+45
-11
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+45
-11
lines changed

‎.github/workflows/main.yml

Copy file name to clipboardExpand all lines: .github/workflows/main.yml
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ jobs:
6464
python: "3.10"
6565
distutils: stdlib
6666
runs-on: ${{ matrix.platform }}
67-
continue-on-error: ${{ matrix.python == '3.14' }}
67+
continue-on-error: ${{ matrix.python == '3.14' || matrix.python == 'pypy3.10' }}
68+
# XXX: pypy seems to be flaky with unrelated tests in #6345
6869
env:
6970
SETUPTOOLS_USE_DISTUTILS: ${{ matrix.distutils || 'local' }}
7071
timeout-minutes: 75

‎newsfragments/4911.bugfix.rst

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Postponed removals of deprecated dash-separated and uppercase fields in ``setup.cfg``.
2+
All packages with deprecated configurations are advised to move before 2026.

‎setuptools/dist.py

Copy file name to clipboardExpand all lines: setuptools/dist.py
+24-4Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,21 +626,41 @@ def _enforce_underscore(self, opt: str, section: str) -> str:
626626
if "-" not in opt or self._skip_setupcfg_normalization(section):
627627
return opt
628628

629-
raise InvalidConfigError(
629+
underscore_opt = opt.replace('-', '_')
630+
affected = f"(Affected: {self.metadata.name})." if self.metadata.name else ""
631+
SetuptoolsDeprecationWarning.emit(
630632
f"Invalid dash-separated key {opt!r} in {section!r} (setup.cfg), "
631-
f"please use the underscore name {opt.replace('-', '_')!r} instead."
633+
f"please use the underscore name {underscore_opt!r} instead.",
634+
f"""
635+
Usage of dash-separated {opt!r} will not be supported in future
636+
versions. Please use the underscore name {underscore_opt!r} instead.
637+
{affected}
638+
""",
639+
see_docs="userguide/declarative_config.html",
640+
due_date=(2026, 3, 3),
632641
# Warning initially introduced in 3 Mar 2021
633642
)
643+
return underscore_opt
634644

635645
def _enforce_option_lowercase(self, opt: str, section: str) -> str:
636646
if opt.islower() or self._skip_setupcfg_normalization(section):
637647
return opt
638648

639-
raise InvalidConfigError(
649+
lowercase_opt = opt.lower()
650+
affected = f"(Affected: {self.metadata.name})." if self.metadata.name else ""
651+
SetuptoolsDeprecationWarning.emit(
640652
f"Invalid uppercase key {opt!r} in {section!r} (setup.cfg), "
641-
f"please use lowercase {opt.lower()!r} instead."
653+
f"please use lowercase {lowercase_opt!r} instead.",
654+
f"""
655+
Usage of uppercase key {opt!r} in {section!r} will not be supported in
656+
future versions. Please use lowercase {lowercase_opt!r} instead.
657+
{affected}
658+
""",
659+
see_docs="userguide/declarative_config.html",
660+
due_date=(2026, 3, 3),
642661
# Warning initially introduced in 6 Mar 2021
643662
)
663+
return lowercase_opt
644664

645665
def _skip_setupcfg_normalization(self, section: str) -> bool:
646666
skip = (

‎setuptools/tests/config/test_setupcfg.py

Copy file name to clipboardExpand all lines: setuptools/tests/config/test_setupcfg.py
+17-6Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from setuptools.config.setupcfg import ConfigHandler, Target, read_configuration
1212
from setuptools.dist import Distribution, _Distribution
13-
from setuptools.errors import InvalidConfigError
1413
from setuptools.warnings import SetuptoolsDeprecationWarning
1514

1615
from ..textwrap import DALS
@@ -423,7 +422,7 @@ def test_not_utf8(self, tmpdir):
423422
pass
424423

425424
@pytest.mark.parametrize(
426-
("error_msg", "config"),
425+
("error_msg", "config", "invalid"),
427426
[
428427
(
429428
"Invalid dash-separated key 'author-email' in 'metadata' (setup.cfg)",
@@ -434,6 +433,7 @@ def test_not_utf8(self, tmpdir):
434433
maintainer_email = foo@foo.com
435434
"""
436435
),
436+
{"author-email": "test@test.com"},
437437
),
438438
(
439439
"Invalid uppercase key 'Name' in 'metadata' (setup.cfg)",
@@ -444,14 +444,25 @@ def test_not_utf8(self, tmpdir):
444444
description = Some description
445445
"""
446446
),
447+
{"Name": "foo"},
447448
),
448449
],
449450
)
450-
def test_invalid_options_previously_deprecated(self, tmpdir, error_msg, config):
451-
# this test and related methods can be removed when no longer needed
451+
def test_invalid_options_previously_deprecated(
452+
self, tmpdir, error_msg, config, invalid
453+
):
454+
# This test and related methods can be removed when no longer needed.
455+
# Deprecation postponed due to push-back from the community in
456+
# https://github.com/pypa/setuptools/issues/4910
452457
fake_env(tmpdir, config)
453-
with pytest.raises(InvalidConfigError, match=re.escape(error_msg)):
454-
get_dist(tmpdir).__enter__()
458+
with pytest.warns(SetuptoolsDeprecationWarning, match=re.escape(error_msg)):
459+
dist = get_dist(tmpdir).__enter__()
460+
461+
tmpdir.join('setup.cfg').remove()
462+
463+
for field, value in invalid.items():
464+
attr = field.replace("-", "_").lower()
465+
assert getattr(dist.metadata, attr) == value
455466

456467

457468
class TestOptions:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.