Skip to content

PEP 793: PyModExport: A new entry point for C extension modules #4435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 27, 2025

Conversation

encukou
Copy link
Member

@encukou encukou commented May 23, 2025

Basic requirements (all PEP Types)

  • Read and followed PEP 1 & PEP 12
  • File created from the latest PEP template
  • PEP has next available number, & set in filename (pep-NNNN.rst), PR title (PEP 123: <Title of PEP>) and PEP header
  • Title clearly, accurately and concisely describes the content in 79 characters or less
  • Core dev/PEP editor listed as Author or Sponsor, and formally confirmed their approval
  • Author, Status (Draft), Type and Created headers filled out correctly
  • PEP-Delegate, Topic, Requires and Replaces headers completed if appropriate
  • Required sections included
    • Abstract (first section)
    • Copyright (last section; exact wording from template required)
  • Code is well-formatted (PEP 7/PEP 8) and is in code blocks, with the right lexer names if non-Python
  • PEP builds with no warnings, pre-commit checks pass and content displays as intended in the rendered HTML
  • Authors/sponsor added to .github/CODEOWNERS for the PEP

Standards Track requirements

  • PEP topic discussed in a suitable venue with general agreement that a PEP is appropriate
  • Suggested sections included (unless not applicable)
    • Motivation
    • Rationale
    • Specification
    • Backwards Compatibility
    • Security Implications
    • How to Teach This
    • Reference Implementation
    • Rejected Ideas
    • Open Issues
  • Python-Version set to valid (pre-beta) future Python version, if relevant
  • Any project stated in the PEP as supporting/endorsing/benefiting from the PEP formally confirmed such
  • Right before or after initial merging, PEP discussion thread created and linked to in Discussions-To and Post-History

📚 Documentation preview 📚: https://pep-previews--4435.org.readthedocs.build/pep-0793/

@encukou encukou requested a review from a team as a code owner May 23, 2025 16:39
@AA-Turner AA-Turner added the new-pep A new draft PEP submitted for initial review label May 23, 2025
Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

General points:

  • I think the PEP would benefit from more examples. Perhaps a full example of a module only using PyModExport_*, an example on porting, and an example on using both export hooks at once, e.g. for a module supporting Python 3.11--3.15?
  • The text is very heavy on parenthetical asides. I've suggested removing some, but in general I think where full sentences are in brackets, the text would be stronger by properly incorporating the thought and removing the brackets.
  • Please replace typographical quotation marks with "/', Sphinx/Docutils insert them automatically.
  • Naming (sorry!): Currently, PyMod* is only used by PyModInitFunction. Would PyModuleExport be considered?

A

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Copy link
Member Author

@encukou encukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the reviews! I went through some of the comments, will get to the rest later.
kid is waking up, I left some replies terse; please imagine a most friendly & respectful tone :)

I think the PEP would benefit from more examples. Perhaps a full example of a module only using PyModExport_*, an example on porting, and an example on using both export hooks at once, e.g. for a module supporting Python 3.11--3.15?

Agree, but these should end up in docs and I don't want people reading them here after acceptance. I'll add them to the reference implementation and point the PEP there.

The text is very heavy on parenthetical asides. I've suggested removing some, but in general I think where full sentences are in brackets, the text would be stronger by properly incorporating the thought and removing the brackets.

I use them to separate the hard spec from “mere“ implications/explanations. They are very helpful for me, and I like to think they're not too distracting for the reader.

Please replace typographical quotation marks with "/', Sphinx/Docutils insert them automatically.

I don't see a reason to do that. Any future editor is free to use " instead, it's not like Python identifiers which you need to repeat exactly somewhere else.

Naming (sorry!): Currently, PyMod* is only used by PyModInitFunction. Would PyModuleExport be considered?

That's a point for the discussion :)

(Yes, I considered it, but my conclusion is not strong enough for a Rejected Ideas entry and the question is not important enough for Open Questions. I'm literally waiting for the discussion thread here.)

@encukou
Copy link
Member Author

encukou commented May 26, 2025

The docs are in flux, so I added an example and porting guide to the PEP.

encukou and others added 2 commits May 26, 2025 16:26
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@AA-Turner AA-Turner merged commit b2d1e97 into python:main May 27, 2025
5 checks passed
@encukou
Copy link
Member Author

encukou commented May 27, 2025

Thank you for the reviews!

@encukou encukou deleted the modexport branch May 27, 2025 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-pep A new draft PEP submitted for initial review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants