Rework `setup.py develop` for build isolation and local Djblets support.
Review Request #14065 — Created July 31, 2024 and submitted — Latest diff uploaded
Review Board's packaging requires a local build of Djblets, as it makes
use of metadata and packaging functionality that Djblets provides. We
often need to test Djblets changes with Review Board, so being able to
install against a local editable Djblets package is important, and for
this reason, we turned off build isolation.Unfortunately, this in turn broke Haystack installation. Haystack
doesn't provide wheels, just a tarball, and this tarball uses
setuptools-scm
as part of the build process. Whatsetuptools-scm
does is look for a local tag or branch that indicates the package
version, and falls back to a default of0.0.0
if not found.When not run in build isolation mode, the packaging in the tarball ends
up looking at Review Board's tree, computes0.0.0
as the version, and
this fails to satisfy the version rangepip
is considering, which then
fails installation.This means we need build isolation, but we also need local Djblets.
We're now trying a new approach. We now generate a temporary
requirements.txt
that includes:
- The Djblets source tree as an editable (if found as editable already)
dev-requirements.txt
doc-requirements.txt
, if neededWe then pass that to
pip
, in the default build isolation mode. This
allowspip
to consider all the dependencies across all these at once.
It also ensures that a local editable of Djblets will be used as
editable. It does still need to install its dependencies in the build
isolation environment, but as this generally uses cached wheels, it's
pretty fast.The result should be the same as before, but without the side effects
Haystack suffers from and without pulling down a published Djblets.
Created new virtual environments and installed in the following
conditions:
- With a local Djblets in editable mode.
- With a parent environment install of published Djblets.
- Without any existing install of Djblets.
Verified that in the first case, the existing Djblets tree is
used as part of package building with minimal setup time, and
that in the other cases a published Djblets is used instead.