Skip to content

ewoks install: support the uv package manager - #334

Merged
woutdenolf merged 2 commits into
mainfrom
add_uv_support
Aug 28, 2026
Merged

ewoks install: support the uv package manager#334
woutdenolf merged 2 commits into
mainfrom
add_uv_support

Conversation

@woutdenolf

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.00000% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ewoks/_requirements/uv.py 86.86% 13 Missing ⚠️

📢 Thoughts on this report? Let us know!

@woutdenolf
woutdenolf requested a review from a team August 19, 2026 22:46
self._check_call("venv", "--python", python, environment.prefix)
return environment

def _files_from_distributions(

@woutdenolf woutdenolf Aug 23, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note: I'm currently generation the pyproject.toml file and lock file from python's importlib.metadata (we need those already).

In the future it will try to detect and read those files first.

@loichuder loichuder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Implementation looks good. Some suggestions for the doc though.

Comment thread doc/howtoguides/requirements.rst Outdated
Comment on lines 89 to +91
Without ``--env-root`` the :term:`package manager` decides where the environment goes. venv
creates an environment wherever it is told to, so for pip-venv ewoks uses ``~/.ewoks/envs``.
and uv create an environment wherever they are told to, so for pip-venv and uv ewoks uses
``~/.ewoks/envs``.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This part is a bit confusing, perhaps we can reword it:

Suggested change
Without ``--env-root`` the :term:`package manager` decides where the environment goes. venv
creates an environment wherever it is told to, so for pip-venv ewoks uses ``~/.ewoks/envs``.
and uv create an environment wherever they are told to, so for pip-venv and uv ewoks uses
``~/.ewoks/envs``.
Use ``--env-root`` to choose where the environment will be created. Else, the :term:`package manager` will create it in a default folder (`~/.ewoks/envs` for pip-venv and uv)

@woutdenolf woutdenolf Aug 28, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes this was an LLM extraction of the full paragraph for all managers

Without ``--env-root`` the :term:`package manager` decides where the environment goes: conda
creates it in its own environment directory (``conda config --show envs_dirs``), so
``conda activate <name>`` finds it, and poetry in the directory it creates project
environments in (``poetry config virtualenvs.path``). venv, uv and pixi create an environment
wherever they are told to, so for those ewoks uses ``~/.ewoks/envs``.

I think in the end a bullet-list is better. If you are ok I would like this leave this as it is and refactor ones all managers are included.

Comment on lines +104 to +106
* ``--python-version`` is a request: uv can provide any python version but pip-venv can only
use the version of the python interpreter that creates the environment. A warning is emitted
when the version cannot be provided.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* ``--python-version`` is a request: uv can provide any python version but pip-venv can only
use the version of the python interpreter that creates the environment. A warning is emitted
when the version cannot be provided.
* ``--python-version`` is a request: `uv` can create an environment with any python version but `pip-venv` can only use the version of the python interpreter. A warning is emitted when the version cannot be satisfied.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The full paragraph is

* ``--python-version`` is a request: uv can provide any python version, conda and pixi provide
  the patch versions built by their channel, and pip-venv and poetry can only use the version of
  the python interpreter that creates the environment. A warning is emitted when the version
  cannot be provided.

Again I would like to leave this one as it is.

* ``--python-version`` is a request: uv can provide any python version but pip-venv can only
use the version of the python interpreter that creates the environment. A warning is emitted
when the version cannot be provided.
* uv resolves the ``distributions`` into a lock file, which requires access to the package

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would be good to specify which part is about ewoks convert and which part is about ewoks install.

Suggested change
* uv resolves the ``distributions`` into a lock file, which requires access to the package
* Running `ewoks convert` with `uv` resolves the ``distributions`` into a lock file, which requires access to the package index.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Full version

* uv, poetry and pixi resolve the ``distributions`` into a lock file, which requires access to
  the package index. When that fails, a warning is emitted and the requirements are stored
  without files: the environment is then recreated from the ``distributions`` list.

use the version of the python interpreter that creates the environment. A warning is emitted
when the version cannot be provided.
* uv resolves the ``distributions`` into a lock file, which requires access to the package
index. When that fails, a warning is emitted and the requirements are stored without files:

@loichuder loichuder Aug 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
index. When that fails, a warning is emitted and the requirements are stored without files:
index. If that fails, a warning is emitted and the distributions are stored as-is (without lock file). Running `ewoks install` will then create an environment only from the ``distributions`` list.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

see above

* uv resolves the ``distributions`` into a lock file, which requires access to the package
index. When that fails, a warning is emitted and the requirements are stored without files:
the environment is then recreated from the ``distributions`` list.
* A lock file is only read by a :term:`package manager` that understands its format version, so

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we only talking about uv here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, any package manager that has lock files.

Comment thread doc/tutorials/install/uv.rst Outdated
Comment thread doc/tutorials/install/uv.rst Outdated
Comment on lines +188 to +189
Package managers that create an environment wherever they are told to (venv
and uv) use a directory of ewoks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand what "Package managers that create an environment wherever they are told to" and "use a directory of ewoks." mean.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

directory of ewoks should be "~/.ewoks/envs".

Again the full version is

    def environments_root(self) -> Path:
        """Root directory in which the package manager creates named environments.
        Package managers that create an environment wherever they are told to (venv,
        uv and pixi) use a directory of ewoks.
        """
        return EWOKS_ENVIRONMENTS_ROOT

wherever they are told to -> For some package managers you cannot tell it to create a virtual environment on a specific location. This docstring needs improvement indeed.

def uv_environment(tmp_path) -> Iterator[Environment]:
"""Environment of a uv project."""
if UvManager().version() is None:
pytest.skip("uv is not installed")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we add in the CONTRIBUTING that uv should be installed to run the full test suite?

@woutdenolf woutdenolf Aug 28, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same for pixi etc. When everything is done you will see this in the CI and this can then be used to formulate the contributing.

@loichuder

Copy link
Copy Markdown
Member

Ok to leave the documentation untouched until we have all package managers implemented 👍

Comment thread doc/howtoguides/requirements.rst Outdated
Comment thread doc/tutorials/install/uv.rst Outdated
Comment thread doc/tutorials/install/uv.rst Outdated
Comment thread doc/tutorials/install/uv.rst Outdated
Co-authored-by: Loïc Huder <42204205+loichuder@users.noreply.github.com>
Co-authored-by: Wout De Nolf <wout.de_nolf@esrf.eu>
@woutdenolf

woutdenolf commented Aug 28, 2026

Copy link
Copy Markdown
Member Author

I applied several doc fixes and will deal with the others when everything is done: #336.

@woutdenolf
woutdenolf merged commit 870eae2 into main Aug 28, 2026
12 checks passed
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.

2 participants