PEP 843 proposes export statement for DRY hub-module re-exports
A single from-import form would also append names to __all__, targeting the double-entry tax that package facade modules pay today.
PEP 843, authored by Neil Girdhar and now open for discussion on the Python Discourse, adds a narrow statement form, from x export y (with an optional as clause), that performs the usual import and also appends the bound name to the module’s all list in one step.
The target is hub modules: package entry points whose job is to gather public names from private submodules and re-expose them. Today that requires writing every name twice, once in an import and again as a string in all, with nothing but review discipline keeping the two lists aligned. The new statement collapses that duplication.
The proposal sits beside two related PEPs. PEP 842 offers a broader export keyword with runtime enforcement via a new export list; PEP 844 instead uses builtins and leaves the grammar alone. PEP 843 deliberately stays small: one syntactic form, all only, no runtime checks.
Guido van Rossum weighed in on the open question of export *: it should match import * behavior rather than invent a special case that will trip people up. Barry Warsaw, who maintains the atpublic helper library, said he still supports the PEP as a companion to 844; even the latest atpublic release still forces a repeated name.
Discussion also touched whether export should be restricted to module scope (to keep static type checkers and IDEs happier) and how conditional re-exports, common in the standard library for platform-specific names, should interact with the new syntax. Those points remain open as the PEP gathers feedback.