Skip to content

Conversation

@jonathan-conder
Copy link

@jonathan-conder jonathan-conder commented Dec 4, 2025

This brings the uv plugin in line with python (version 1 and 2) and poetry.

In snaps, launching python can still be slow by default because bytecode is not generated for the standard library when extracting stage-packages.

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run make lint && make test?
  • Have you added an entry to the changelog (docs/reference/changelog.rst)?

@jonathan-conder jonathan-conder requested review from a team as code owners December 4, 2025 02:00
venv_dir = str(self._get_venv_directory().resolve())
return super().get_build_environment() | {
"VIRTUAL_ENV": venv_dir,
"UV_COMPILE_BYTECODE": "1",
Copy link
Contributor

Choose a reason for hiding this comment

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

interesting, I had erroneously assumed this was the default
@lengau do you see any potential issues with this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any issues with it. I think the reason for not doing this was to match the fact that the python and poetry plugins don't compile bytecode either.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the python plugin does this because pip does it by default? I might be mistaken though


Bug fixes:

- The ``uv`` plugin now compiles Python bytecode.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding the changelog entry. While this can be seen as a bug fix I think it might be more appropriate as a new (minor) feature? I see some potential, if unlikely, breakage if two different parts use the uv plugin (pyc files will very frequently conflict in stage)

We might also add a sentence saying that one can use UV_COMPILE_BYTECODE=0 to disable this behavior.

@tigarmo tigarmo requested review from lengau and removed request for a team December 4, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants