Docs: Clarify that uv run syncs dev dependencies by default and how to prevent it#20521
Open
Joosboy wants to merge 4 commits into
Open
Docs: Clarify that uv run syncs dev dependencies by default and how to prevent it#20521Joosboy wants to merge 4 commits into
Joosboy wants to merge 4 commits into
Conversation
zsol
requested changes
Jul 20, 2026
| /// | ||
| /// By default, this environment is synced with development dependencies. To prevent development | ||
| /// dependencies from being installed (e.g., in a production environment), use the `--no-dev` | ||
| /// flag, use the `--no-sync` flag, or set `UV_NO_DEV=1`. |
Member
There was a problem hiding this comment.
I don't think --no-sync is the right thing to suggest here. Also, let's merge this into the above paragraph
Comment on lines
+1193
to
+1195
| /// By default, the exported requirements include the project's default dependency groups | ||
| /// (such as the standard dependencies and the `dev` group). | ||
| /// |
Member
There was a problem hiding this comment.
?? this seems like an inadvertent change
Comment on lines
+545
to
+552
| ## Dynamic metadata | ||
|
|
||
| If your project uses dynamic metadata (e.g., to determine the version or dependencies dynamically), | ||
| uv may need additional configuration to invalidate its cache when the metadata changes. | ||
|
|
||
| See the [caching documentation](../cache.md#dynamic-metadata) for details on configuring cache | ||
| invalidation for dynamic metadata. | ||
|
|
Comment on lines
+14
to
+21
| !!! tip "Syncing in production environments" | ||
|
|
||
| Because `uv run` automatically syncs the environment and includes development dependencies by default, | ||
| it may inadvertently install development dependencies when used in production. | ||
|
|
||
| To avoid this, use the `--no-dev` flag (e.g., `uv run --no-dev ...`), or `--no-sync` if the environment | ||
| is already prepared (e.g., via an earlier `uv sync --no-dev`). You can also enforce this by setting `UV_NO_SYNC=1` or `UV_NO_DEV=1` in your environment. | ||
|
|
Member
There was a problem hiding this comment.
I don't think this is the right place to call this out. I'd just remove this part.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16994.
Adds documentation to the CLI help for
uv runand the syncing concepts guide to explicitly call out thatuv runautomatically syncs development dependencies by default, which can cause them to be inadvertently installed in production environments. Advises users to use--no-dev,--no-sync, or the corresponding environment variables.