# Is it possible to use a local build backend?

**URL:** <https://discuss.python.org/t/is-it-possible-to-use-a-local-build-backend/43630>\
**Category:** Python Help\
**Tags:** packaging-help\
**Created:** [January 19, 2024, 3:50pm UTC](https://discuss.python.org/t/is-it-possible-to-use-a-local-build-backend/43630 "2024-01-19T15:50:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ings](https://avatars.discourse-cdn.com/v4/letter/i/7c8e57/32.png) [@ings](https://discuss.python.org/u/ings)\
**Post date:** [January 19, 2024, 3:50pm UTC](https://discuss.python.org/t/is-it-possible-to-use-a-local-build-backend/43630/1 "2024-01-19T15:50:58Z")

</div>

We have some efforts here at work to move away from setuptools. I have searched the internet and found enscons which seems to fit our tools pretty well. However, there are a few features missing and since our pull request is pending for some time now, we thought it could be reasonable to have the build backend incorporated in our source tree. Our source tree contains various different python projects which are to be built as wheels.

However, this seems to be non-straightforward unfortunately. I have stumbled across the backend-path but it is only ment for bootstrapping backends (it spits out ValueError: paths must be inside source tree) when being used with relative paths going upwards.

I’m not sure if I’m missing something obvious, but it doesn’t seem to be possible at all to have a build backend which is not installable from pypi or a git dependency like “project @ git+https://github.com/…”? I have tried -e, but this is failing.

---

<div class="post-metadata">

**Author:** ![kknechtel](https://avatars.discourse-cdn.com/v4/letter/k/e47c2d/32.png) [@kknechtel](https://discuss.python.org/u/kknechtel)\
**Post date:** [January 20, 2024, 2:40pm UTC](https://discuss.python.org/t/is-it-possible-to-use-a-local-build-backend/43630/2 "2024-01-20T14:40:39Z")

</div>

If you disable build isolation, _and the build environment already has the build backend installed_ that is specified in `pyproject.toml`, then it should just work. (Or you can just have it install enscons from PyPI by specifying the build system normally.) It won’t use a “local” (to the machine but not the source tree) backend from an arbitrary location.

---

<div class="post-metadata">

**Author:** ![sinoroc](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sinoroc/32/1607_2.png) [@sinoroc](https://discuss.python.org/u/sinoroc)\
**Post date:** [January 20, 2024, 8:54pm UTC](https://discuss.python.org/t/is-it-possible-to-use-a-local-build-backend/43630/3 "2024-01-20T20:54:43Z")

</div>

In-tree build backend is quite niche as far as I can tell. I do not know of many who have done this before. I know the build backends do it but I do not think it is only meant for bootstrapping backends:

- [flit-core](https://github.com/pypa/flit/blob/main/flit_core/pyproject.toml)
- [hatchling](https://github.com/pypa/hatch/blob/master/backend/pyproject.toml)
- [poetry-core](https://github.com/python-poetry/poetry-core/blob/main/pyproject.toml)

Alternatively, you could always consider publishing your fork on _PyPI_ (or whatever other package index you have available).

Maybe there is something useful in there:

- [PEP 517: In-tree build backend dependencies](https://discuss.python.org/t/pep-517-in-tree-build-backend-dependencies/31051)
- [PEP 517 Backend bootstrapping](https://discuss.python.org/t/pep-517-backend-bootstrapping/789)

---

<div class="post-metadata">

**Author:** ![ings](https://avatars.discourse-cdn.com/v4/letter/i/7c8e57/32.png) [@ings](https://discuss.python.org/u/ings)\
**Post date:** [January 22, 2024, 8:09am UTC](https://discuss.python.org/t/is-it-possible-to-use-a-local-build-backend/43630/4 "2024-01-22T08:09:45Z")

</div>

Disabling build isolation is probably incompatible to using a requirements.txt file, since - as I understand it - pip will apply this setting for all packages listed in requirements.txt, even if the build requirements of packages are not fulfilled. That would mean that we have to list our packages which need the local backend seperated from the rest of the dependencies. Might be a possible workaround though not really ideal.

---

<div class="post-metadata">

**Author:** ![ings](https://avatars.discourse-cdn.com/v4/letter/i/7c8e57/32.png) [@ings](https://discuss.python.org/u/ings)\
**Post date:** [January 22, 2024, 8:15am UTC](https://discuss.python.org/t/is-it-possible-to-use-a-local-build-backend/43630/5 "2024-01-22T08:15:06Z")

</div>

> [PEP 517 Backend bootstrapping](https://discuss.python.org/t/pep-517-backend-bootstrapping/789)

In this thread it becomes pretty clear that the only use case intended for backend-path is the bootstrapping use case, and indeed there is a check implemented that the backend-path must be relative to the project to be built and going up with specifying `../` paths leads to an exception unfortunately.
