From 3ec03a757c888d71dfb4240f5b5f1743eceaa697 Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Fri, 23 Jan 2026 14:49:04 -0800 Subject: [PATCH 1/2] Allow authors to use different email addresses in different PEPs The context here is that Yury Selivanov and I have a forthcoming PEP and would prefer to use our current employer's email addresses for it, but don't want to change our email addresses on earlier PEPs we've written. (Obviously this affects more PEPs for Yury than for me :P) There's no serious technical impediment to supporting this, so I have. I've tested this locally. --- .../pep_zero_generator/writer.py | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/pep_sphinx_extensions/pep_zero_generator/writer.py b/pep_sphinx_extensions/pep_zero_generator/writer.py index 5aa8d5cf6a0..c00860c7a8c 100644 --- a/pep_sphinx_extensions/pep_zero_generator/writer.py +++ b/pep_sphinx_extensions/pep_zero_generator/writer.py @@ -331,36 +331,25 @@ def _classify_peps(peps: list[PEP]) -> tuple[list[PEP], ...]: def _verify_email_addresses(peps: list[PEP]) -> dict[str, str]: - authors_dict: dict[str, set[str]] = {} + authors_dict: dict[str, list[str]] = {} for pep in peps: for author in pep.authors: # If this is the first time we have come across an author, add them. if author.full_name not in authors_dict: - authors_dict[author.full_name] = set() + authors_dict[author.full_name] = [] # If the new email is an empty string, move on. if not author.email: continue # If the email has not been seen, add it to the list. - authors_dict[author.full_name].add(author.email) - - valid_authors_dict: dict[str, str] = {} - too_many_emails: list[tuple[str, set[str]]] = [] - for full_name, emails in authors_dict.items(): - if len(emails) > 1: - too_many_emails.append((full_name, emails)) - else: - valid_authors_dict[full_name] = next(iter(emails), "") - if too_many_emails: - err_output = [] - for author, emails in too_many_emails: - err_output.append(" " * 4 + f"{author}: {emails}") - raise ValueError( - "some authors have more than one email address listed:\n" - + "\n".join(err_output) - ) - - return valid_authors_dict + emails = authors_dict[author.full_name] + if author.email not in emails: + emails.append(author.email) + + # Combine multiple email addresses with commas. Since peps is + # sorted by PEP number, this should produce a deterministic + # output. + return {name: ', '.join(emails) for name, emails in authors_dict.items()} def _sort_authors(authors_dict: dict[str, str]) -> list[str]: From 2c575295923201adb6ce7eedfd63a4a0fd7559d7 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Tue, 24 Feb 2026 21:10:01 +0200 Subject: [PATCH 2/2] Add test --- .../tests/pep_zero_generator/test_writer.py | 17 +++++++++++++++++ pep_sphinx_extensions/tests/peps/pep-9003.rst | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 pep_sphinx_extensions/tests/peps/pep-9003.rst diff --git a/pep_sphinx_extensions/tests/pep_zero_generator/test_writer.py b/pep_sphinx_extensions/tests/pep_zero_generator/test_writer.py index 1ccf8c4186a..3237dfb0562 100644 --- a/pep_sphinx_extensions/tests/pep_zero_generator/test_writer.py +++ b/pep_sphinx_extensions/tests/pep_zero_generator/test_writer.py @@ -56,6 +56,23 @@ def test_verify_email_addresses(test_input, expected): assert out == expected +def test_verify_email_addresses_multiple_emails(): + # Arrange + peps = [ + parser.PEP(Path("pep_sphinx_extensions/tests/peps/pep-9000.rst")), + parser.PEP(Path("pep_sphinx_extensions/tests/peps/pep-9003.rst")), + ] + + # Act + out = writer._verify_email_addresses(peps) + + # Assert: Francis has two emails combined, Javier's single email is not duplicated + assert out == { + "Francis Fussyreverend": "one@example.com, different@example.com", + "Javier Soulfulcommodore": "two@example.com", + } + + def test_sort_authors(): # Arrange authors_dict = { diff --git a/pep_sphinx_extensions/tests/peps/pep-9003.rst b/pep_sphinx_extensions/tests/peps/pep-9003.rst new file mode 100644 index 00000000000..73817501d51 --- /dev/null +++ b/pep_sphinx_extensions/tests/peps/pep-9003.rst @@ -0,0 +1,7 @@ +PEP: 9003 +Title: Test with author using a different email than in PEP 9000 +Author: Francis Fussyreverend , + Javier Soulfulcommodore +Created: 20-Apr-2022 +Status: Draft +Type: Process