How to apply patches in a Python derivation with a wheel as the source?

When i attempt to apply patches in a derivation for a Python package with format = "wheel", i get errors like (patching setup.py here)

applying patch /nix/store/3hkj6z218mphk7ai4vgccwp98zwczami-001-extras-require.patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/setup.py b/setup.py
|index dece7a0..41b3b3f 100755
|--- a/setup.py
|+++ b/setup.py
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
1 out of 1 hunk ignored

If i take a look in the temporary build directory for the derivation, it contains only the *.whl and a env-vars file, e.g.,

$ tree
.
├── dist
│   └── sacrebleu-1.4.6-py3-none-any.whl
└── env-vars

so it makes sense that the patch couldn’t be applied. Do wheels in principle disallow patching? It’d make sense given that it’s a binary package format, but i’m reading that wheels get extracted at some point so is there maybe a later stage where patches can be applied?

A wheel does not have a setup.py, because the wheel is already built. A wheel is a built artifact, even though most wheels are “pure” wheels, not containing any binary. In Nixpkgs we avoid wheels as much as possible.

You need to fetch the actual source.