-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
When updating inline script metadata of a python script via uv add --script, user's comments after the script-comment-block are deleted.
Reproducer:
Create python script foo.py with contents:
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "numpy",
# ]
# ///
#
# Some descriptionRun uv add --script test.py matplotlib. foo.py:
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "matplotlib",
# "numpy",
# ]
# ///As you can see, # Some description has been deleted by uv, even though it is placed after the closing # /// of the script-block.
Adding an empy line (no leading #) helps to preserve the user-comment, but I believe that uv should not touch anything outside the block-boundaries.
Platform
Windows 11 x86_64
Version
uv 0.7.3 (3c413f7 2025-05-07)
Python version
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working