ewoks install: support the uv package manager - #334
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| self._check_call("venv", "--python", python, environment.prefix) | ||
| return environment | ||
|
|
||
| def _files_from_distributions( |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Implementation looks good. Some suggestions for the doc though.
| 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``. |
There was a problem hiding this comment.
This part is a bit confusing, perhaps we can reword it:
| 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) |
There was a problem hiding this comment.
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.
| * ``--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. |
There was a problem hiding this comment.
| * ``--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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
I think it would be good to specify which part is about ewoks convert and which part is about ewoks install.
| * 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. |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
| 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. |
| * 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 |
There was a problem hiding this comment.
Are we only talking about uv here?
There was a problem hiding this comment.
No, any package manager that has lock files.
| Package managers that create an environment wherever they are told to (venv | ||
| and uv) use a directory of ewoks. |
There was a problem hiding this comment.
I don't understand what "Package managers that create an environment wherever they are told to" and "use a directory of ewoks." mean.
There was a problem hiding this comment.
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_ROOTwherever 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") |
There was a problem hiding this comment.
Should we add in the CONTRIBUTING that uv should be installed to run the full test suite?
There was a problem hiding this comment.
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.
|
Ok to leave the documentation untouched until we have all package managers implemented 👍 |
Co-authored-by: Loïc Huder <42204205+loichuder@users.noreply.github.com> Co-authored-by: Wout De Nolf <wout.de_nolf@esrf.eu>
|
I applied several doc fixes and will deal with the others when everything is done: #336. |
No description provided.