r/Python • • Jul 31 '26

News PEP 842: Module Exports

https://peps.python.org/pep-0842/

Not the author, but this seems interesting, specially for library authors. Thoughts?

Discussion here - https://discuss.python.org/t/pep-842-module-exports/108353

24 Upvotes

44 comments sorted by

View all comments

Show parent comment

3

u/HommeMusical Aug 01 '26

Both library authors and application developers need to know that the APIs they're relying on are stable.

But "the list things that get imported from a namespace" has never been an API and isn't anything like an API."

If you type import module and then make the assumption that everything in the module. namespace will always be there in every version and have the same meaning and signatuire, even for undocumented members that start with an _ and aren't in __all__, you're going have a very bad time.

We have __all__; we have the _ prefix convention; for APIs, we have type stubs.