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

Allow embedding of script lock files #11064

Open
zanieb opened this issue Jan 29, 2025 · 4 comments
Open

Allow embedding of script lock files #11064

zanieb opened this issue Jan 29, 2025 · 4 comments
Labels
enhancement New feature or improvement to existing functionality wish Not on the immediate roadmap

Comments

@zanieb
Copy link
Member

zanieb commented Jan 29, 2025

e.g., see #6318 (comment)

We added support for script lock files, but they're separate from the script. This makes them easier to detect and operate on. However, for fully reproducible scripts, it may be nice to embed a lockfile in the script itself.

@zanieb zanieb added the enhancement New feature or improvement to existing functionality label Jan 29, 2025
@zanieb zanieb added the wish Not on the immediate roadmap label Jan 29, 2025
@marengaz
Copy link

agree with charlie's comment that "embedded lockfile is somewhat impractical"
perhaps a suitable compromise would be a flag to enforce the use with a lock file?

# /// script
# requires-python = ">=3.12"
# dependencies = [
#     "requests<3",
#     "rich",
# ]
# enforce-lock-file = true
# ///

where uv run --script would throw a helpful error if the lock file wasn't resolvable by usual logic?

@notatallshaw
Copy link
Collaborator

notatallshaw commented Jan 29, 2025

#6318 (comment)

I personally think the embedded lockfile is somewhat impractical -- just way too big. But we can probably support it.

Depends on the use case, for general development environments I agree.

But I can imagine situations where you'd like to send a file to someone outside traditional development, such as sending files to a semi technical user, or academic or other organizations where development best practices are not great and they email or copy files around. In cases like these there's a huge convenience to having just one file, not keeping two together and in sync.

@martimlobao
Copy link

@marengaz The usecase I'm envisioning is more what @notatallshaw is getting at: I don't want the script to fail if there isn't a lockfile, I want to be able to run the script reproducibly as a standalone executable.

I can sympathize with the argument that an inline lockfile might be impractical in some cases though. At the risk of proposing yet another option, perhaps a --inline flag might be a good alternative to allow for each behavior depending on the use case.

@charliermarsh
Copy link
Member

It seems fine to support this as an opt-in thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality wish Not on the immediate roadmap
Projects
None yet
Development

No branches or pull requests

5 participants