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

Feature request: option to not update uv.lock file #5185

Closed
kdeldycke opened this issue Jul 18, 2024 · 3 comments · Fixed by #5196
Closed

Feature request: option to not update uv.lock file #5185

kdeldycke opened this issue Jul 18, 2024 · 3 comments · Fixed by #5196
Assignees
Labels
enhancement New feature or request preview Experimental behavior

Comments

@kdeldycke
Copy link

Using the latest uv:

$ uv --version
uv 0.2.26 (fe403576c 2024-07-17)

Description

When I call a uv run, I get the uv.lock updated and kept in sync automatically. I would like to have a way to tell uv to not change the uv.lock file at all.

Context

I am maintaining several Python-based CLI. To keep their Sphinx-based documentation up-to-date, I rely on a reusable GitHub workflow that calls uv run sphinx-apidoc.

The problem is that while uv run sphinx-apidoc is doing its job producing auto-generated documentation, that way of invoking it is also updating the uv.lock file at the base of the checked-out repository.

And because my last step of the workflow is creating a PR with all local changes, I end up with a noisy PR that not only contain the changes from sphinx-apidoc, but also unexpected updates in uv.lock file.

My quick fix was to add an extra step to force its exclusion:

      - name: Reset uv.lock
        # Exclude `uv.lock` file which might be auto-updated by calls to `uv run`.
        run: |
          git checkout -- uv.lock

And that's how I end up with a clean PR with only the changes produced by sphinx-apidoc.

Now I just wonder if it might be a good idea to add a new option to uv, to let it restrain itself and keep uv.lock as it found it. Something like uv run --no-lock-update.

Discussion

If keeping the uv.lock in sync is good for everyday run, the reason I do not need that behavior in automated workflows is because I already have another dedicated job to keep it in sync.

kdeldycke added a commit to kdeldycke/workflows that referenced this issue Jul 18, 2024
@charliermarsh
Copy link
Member

We have these options on uv sync already, I meant to add them to uv run.

kdeldycke added a commit to kdeldycke/click-extra that referenced this issue Jul 18, 2024
@charliermarsh charliermarsh self-assigned this Jul 18, 2024
@charliermarsh charliermarsh added enhancement New feature or request preview Experimental behavior labels Jul 18, 2024
@charliermarsh
Copy link
Member

I'll likely ship this today.

@kdeldycke
Copy link
Author

Oh wow, that was fast! Thanks @charliermarsh for the quick addition! 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request preview Experimental behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants