Repository navigation
ewoks install: support the uv package manager #334
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,8 @@ What is stored | |||||||||
| installed from the python package index, the git commit or the archive it came from. Any | ||||||||||
| :term:`package manager` can recreate the environment from this list. | ||||||||||
| * ``manager``: the :term:`package manager` that generated the requirements, with the content | ||||||||||
| of the files it needs to recreate the environment: ``requirements.txt`` for pip-venv. | ||||||||||
| of the files it needs to recreate the environment: ``requirements.txt`` for pip-venv, | ||||||||||
| ``pyproject.toml`` and ``uv.lock`` for uv. | ||||||||||
|
|
||||||||||
| Use ``--exclude-requirements`` to store nothing. | ||||||||||
|
|
||||||||||
|
|
@@ -37,7 +38,7 @@ one explicitly | |||||||||
|
|
||||||||||
| .. code-block:: bash | ||||||||||
|
|
||||||||||
| ewoks convert demo demo.json --test --package-manager-name pip-venv | ||||||||||
| ewoks convert demo demo.json --test --package-manager-name uv | ||||||||||
|
|
||||||||||
| ``ewoks install`` uses the :term:`package manager` that generated the requirements, unless it | ||||||||||
| is not installed on the machine. It installs the stored files of that :term:`package manager`. | ||||||||||
|
|
@@ -47,15 +48,15 @@ confirmed separately unless ``--yes`` is provided | |||||||||
|
|
||||||||||
| .. code-block:: bash | ||||||||||
|
|
||||||||||
| ewoks install demo.json --yes --package-manager-name pip-venv | ||||||||||
| ewoks install demo.json --yes --package-manager-name uv | ||||||||||
|
|
||||||||||
| ``--package-manager-command`` provides the command that invokes the tool, for example when it | ||||||||||
| is not on the ``PATH`` or when a faster implementation should be used | ||||||||||
|
|
||||||||||
| .. code-block:: bash | ||||||||||
|
|
||||||||||
| ewoks install demo.json --yes --package-manager-name pip-venv \ | ||||||||||
| --package-manager-command /path/to/python | ||||||||||
| ewoks install demo.json --yes --package-manager-name uv \ | ||||||||||
| --package-manager-command /path/to/uv | ||||||||||
|
|
||||||||||
| Choose the environment | ||||||||||
| ---------------------- | ||||||||||
|
|
@@ -85,21 +86,28 @@ The default name is the identifier of the :term:`workflow`, which is the ``id`` | |||||||||
| content. | ||||||||||
|
|
||||||||||
| 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``. | ||||||||||
|
|
||||||||||
| An environment that already exists is installed in, which adds the requirements to what is | ||||||||||
| already there. Use ``--clean`` to remove it first. Only a directory that contains a python | ||||||||||
| environment is removed. | ||||||||||
|
|
||||||||||
| The environment of a :term:`workflow` is a directory: for pip-venv it is a virtual | ||||||||||
| environment. ``ewoks execute --env`` takes that directory, not the python interpreter inside | ||||||||||
| it. | ||||||||||
| environment and for uv a project with the environment in ``.venv``. ``ewoks execute --env`` | ||||||||||
| takes that directory, not the python interpreter inside it. | ||||||||||
|
|
||||||||||
| Limitations | ||||||||||
| ----------- | ||||||||||
|
|
||||||||||
| * ``--python-version`` is a request: 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 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. | ||||||||||
|
Comment on lines
+103
to
+105
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The full paragraph is Again I would like to leave this one as it is. |
||||||||||
| * uv resolves the ``distributions`` into a lock file, which requires access to the package | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be good to specify which part is about
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Full version |
||||||||||
| index. When that fails, a warning is emitted and the requirements are stored without files: | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see above |
||||||||||
| 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 | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we only talking about
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, any package manager that has lock files. |
||||||||||
| reproducing an environment can require a version of the tool that is at least as recent as | ||||||||||
| the one that generated the requirements. | ||||||||||
| * A package installed from a local directory cannot be recreated elsewhere. This is reported as | ||||||||||
| a warning when the requirements are generated. | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| .. _install_uv: | ||
|
|
||
| uv | ||
| == | ||
|
|
||
| End-to-end walk-through of `workflow installation and execution <../install.rst>`_ with `uv <https://docs.astral.sh/uv/>`_. | ||
|
|
||
| Install uv | ||
| ---------- | ||
|
|
||
| .. tabs:: | ||
|
|
||
| .. group-tab:: Linux | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export UV_INSTALL_DIR=$HOME/.local/uv/bin # default location | ||
| curl -LsSf https://astral.sh/uv/install.sh | INSTALLER_NO_MODIFY_PATH=1 sh | ||
| export PATH=$UV_INSTALL_DIR:$PATH | ||
|
|
||
| .. group-tab:: macOS | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| export UV_INSTALL_DIR=$HOME/.local/uv/bin # default location | ||
| curl -LsSf https://astral.sh/uv/install.sh | INSTALLER_NO_MODIFY_PATH=1 sh | ||
| export PATH=$UV_INSTALL_DIR:$PATH | ||
|
|
||
| .. group-tab:: Windows | ||
|
|
||
| .. code-block:: powershell | ||
|
|
||
| $env:UV_INSTALL_DIR = "$env:USERPROFILE\.local\uv\bin" # default location | ||
| irm https://astral.sh/uv/install.ps1 | iex | ||
| $env:PATH = "$env:UV_INSTALL_DIR;$env:PATH" | ||
|
|
||
| Producer side | ||
| ------------- | ||
|
|
||
| Create an environment, install :term:`ewoks` in it and store a :term:`workflow` with the | ||
| packages of that environment as its ``requirements`` | ||
|
|
||
| .. tabs:: | ||
|
|
||
| .. group-tab:: Linux | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| uv venv ewoks_producer | ||
| source ewoks_producer/bin/activate | ||
| uv pip install ewoks | ||
| ewoks convert demo demo.json --test | ||
| deactivate | ||
|
|
||
| .. group-tab:: macOS | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| uv venv ewoks_producer | ||
| source ewoks_producer/bin/activate | ||
| uv pip install ewoks | ||
| ewoks convert demo demo.json --test | ||
| deactivate | ||
|
|
||
| .. group-tab:: Windows | ||
|
|
||
| .. code-block:: powershell | ||
|
|
||
| uv venv ewoks_producer | ||
| ewoks_producer\Scripts\activate.ps1 | ||
| uv pip install ewoks | ||
| ewoks convert demo demo.json --test | ||
| deactivate | ||
|
|
||
| Install any package that provides :term:`tasks <Task>` instead of | ||
| ``ewoks`` for a real :term:`workflow`. | ||
|
|
||
| Re-producer side | ||
| ---------------- | ||
|
|
||
| Only ``ewoks`` itself is needed to recreate the environment of ``demo.json`` | ||
|
|
||
| .. tabs:: | ||
|
|
||
| .. group-tab:: Linux | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| uv venv ewoks_reproducer | ||
| source ewoks_reproducer/bin/activate | ||
| uv pip install ewoks | ||
| ewoks install demo.json --yes --env-root ewoks_envs | ||
|
|
||
| .. group-tab:: macOS | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| uv venv ewoks_reproducer | ||
| source ewoks_reproducer/bin/activate | ||
| uv pip install ewoks | ||
| ewoks install demo.json --yes --env-root ewoks_envs | ||
|
|
||
| .. group-tab:: Windows | ||
|
|
||
| .. code-block:: powershell | ||
|
|
||
| uv venv ewoks_reproducer | ||
| ewoks_reproducer\Scripts\activate.ps1 | ||
| uv pip install ewoks | ||
| ewoks install demo.json --yes --env-root ewoks_envs | ||
|
|
||
| The environment of the :term:`workflow` is a uv project in ``ewoks_envs/demo`` with the | ||
| virtual environment in its ``.venv`` directory. | ||
|
|
||
| Execute the workflow | ||
| -------------------- | ||
|
|
||
| .. tabs:: | ||
|
|
||
| .. group-tab:: Linux | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| ewoks execute --env ewoks_envs/demo demo.json --outputs=all | ||
|
|
||
| .. group-tab:: macOS | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| ewoks execute --env ewoks_envs/demo demo.json --outputs=all | ||
|
|
||
| .. group-tab:: Windows | ||
|
|
||
| .. code-block:: powershell | ||
|
|
||
| ewoks execute --env ewoks_envs\demo demo.json --outputs=all | ||
|
|
||
| Clean up | ||
| -------- | ||
|
|
||
| .. tabs:: | ||
|
|
||
| .. group-tab:: Linux | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| deactivate | ||
| rm -rf ewoks_producer ewoks_reproducer ewoks_envs demo.json | ||
|
|
||
| .. group-tab:: macOS | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| deactivate | ||
| rm -rf ewoks_producer ewoks_reproducer ewoks_envs demo.json | ||
|
|
||
| .. group-tab:: Windows | ||
|
|
||
| .. code-block:: powershell | ||
|
|
||
| deactivate | ||
| Remove-Item -Recurse -Force ewoks_producer, ewoks_reproducer, ewoks_envs, demo.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ | |
| class BaseManagerInfo(models.BaseModel): | ||
| name: str = Field( | ||
| description="Package manager that generated the requirements.", | ||
| examples=["pip-venv"], | ||
| examples=["pip-venv", "uv"], | ||
| ) | ||
| version: str = Field( | ||
| description="Version of the package manager.", examples=["25.0.1"] | ||
|
|
@@ -35,8 +35,9 @@ class BaseManagerInfo(models.BaseModel): | |
| default_factory=dict, | ||
| description=( | ||
| "Content of the files the package manager needs to reproduce the " | ||
| "environment: 'requirements.txt' for pip-venv. Empty when the package " | ||
| "manager could not generate them." | ||
| "environment: 'requirements.txt' for pip-venv, 'pyproject.toml' and " | ||
| "'uv.lock' for uv. Empty when the package manager could not generate " | ||
| "them." | ||
| ), | ||
| examples=[{"requirements.txt": "ewoks==7.0.0\nnetworkx==3.4.2\n"}], | ||
| ) | ||
|
|
@@ -184,8 +185,8 @@ def environment_location( | |
|
|
||
| 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) | ||
| use a directory of ewoks. | ||
| Package managers that create an environment wherever they are told to (venv | ||
| and uv) use a directory of ewoks. | ||
|
Comment on lines
+188
to
+189
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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
|
||
| """ | ||
| return EWOKS_ENVIRONMENTS_ROOT | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
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.