> [!seealso] See Also:
> * [[Python Packaging]]
> * [[pyproject.toml build backends]]
# Build Isolation
Both `pip install -e` and `python -m build` will build in isolation. The steps are:
1. Set up a temporary virtualenv
2. Install the build backend and its deps into the virtualenv
3. Construct the wheel
1. This is a special wheel for editable mode, set up as just metadata linking to the source tree
`pip install -e` will then install that wheel in the outer environment.
# Limitations
* There are _no_ post-install steps available
* Build backends can't locate packages from your normal virtualenv
* _Might_ be possible to do this via a subprocess (`$VIRTUALENV` seems preserved), but this might be fragile/not future-proof.
* Build backends can't install any development packages (no automated `pip install -r dev-requirements.txt`)
* You _can_ copy those into the main dependencies for the wheel, in editable mode, though. Should be safe?
# Testing Build Backends
The build isolation means that any build deps in editable mode or installed either in a local virtualenv or globally will _not_ be picked up, leading to dependency errors:
```
ERROR: No matching distribution found for hatch-npm
error: subprocess-exited-with-error
× pip subprocess to install backend dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /Users/chipx86/buildroots/rb6/bin/python3.9 /Users/chipx86/buildroots/rb6/lib/python3.9/site-packages/pip/__pip-runner__.py install --ignore-installed --no-user --prefix /private/var/folders/34/6wkbp94x5g79sbk8kfrscpzw0000gn/T/pip-build-env-1ohpnk5r/normal --no-warn-script-location -v --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- hatch-npm
```
To work around this:
1. Build actual wheels for the dependencies
2. Make sure the packages are in `[build-system].requires` in `pyproject.toml`
3. Run `pip install -f /path/to/dist -e .` (with `/path/to/dist` containing the wheel packages)