| 1 | # Concepts |
| 2 | |
| 3 | This library has two main abstractions: |
| 4 | |
| 5 | - {any}`WheelSource`: Serves as source of information about a wheel file. |
| 6 | - {any}`WheelDestination`: Handles all file writing and post-installation |
| 7 | processing. |
| 8 | |
| 9 | ## WheelSource |
| 10 | |
| 11 | These objects represent a wheel file, abstracting away how the actual file is |
| 12 | stored or accessed. |
| 13 | |
| 14 | This allows the core install logic to be used with in-memory wheel files, or |
| 15 | unzipped-on-disk wheel, or with {any}`zipfile.ZipFile` objects from an on-disk |
| 16 | wheel, or something else entirely. |
| 17 | |
| 18 | This protocol/abstraction is designed to be implementable without a direct |
| 19 | dependency on this library. This allows for other libraries in the Python |
| 20 | packaging ecosystem to provide implementations of the protocol, allowing for |
| 21 | more code reuse opportunities. |
| 22 | |
| 23 | One of the benefits of this fully described interface is the possibility to |
| 24 | decouple the implementation of additional validation on wheels (such as |
| 25 | validating the RECORD entries in a wheel match the actual contents of the wheel, |
| 26 | or enforcing signing requirements) based on what the specific use case demands. |
| 27 | |
| 28 | ## WheelDestination |
| 29 | |
| 30 | These objects are responsible for handling the writing-to-filesystem |
| 31 | interactions, determining RECORD file entries and post-install actions (like |
| 32 | generating .pyc files). While this is a lot of responsibility, this was |
| 33 | explicitly provided to make it possible for custom `WheelDestination` |
| 34 | implementations to be more powerful and flexible. |
| 35 | |
| 36 | Most of these tasks can either be delegated to utilities provided in this |
| 37 | library (eg: script generation), or to the Python standard library (eg: |
| 38 | generating `.pyc` files). |