Hi, I’d like to propose adding an additional phase to python-build-system to improve Guix’ Python package quality. Python is an interpreted language without any compile-time checks. Any errors are only visible at run-time, including missing or wrong imports. Additionally most Python packages use an additional packaging layer through setuptools, which also declares mandatory and optional dependencies. This can result in buildable, but broken packages. An example of a botched upgrade is fixed in commit 22e06297b1982f75aaadddba616b1052e506e4a0. The package python-httpx was upgraded, but that new version declared a dependency to a newer python-httpcore via setuptools, which wasn’t available and thus packages depending on python-httpx were broken. My proposal adds some build-time checks to guarentee three properties: 1) Depending on the package (distribution in Python language) via setuptools works. This ensures dependencies are complete and have the correct version as determined by setup.{py,cfg}. 2) Console entry points can be loaded. This ensures scripts installed to bin/ actually work. 3) Top-level modules can be imported. This ensures the package is actually usable and has no undeclared dependencies. The attached patch implements all three. I’ve been rebuilding a few Python packages using the patch and uncovered some issues already. I’m sure it’s not perfect yet and thus I’m open to improvements. If this idea is well received I’m willing to rebuild and fix *all* Python packages broken by this new phase. I’m also aware this change needs to go to core-updates. Cheers, Lars