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

Load configuration options from workspace root #4295

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Jun 13, 2024

Summary

In a workspace, we now read configuration from the workspace root. Previously, we read configuration from the first pyproject.toml or uv.toml file in path -- but in a workspace, that would often be the project rather than the workspace configuration.

We need to read configuration from the workspace root, rather than its members, because we lock the workspace globally, so all configuration applies to the workspace globally.

As part of this change, the uv-workspace crate has been renamed to uv-settings and its purpose has been narrowed significantly (it no longer discovers a workspace; instead, it just reads the settings from a directory).

If a user has a uv.toml in their directory or in a parent directory but is not in a workspace, we will still respect that use-case as before.

Closes #4249.

// configuration file.
// 3. The nearest `uv.toml` file in the directory tree, starting from the current directory. If
// found, this file is combined with the user configuration file. In this case, we don't
// search for `pyproject.toml` files, since we're not in a workspace.
Copy link
Member Author

Choose a reason for hiding this comment

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

Rules are explained here, in more detail.

@charliermarsh
Copy link
Member Author

It's a bit confusing that configuration in a workspace member will effectively be ignored. Something to revisit in the future, I think.

@charliermarsh charliermarsh added configuration Settings and such preview Experimental behavior labels Jun 13, 2024
@zanieb
Copy link
Member

zanieb commented Jun 13, 2024

It's a bit confusing that configuration in a workspace member will effectively be ignored. Something to revisit in the future, I think.

That seems pretty problematic :D

@charliermarsh
Copy link
Member Author

I know it's a hard question, but what do you think the semantics should be? None of the options are enforceable on a per-package basis.

@zanieb
Copy link
Member

zanieb commented Jun 13, 2024

I'm not sure yet. I think I need to play with a real workspace setup first. I think we'd need to be able to map a tree of dependencies to their source project in the workspace to be able to enforce things, right? It seems like it would require a lot of changes.

@charliermarsh charliermarsh force-pushed the charlie/configuration branch 6 times, most recently from 16de0ce to 164b8e5 Compare June 13, 2024 23:01
Base automatically changed from charlie/configuration to main June 14, 2024 00:56
@charliermarsh charliermarsh enabled auto-merge (squash) June 14, 2024 01:17
@charliermarsh charliermarsh merged commit cacd1a2 into main Jun 14, 2024
47 checks passed
@charliermarsh charliermarsh deleted the charlie/configuration-ii branch June 14, 2024 01:26
charliermarsh added a commit that referenced this pull request Aug 8, 2024
## Summary

Previously, we wouldn't respect configuration files in directories
_above_ a workspace root. But this is somewhat problematic, because any
`pyproject.toml` will define a workspace root...

Instead, I think we should _start_ the search at the workspace root, but
go above it if necessary.

Closes: #5929.

See: #4295.
zanieb pushed a commit that referenced this pull request Aug 9, 2024
Previously, we wouldn't respect configuration files in directories
_above_ a workspace root. But this is somewhat problematic, because any
`pyproject.toml` will define a workspace root...

Instead, I think we should _start_ the search at the workspace root, but
go above it if necessary.

Closes: #5929.

See: #4295.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Settings and such preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants