Thanks for those pointers, those are helpful already. I fear failed to mention some more context around what we are doing and why. Anto Cuni has created a more thorough explanation on the HPy github: Improve the integration with setuptools and the packaging ecosystem · Issue #370 · hpyproject/hpy · GitHub
One issue e.g. with creating our own subcommand I think is that we are actually piggybacking on the build_ext command and injecting the hpy_ext_modules into the ext_modules with some hacky modifications.