Heads up: I’m working on finishing the big migration of PEP 517, 518 and 660 to the PyPA specs page, and hope to have a draft PR up this coming week. While there appears to be a general consensus here, I will refrain from modifying the normative existing language around the build_sdist
hook as stated in PEP 517, but can open a separate PR once that’s merged to effect the change, subject to any further discussion, review and objections.
The current language for the build_sdist
hook states
Some build backends MAY have extra requirements for creating sdists, such as version control tools. However, some build frontends MAY prefer to make intermediate sdists when producing wheels, to ensure consistency.
We could implement the recommendation that package developer-facing frontends build the wheel from the sdist as follows:
Build frontends MAY prefer to build wheels from an unpacked intermediate sdist built by this hook; to ensure consistency, frontends building wheels for distribution rather than installation SHOULD do so. However, some build backends MAY have extra requirements for creating sdists, such as version control tools.
The paragraph goes on to state:
If the backend cannot produce an sdist because a dependency is missing, or for another well understood reason, it SHOULD raise an exception of a specific type which it makes available as UnsupportedOperation
on the backend object. If the frontend gets this exception while building an sdist as an intermediate for a wheel, it SHOULD fall back to building a wheel directly.
Should the second sentence recommendation be weakened to a MAY or removed entirely for package author-facing tools building artifacts for distribution? It would seem that at least one of these should be done, perhaps along with recommending the display of an appropriate author-visible warning message, so the author is aware of the inconsistency. For example:
If the frontend gets this exception while building an sdist as an intermediate for a wheel, it SHOULD fall back to building a wheel directly, except in the case of building a wheel for distribution, in which it MAY do so but SHOULD issue an appropriate user-visible warning.
Thoughts? Are there any other changes that should be made to implement this recommendation?