Understand Trio's internal architecture and layering
mainTrio is built with a strict internal layering to ensure that high-level features are implemented using public APIs, making the library extensible:
trio._core: A self-contained implementation of core scheduling, cancellation, and I/O handling. Everything exported here is also available in thetrio,trio.lowlevel, ortrio.testingnamespaces.trio.*modules: High-level modules (liketrio.socketortrio.Lock) are implemented using the public APIs exposed bytrio._core.
This design allows developers to build new features (like file system watching or new queue types) on top of Trio's public APIs without modifying the core internals.