Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug? Can't run uv sync on package with --no-build #10778

Closed
Chasarr opened this issue Jan 20, 2025 · 3 comments
Closed

Bug? Can't run uv sync on package with --no-build #10778

Chasarr opened this issue Jan 20, 2025 · 3 comments
Assignees
Labels
question Asking for clarification or support

Comments

@Chasarr
Copy link

Chasarr commented Jan 20, 2025

When trying to create a new package with say uv init --package, add a dependency, say the progress package, with uv add progress. My pyprojects.toml looks like this:

[project]
name = "hatch-demo"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
authors = [
    { name = "My Name", email = "[email protected]" }
]
requires-python = ">=3.12"
dependencies = [
    "progress>=1.6",
]

[project.scripts]
hatch-demo = "hatch_demo:main"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

Company policy is to ensure that we don't use source distributions (only prebuilt binary wheel dependencies) which we used to do with pip install -r requirements.txt --no-compile. We are now trying to switch over to uv, but uv sync --no-build returns
error: Distribution hatch-demo==0.1.0 @ editable+.can't be installed because it is marked as--no-build but has no binary distribution

Although I can see why this returns an error, the purpose of --no-build for us should be to not build dependencies when building our package, not to inhibit us from building the package itself. We could technically do uv sync --no-build-package pkg1 --no-build-package pkg2 ... --no-build-package pkgN for all dependencies, but that doesn't seem like a very elegant solution.

Not sure if a fix for this problem aligns with the goals of uv.

TLDR: I want to 1) uv sync dependencies with --no-build and then 2) build the package with said dependencies.

@charliermarsh
Copy link
Member

I would suggest uv sync --no-build --no-install-project to skip building and installing hatch-demo.

@charliermarsh charliermarsh added the question Asking for clarification or support label Jan 20, 2025
@Chasarr
Copy link
Author

Chasarr commented Jan 20, 2025

Thanks for guiding me to the right answer! To avoid running build on packages in my CI environment, I just enter

uv sync --no-build --no-install-project # Fetches prebuilt wheels
uv sync --frozen # builds project with previously synced dependencies
uv run --frozen <MY_PACKAGE> # Now CI can perform tests on the package before publishing to internal Python package index

Thanks a lot!

@Chasarr Chasarr closed this as completed Jan 20, 2025
@charliermarsh
Copy link
Member

charliermarsh commented Jan 20, 2025

No worries! Thank you for following up.

@charliermarsh charliermarsh self-assigned this Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

2 participants