Skip to content

fix(code-style): use uv sync if lock file is present#1088

Open
jorgepiloto wants to merge 6 commits into
mainfrom
fix/code-style-with-uv
Open

fix(code-style): use uv sync if lock file is present#1088
jorgepiloto wants to merge 6 commits into
mainfrom
fix/code-style-with-uv

Conversation

@jorgepiloto

@jorgepiloto jorgepiloto commented Dec 3, 2025

Copy link
Copy Markdown
Member

Fix #926 by using uv pip install or uv sync depending on whether a uv.lock file is present.

@jorgepiloto jorgepiloto requested a review from a team as a code owner December 3, 2025 15:10
@github-actions github-actions Bot added the fix Pull requests related to resolving problems or errors label Dec 3, 2025
Comment thread code-style/action.yml
Comment on lines +253 to +257
if [ -f "uv.lock" ]; then
uv sync
else
uv pip install .
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorgepiloto I was wondering if we could extend this to _doc-build-linux, _doc-build-windows, build-wheelhouse, check-vulnerabilities, and tests-pytest. Those are the actions I have noted where something similar to this might be needed (I am not sure if I am missing some others).

Or we could address those in a separate PR if that is what you prefer.

@MaxJPRey MaxJPRey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then
uv pip install ."${extra_targets}"
if [ -f "uv.lock" ]; then
uv sync --extra "${extra_targets}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uv sync --extra "${extra_targets}"
uv sync --extra "${extra_targets}" --frozen

If we're using the lock file we need to not regenerate it when we sync

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah and we might not want to use dev dependencies so I'd add --no-dev too

Comment thread code-style/action.yml
elif [[ "${BUILD_BACKEND}" == 'uv' ]]; then
uv pip install .
if [ -f "uv.lock" ]; then
uv sync

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
uv sync
uv sync --frozen

run: |
${ACTIVATE_VENV}
if [[ "${USE_UV}" == 'true' ]]; then
uv pip install -U pip

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to not do this with uv.

@SMoraisAnsys

SMoraisAnsys commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Bringing back some activity on this PR :)

I think we have multiple things to discuss before adding lock files:

  1. How to allow it's usage ? Default behavior would be the one proposed here but we could also leverage a new input to allow maintainers to activate it / disable it. My main concern here is the interaction between our now pinned actions' dependencies and the lock file defined by users.

  2. I think the order of installation should be users lock file first then our requirements (open to discussion)

  3. Which actions should be extend with this ability ? At the moment we have some action that can consume requirements files AND uv lock files can be exported in such kind of files so... Maybe to reduce maintenance / action complexity we could avoid adding this ability in such actions and encourage to export ftm ?

  4. Should we extend our action to leverage venv everywhere ? That's not the case atm (see build-library for example) and this could impact how we want to interact with the lock file. If nothing is done we can use sync (when a venv is defined) or install when that's not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull requests related to resolving problems or errors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

code-style has different behavior between uv and poetry backends

6 participants