-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Docs: Clarify that uv run syncs dev dependencies by default and how to prevent it #20521
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
base: main
Are you sure you want to change the base?
Changes from all commits
0fb7a26
8ecdd00
8241526
86a075b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1062,6 +1062,10 @@ pub enum ProjectCommand { | |
| /// When used in a project, the project environment will be created and updated before invoking | ||
| /// the command. | ||
| /// | ||
| /// 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`. | ||
| /// | ||
| /// When used outside a project, if a virtual environment can be found in the current directory | ||
| /// or a parent directory, the command will be run in that environment. Otherwise, the command | ||
| /// will be run in the environment of the discovered interpreter. | ||
|
|
@@ -1186,6 +1190,9 @@ pub enum ProjectCommand { | |
| /// At present, `requirements.txt`, `pylock.toml` (PEP 751) and CycloneDX v1.5 JSON output | ||
| /// formats are supported. | ||
| /// | ||
| /// By default, the exported requirements include the project's default dependency groups | ||
| /// (such as the standard dependencies and the `dev` group). | ||
| /// | ||
|
Comment on lines
+1193
to
+1195
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ?? this seems like an inadvertent change |
||
| /// The project is re-locked before exporting unless the `--locked` or `--frozen` flag is | ||
| /// provided. | ||
| /// | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -542,6 +542,14 @@ version = "2.6.3" | |
| requires-dist = ["torch", "einops"] | ||
| ``` | ||
|
|
||
| ## 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
+545
to
+552
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. irrelevant to this PR |
||
| ## Editable mode | ||
|
|
||
| By default, the project will be installed in editable mode, such that changes to the source code are | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,14 @@ and synced before invoking the requested command. This ensures the project envir | |
| up-to-date. Similarly, commands which read the lockfile, such as `uv tree`, will automatically | ||
| update it before running. | ||
|
|
||
| !!! 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. | ||
|
|
||
|
Comment on lines
+14
to
+21
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is the right place to call this out. I'd just remove this part. |
||
| To disable automatic locking, use the `--locked` option: | ||
|
|
||
| ```console | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think
--no-syncis the right thing to suggest here. Also, let's merge this into the above paragraph