Skip to content

Build path sources without build systems by default #14413

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

Open
wants to merge 9 commits into
base: release/080
Choose a base branch
from

Conversation

jtfmumm
Copy link
Contributor

@jtfmumm jtfmumm commented Jul 2, 2025

We currently treat path sources as virtual if they do not specify a build system, which is surprising behavior. This PR updates the behavior to treat path sources as packages unless the path source is explicitly marked as package = false or its own tool.uv.package is set to false.

Closes #12015

samypr100 and others added 3 commits July 1, 2025 20:02
Closes #13057

Sets `UV_TOOL_BIN_DIR` to `/usr/local/bin` for all derived images to
allow `uv tool install` to work out of the box.

Note, when the default image user is overwritten (e.g. `USER <UID>`) by
a less privileged one, an alternative writable location would now need
to be set by downstream consumers to prevent issues, hence I'm labeling
this as a breaking change for 0.8.x release.

Relates to astral-sh/uv-docker-example#55

Each image was tested to work with uv tool with `UV_TOOL_BIN_DIR` set to
`/usr/local/bin` with the default root user and alternative non-root
users to confirm breaking nature of the change.
While reviewing #14107, @oconnor663
pointed out a bug where we allow `uv python pin --rm` to delete the
global pin without the `--global` flag. I think that shouldn't be
allowed? I'm not 100% certain though.
Right now, `--python-platform linux` to defaults to `manylinux_2_17`.
Defaulting to `manylinux_2_17` causes some problems for users, since it
means we can't use (e.g.) `manylinux_2_28` wheels, and end up having to
build from source.

cibuildwheel made `manylinux_2_28` their default in
pypa/cibuildwheel#1988, and there's a lot of
discussion in pypa/cibuildwheel#1772 and
pypa/cibuildwheel#2047. In short, the
`manylinux_2014` image is EOL, and the vast majority of consumers now
run at least glibc 2.28 (https://mayeut.github.io/manylinux-timeline/):

![Screenshot 2025-06-26 at 7 47
23 PM](https://github.com/user-attachments/assets/2672d91b-f9eb-4442-b680-7e4cd7cade91)

Note that this only changes the _default_. Users can still compile
against `manylinux_2_17` by specifying it.
@jtfmumm jtfmumm added enhancement New feature or improvement to existing functionality breaking A breaking change labels Jul 2, 2025
@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 2, 2025 09:30 — with GitHub Actions Inactive
@@ -82,19 +82,22 @@ impl PyProjectToml {
/// non-package ("virtual") project.
pub fn is_package(&self) -> bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the existing logic in place in is_package (factoring out the tool.uv.package check) to constrain this change to path sources only.

@zanieb
Copy link
Member

zanieb commented Jul 2, 2025

This should be based on #14164 right?

@jtfmumm jtfmumm changed the base branch from main to release/080 July 2, 2025 15:11
@jtfmumm
Copy link
Contributor Author

jtfmumm commented Jul 2, 2025

This should be based on #14164 right?

Yes, updated

@jtfmumm jtfmumm added this to the v0.8.0 milestone Jul 2, 2025
Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update https://docs.astral.sh/uv/reference/settings/#package in conjunction with this change.

@jtfmumm
Copy link
Contributor Author

jtfmumm commented Jul 2, 2025

We need to update https://docs.astral.sh/uv/reference/settings/#package in conjunction with this change.

This doesn’t actually change the behavior there. It’s limited to updating the default behavior when a path source definition has no package value.

But we can discuss if we want this to hold more generally. I was trying to limit the scope of the change to the issue.

@zanieb zanieb changed the title No longer treat path sources as virtual if missing build specification Build path sources without build systems by default Jul 2, 2025
@zanieb
Copy link
Member

zanieb commented Jul 2, 2025

Can you add test coverage for cases where there are various package = .. options set?

@jtfmumm
Copy link
Contributor Author

jtfmumm commented Jul 2, 2025

Can you add test coverage for cases where there are various package = .. options set?

There are already existing tests but I can point them out

@zanieb
Copy link
Member

zanieb commented Jul 2, 2025

Yes please. I'm particularly interested in package = true / package = false conflicts.

@jtfmumm
Copy link
Contributor Author

jtfmumm commented Jul 2, 2025

  • sync_override_package on main tests for a dependency with a build specification:

    • tool.uv.package is unset
      • override with package = false: does not install
      • no override: does install
    • tool.uv.package is false
      • override with package = true: does install
      • no override: doesn't install
    • In this PR, I added:
      • tool.uv.package is true
        • override with package = false: does not install
        • no override: does install
  • lock_implicit_package_path (renamed) is updated in this PR to check that the default behavior is to build even when the path source itself had no build specification and no tool.uv.package value. This is testing the core behavior for this PR.

@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 2, 2025 18:35 — with GitHub Actions Inactive
@zanieb
Copy link
Member

zanieb commented Jul 2, 2025

There should be some documentation change here. Perhaps in https://docs.astral.sh/uv/concepts/projects/dependencies/#path

@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 3, 2025 13:41 — with GitHub Actions Inactive
@@ -438,6 +438,21 @@ $ uv add ~/projects/bar/
bar = { path = "../projects/bar", package = true }
```

If the project is not marked as a non-package and no value is set for `package` on the source, the default behavior is to install it as a package, even if it lacks a [build
Copy link
Member

@zanieb zanieb Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which "project" are you referring to here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you wrap the line so it's ~close to the line length in the rest of the file? The autoformatter can't wrap admonitions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels weird this is first framed around "If the project is marked as a non-package", since that's the advanced use-case. The more common scenario is that the dependency just doesn't declare a build system.

Copy link
Contributor Author

@jtfmumm jtfmumm Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I was trying to emphasize the combination of package values since the point about building dependencies without a declared build system is already covered in the build systems section of the docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That section is about building the current project, where-as here we need to talk about how we build projects when they're dependencies.

@jtfmumm jtfmumm force-pushed the jtfm/package-default branch from a7c3e8c to ace14ba Compare July 3, 2025 14:43
@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 3, 2025 14:46 — with GitHub Actions Inactive
@jtfmumm jtfmumm temporarily deployed to uv-test-publish July 3, 2025 14:46 — with GitHub Actions Inactive
@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 3, 2025 15:45 — with GitHub Actions Inactive
@jtfmumm jtfmumm temporarily deployed to uv-test-publish July 3, 2025 15:45 — with GitHub Actions Inactive
@jtfmumm jtfmumm force-pushed the jtfm/package-default branch from 733f184 to cab8774 Compare July 4, 2025 09:48
@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 4, 2025 09:50 — with GitHub Actions Inactive
@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 4, 2025 11:56 — with GitHub Actions Inactive
Comment on lines +418 to +420
```toml title="pyproject.toml"
[project]
dependencies = ["bar"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid project table? (missing name and version)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is following a pattern found throughout this file. If we want to change that, I think it's out of scope here.

@jtfmumm jtfmumm force-pushed the jtfm/package-default branch from ba457ce to 9c050fc Compare July 8, 2025 13:49
@jtfmumm jtfmumm force-pushed the jtfm/package-default branch 2 times, most recently from 41a8fa6 to b63bb85 Compare July 8, 2025 13:52
@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 8, 2025 13:54 — with GitHub Actions Inactive
@jtfmumm jtfmumm force-pushed the jtfm/package-default branch from b63bb85 to c4fcb8b Compare July 8, 2025 15:21
@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 8, 2025 15:24 — with GitHub Actions Inactive
@jtfmumm jtfmumm force-pushed the jtfm/package-default branch from c4fcb8b to d57677f Compare July 8, 2025 15:26
@jtfmumm jtfmumm temporarily deployed to uv-test-registries July 8, 2025 15:29 — with GitHub Actions Inactive
@charliermarsh charliermarsh force-pushed the release/080 branch 2 times, most recently from de0b93c to 421e2c7 Compare July 11, 2025 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking change enhancement New feature or improvement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Treat path sources as package = true by default
6 participants