You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exclude the project from no-build by default #17416
I think points 2 and 3 should work out of the box.
How to reproduce
# create new package
uv init --package --build-backend setuptools my-package
cd my-package
# set `no-build = true`echo'[tool.uv]'>> pyproject.toml
echo'no-build = true'>> pyproject.toml
# interact with the package
uv sync # error: Distribution `my-package==0.1.0 @ editable+.` can't be installed because it is marked as `--no-build` but has no binary distribution# explicitly allow uv to build my own packageecho'no-binary-package = ["my-package"]'>> pyproject.toml
# interact with the package
uv sync # works# build the package
uv build # Failed to build, Building source distributions is disabled
Reacted by Ran Benita, Henry Cai, Nicholas Pace, Jiri Daněk, Clément Robert, Julio Batista Silva, janos-varga and Matt Norton
I don't think setuptools fails. To me, "Building source distributions is disabled" implies that uv didn't invoke setuptools at all due to no-build = true.
But when running uv init --package my-package (without --build-backend setuptools), uv build works just fine.
I now tried steps from the original post on all supported build backends.
uv sync behavior doesn't depend on the build backend. It always fails with no-build = true and always works without it.
uv build with -no-build = true only works for --build-backend uv and fails for all other backends (hatch, flit, pdm, poetry, scikit, setuptools; I skipped maturin because I don't have Rust installed). The error message is always the same: "Building source distributions is disabled".
(Updated the original post: setuptools -> all backends besides uv_build)
uv build --sdist failed because Building source distributions is disabled.
Basically I want to disable building external dependencies but not my own project, and the workaround no-binary-package doesn't work in this case. I think this behavior was raised in #12607 but that issue was buried 😞
I have a workspace with many packages using uv_build and I tried to set no-build = true in the root pyproject.toml for security reasons. I get the "can't be installed because [...] has no binary distribution" error. Does it make sense to have editable installs in particular excluded from the no-build check?
I want to use vcs tags for package versioning, so I am using hatchling build backend with hatch-vcs (because the uv build backend doesn't support hooks)
I want to control my CI security posture by preventing arbitrary code from running due to building third party wheels
2 and 3 are currently mutually exclusive because of these two uv issues. So I either have to choose security or choose dynamic versions from vcs.
I want to use vcs tags for package versioning, so I am using hatchling build backend with hatch-vcs (because the uv build backend doesn't support hooks)
I want to control my CI security posture by preventing arbitrary code from running due to building third party wheels
2 and 3 are currently mutually exclusive because of these two uv issues. So I either have to choose security or choose dynamic versions from vcs.
I work at a large financial services firm where several teams (who already migrated to uv) are suffering from this, and even more teams are refusing to migrate exactly because of this. We need 2 and 3 to work at the same time.
Data scientists (as well as other non-engineer Python users) cannot be expected to have full go/rust/c++ build toolchains installed locally when they only work with Python. For this reason, and the security one stated by @segfly , source distros are not an option for us. But teams that develop building blocks for others (i.e. libs) must be able to obide by requirements 2 and 3 above.
Please fix this.
The workaround I found for building the local project into a wheel is to use the --build flag in CI: uv build --no-sources --build. For some reason that lets the current project be built when no-build = true & no-binary-package = ["my_project"].
That being said, I think the correct solution in the long term is for the no-build = true configuration option to exclude the current project.
Activity
zanieb commentedon Jan 12, 2026
Can you explain (3)? Why does setuptools fail?
NMertsch commentedon Jan 12, 2026
I don't think setuptools fails. To me, "Building source distributions is disabled" implies that uv didn't invoke setuptools at all due to
no-build = true.But when running
uv init --package my-package(without--build-backend setuptools),uv buildworks just fine.zanieb commentedon Jan 12, 2026
I'm confused that you said
zanieb commentedon Jan 12, 2026
You're saying it works for the
uv_buildbackend but not any other ones?NMertsch commentedon Jan 12, 2026
Sorry for the confusion. What I meant was:
uv buildwith backendsetuptoolsworks, unlessno-build = true.uv buildwith backenduv_buildworks, independently ofno-build = true.I didn't test other backends. Give me a few minutes to try them all.
NMertsch commentedon Jan 12, 2026
I now tried steps from the original post on all supported build backends.
uv syncbehavior doesn't depend on the build backend. It always fails withno-build = trueand always works without it.uv buildwith-no-build = trueonly works for--build-backend uvand fails for all other backends (hatch, flit, pdm, poetry, scikit, setuptools; I skipped maturin because I don't have Rust installed). The error message is always the same: "Building source distributions is disabled".(Updated the original post: setuptools -> all backends besides uv_build)
CHC383 commentedon Jan 16, 2026
I have a similar case
uv build --sdistfailed becauseBuilding source distributions is disabled.Basically I want to disable building external dependencies but not my own project, and the workaround
no-binary-packagedoesn't work in this case. I think this behavior was raised in #12607 but that issue was buried 😞@NMertsch I wonder how
as it doesn't work with the config above.
bluetech commentedon Jan 20, 2026
I have a workspace with many packages using
uv_buildand I tried to setno-build = truein the root pyproject.toml for security reasons. I get the "can't be installed because [...] has no binary distribution" error. Does it make sense to have editable installs in particular excluded from theno-buildcheck?segfly commentedon Feb 8, 2026
I ran into this issue as well:
hatchlingbuild backend withhatch-vcs(because the uv build backend doesn't support hooks)2 and 3 are currently mutually exclusive because of these two uv issues. So I either have to choose security or choose dynamic versions from vcs.
🔧 ci: Add --locked --no-build to uv sync (SonarCloud S8544/S8541) (#73)
janos-varga commentedon Sep 7, 2026
I work at a large financial services firm where several teams (who already migrated to uv) are suffering from this, and even more teams are refusing to migrate exactly because of this. We need 2 and 3 to work at the same time.
Data scientists (as well as other non-engineer Python users) cannot be expected to have full go/rust/c++ build toolchains installed locally when they only work with Python. For this reason, and the security one stated by @segfly , source distros are not an option for us. But teams that develop building blocks for others (i.e. libs) must be able to obide by requirements 2 and 3 above.
Please fix this.
CarrotManMatt commentedon Oct 15, 2026
The workaround I found for building the local project into a wheel is to use the
--buildflag in CI:uv build --no-sources --build. For some reason that lets the current project be built whenno-build = true&no-binary-package = ["my_project"].That being said, I think the correct solution in the long term is for the
no-build = trueconfiguration option to exclude the current project.zanieb commentedon Oct 15, 2026
I believe this has been resolved: