Skip to content

Commit 9870073

Browse files
committed
ewoks install: fresh env by default and support pip+venv, uv, poetry, pixi and conda
1 parent 40a548d commit 9870073

63 files changed

Lines changed: 4853 additions & 788 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
${{ matrix.extra-pytest-warnings }}
3333
enable-coverage: ${{ matrix.enable-coverage }}
3434
jupyter-platform-dirs: "1"
35+
package-managers: ${{ matrix.package-managers }}
3536
codecov-flags: "unit"
3637
strategy:
3738
fail-fast: false
@@ -41,42 +42,50 @@ jobs:
4142
python-version: "3.8"
4243
enable-coverage: "false"
4344
extra-pytest-warnings: ""
45+
package-managers: "uv poetry pixi conda"
4446

4547
- os: ubuntu-latest
4648
python-version: "3.9"
4749
enable-coverage: "false"
4850
# https://github.com/networkx/networkx/issues/7372
4951
extra-pytest-warnings: "-W ignore::RuntimeWarning:networkx.utils.backends"
52+
package-managers: "uv poetry pixi conda"
5053

5154
- os: ubuntu-latest
5255
python-version: "3.10"
5356
enable-coverage: "false"
5457
extra-pytest-warnings: ""
58+
package-managers: "uv poetry pixi conda"
5559

5660
- os: ubuntu-latest
5761
python-version: "3.11"
5862
enable-coverage: "false"
5963
extra-pytest-warnings: ""
64+
package-managers: "uv poetry pixi conda"
6065

6166
- os: ubuntu-latest
6267
python-version: "3.12"
6368
enable-coverage: "true"
6469
extra-pytest-warnings: ""
70+
package-managers: "uv poetry pixi conda"
6571

6672
- os: ubuntu-latest
6773
python-version: "3.13"
6874
enable-coverage: "false"
6975
extra-pytest-warnings: ""
76+
package-managers: "uv poetry pixi conda"
7077

7178
- os: ubuntu-latest
7279
python-version: "3.14"
7380
enable-coverage: "false"
7481
extra-pytest-warnings: ""
82+
package-managers: "uv poetry pixi conda"
7583

7684
- os: windows-latest
7785
python-version: "3.9"
7886
enable-coverage: "false"
7987
extra-pytest-warnings: ""
88+
package-managers: "uv poetry pixi conda"
8089

8190
# Run linter / checks
8291
checks:

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- `ewoks install`: create a new python environment for the workflow (named after the workflow, in
13+
the directory the package manager creates environments in) instead of installing in the current
14+
environment. New arguments: `--env-root`, `--env-name`, `--clean`, `--in-place`,
15+
`--python-version` and `--with-ewoks` (add `ewoks` itself when the requirements do not contain
16+
it, so the workflow can be executed in the environment).
17+
- `ewoks execute`: add `--env` argument to execute a workflow in another python environment, for
18+
example one created by `ewoks install`.
1219
- `ewoks install`: add `--package-manager-name` and `--package-manager-command` arguments.
1320
- `ewoks convert`: add `--package-manager-name` and `--package-manager-command` arguments.
21+
- `ewoks convert`: print the package manager that generated the requirements, or that the
22+
requirements are not saved.
1423
- Add `ewoks lint` CLI command to check if a workflow is conform to the Ewoks specification.
24+
- Support the `uv`, `conda`, `pixi` and `poetry` package managers to generate and install workflow
25+
requirements. Every package manager stores the files it needs to reproduce the environment
26+
(`uv.lock`, `environment.yml`, ...) as well as the list of installed python distributions, from
27+
which any other package manager generates its own files to reproduce the environment.
28+
- Documentation: tutorial "Install and execute a workflow" with an end-to-end walk-through for each
29+
package manager, and how-to guide "Reproduce a workflow environment".
30+
31+
### Changed
32+
33+
- The `pip` package manager is named `pip-venv`: it creates environments with `venv` and installs
34+
in them with `pip`.
1535

1636
### Removed
1737

1838
- `ewoks install`: remove `-p/--python` argument.
39+
- Support for the `pipenv` package manager.
1940

2041
## [7.0.0rc1] - 2026-08-02
2142

doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"nbsphinx",
2525
"nbsphinx_link",
2626
"sphinx_copybutton",
27+
"sphinx_tabs.tabs",
2728
]
2829
templates_path = ["_templates"]
2930
exclude_patterns = ["build", "**.ipynb_checkpoints"]

doc/howtoguides.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Getting started
1515
howtoguides/inspect_workflows
1616
howtoguides/gui
1717
howtoguides/python
18+
howtoguides/requirements
1819
howtoguides/engines
1920

2021
Automation

doc/howtoguides/requirements.rst

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
.. _requirements:
2+
3+
Reproduce a workflow environment
4+
================================
5+
6+
A :term:`workflow` stores the python environment it was created in as the ``requirements``
7+
field of its ``graph`` field. ``ewoks install`` recreates that environment and
8+
``ewoks execute --env`` runs the :term:`workflow` in it. See
9+
:ref:`this tutorial <install_tutorial>` for a step-by-step example.
10+
11+
What is stored
12+
--------------
13+
14+
``ewoks convert`` and ``ewoks execute -o convert_destination=...`` store
15+
16+
* ``python`` and ``system``: the python interpreter and the operating system.
17+
* ``distributions``: every installed python package with its version and, when it was not
18+
installed from the python package index, the git commit or the archive it came from. Any
19+
:term:`package manager` can recreate the environment from this list.
20+
* ``manager``: the :term:`package manager` that generated the requirements, with the content
21+
of the files it needs to recreate the environment: ``requirements.txt`` for pip-venv,
22+
``pyproject.toml`` and ``uv.lock`` for uv, ``pyproject.toml`` and ``poetry.lock`` for
23+
poetry, ``environment.yml`` for conda, ``pixi.toml`` and ``pixi.lock`` for pixi.
24+
25+
Use ``--exclude-requirements`` to store nothing.
26+
27+
.. note::
28+
29+
A :term:`workflow` that stores a list of requirements instead of the structure above is
30+
still supported: the list is parsed as a ``requirements.txt`` file.
31+
32+
Select a package manager
33+
------------------------
34+
35+
``ewoks convert`` uses the :term:`package manager` of the current python environment. It is
36+
detected from the environment variables and files that package managers leave behind, and
37+
from the tool that installed most of the packages. Use ``--package-manager-name`` to select
38+
one explicitly
39+
40+
.. code-block:: bash
41+
42+
ewoks convert demo demo.json --test --package-manager-name uv
43+
44+
``ewoks install`` uses the :term:`package manager` that generated the requirements, unless it
45+
is not installed on the machine. It installs the stored files of that :term:`package manager`.
46+
When the requirements do not contain them, or installing them fails, it generates its own
47+
files from the ``distributions`` list and installs those instead. Both installations are
48+
confirmed separately unless ``--yes`` is provided
49+
50+
.. code-block:: bash
51+
52+
# requirements generated by conda, environment created by uv
53+
ewoks install demo.json --yes --package-manager-name uv
54+
55+
``--package-manager-command`` provides the command that invokes the tool, for example when it
56+
is not on the ``PATH`` or when a faster implementation should be used
57+
58+
.. code-block:: bash
59+
60+
ewoks install demo.json --yes --package-manager-name conda \
61+
--package-manager-command micromamba
62+
63+
Choose the environment
64+
----------------------
65+
66+
.. code-block:: bash
67+
68+
# a root directory of your choice instead of the one of the package manager
69+
ewoks install demo.json --yes --env-root /tmp/envs
70+
71+
# a name of your choice instead of the workflow identifier
72+
ewoks install demo.json --yes --env-name demo-env
73+
74+
# remove the environment when it already exists
75+
ewoks install demo.json --yes --clean
76+
77+
# another python version than the one stored in the requirements
78+
ewoks install demo.json --yes --python-version 3.12
79+
80+
# add ewoks itself when the requirements do not contain it
81+
ewoks install demo.json --yes --with-ewoks
82+
83+
# install in the current python environment instead of creating one
84+
ewoks install demo.json --yes --in-place
85+
86+
The default name is the identifier of the :term:`workflow`, which is the ``id`` field of its
87+
``graph`` field. A :term:`workflow` without an identifier gets a name derived from its
88+
content.
89+
90+
Without ``--env-root`` the :term:`package manager` decides where the environment goes: conda
91+
creates it in its own environment directory (``conda config --show envs_dirs``), so
92+
``conda activate <name>`` finds it, and poetry in the directory it creates project
93+
environments in (``poetry config virtualenvs.path``). venv, uv and pixi create an environment
94+
wherever they are told to, so for those ewoks uses ``~/.ewoks/envs``.
95+
96+
An environment that already exists is installed in, which adds the requirements to what is
97+
already there. Use ``--clean`` to remove it first. Only a directory that contains a python
98+
environment is removed.
99+
100+
The environment of a :term:`workflow` is a directory. For pip-venv and conda it is a python
101+
environment, for uv and poetry it is a project with the environment in ``.venv`` and for pixi
102+
it is a workspace with the environment in ``.pixi/envs/default``. ``ewoks execute --env`` takes
103+
that directory, not the python interpreter inside it.
104+
105+
Limitations
106+
-----------
107+
108+
* ``--in-place`` is only supported by pip-venv and uv. The other package managers only install
109+
in an environment they created themselves.
110+
* ``--python-version`` is a request: uv can provide any python version, conda and pixi provide
111+
the patch versions built by their channel, and pip-venv and poetry can only use the version of
112+
the python interpreter that creates the environment. A warning is emitted when the version
113+
cannot be provided.
114+
* uv, poetry and pixi resolve the ``distributions`` into a lock file, which requires access to
115+
the package index. When that fails, a warning is emitted and the requirements are stored
116+
without files: the environment is then recreated from the ``distributions`` list.
117+
* A lock file is only read by a :term:`package manager` that understands its format version, so
118+
reproducing an environment can require a version of the tool that is at least as recent as
119+
the one that generated the requirements.
120+
* poetry 1.8 or later is required. Older versions are reported as not available.
121+
* A package installed from a local directory cannot be recreated elsewhere. This is reported as
122+
a warning when the requirements are generated.

doc/reference/cli.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,27 @@ ewoks install
1818

1919
If no ``requirements`` field exist, **ewoks install** will try to extract requirements from the :term:`tasks <Task>` in the :term:`workflows <Workflow>` before installing them.
2020

21-
Unless ``--yes`` is provided, **ewoks install** will ask for confirmation before installing the packages.
21+
**ewoks install** installs the files of the :term:`package manager` that generated the ``requirements``.
22+
When the ``requirements`` do not contain those files, or installing them fails, the Python ``distributions`` they contain are installed instead.
2223

23-
By default, packages are installed in the current Python environment: if **ewoks install** is run in a virtual environment, the packages will be installed in this virtual environment.
24+
Unless ``--yes`` is provided, **ewoks install** will ask for confirmation before each installation and before removing an existing environment.
25+
26+
By default, packages are installed in a new Python environment named after the workflow identifier, which is the ``id`` field of its ``graph`` field.
27+
The environment is created where the :term:`package manager` creates named environments (``~/.ewoks/envs`` for package managers that do not have such a directory).
28+
Use ``--env-root`` for another directory to create the environment in and ``--env-name`` for another name than the workflow identifier.
29+
An environment that already exists is installed in, unless ``--clean`` is provided to remove it first.
30+
The :term:`workflow` can be executed in that environment when it contains **ewoks** itself, which is the case when the ``requirements`` contain it.
31+
Use ``--with-ewoks`` to add **ewoks** when the ``requirements`` do not contain it, without changing any of the versions they do contain:
32+
33+
.. code-block:: bash
34+
35+
ewoks install myworkflow.json --yes --with-ewoks
36+
ewoks execute --env ~/.ewoks/envs/myworkflow myworkflow.json
37+
38+
Use ``--in-place`` to install in the current Python environment instead. This is not supported by all package managers.
39+
40+
The package manager that generated the ``requirements`` is used to reproduce the environment when it is available.
41+
Provide ``--package-manager-name`` (and optionally ``--package-manager-command``) to use another one: the ``requirements`` always contain the list of installed Python distributions as a fallback.
2442

2543
ewoks convert
2644
-------------

doc/reference/glossary.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,8 @@ Glossary
2828
Execution engine
2929
An execution engine is the underlying software used to execute the :term:`workflow`. :term:`Ewoks` supports multiple execution engines: pypushflow, orange, dask and the ewoks internal excution engine.
3030

31+
Package manager
32+
A package manager creates python environments and installs packages in them. :term:`Ewoks` uses package managers to store the environment in which a :term:`workflow` was created and to recreate it: pip with venv, uv, poetry, conda and pixi.
33+
3134
blissdata
3235
`Blissdata <https://bliss.gitlab-pages.esrf.fr/blissdata>`_ is an API for accessing data from BLISS in memory.

doc/tutorials.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Tutorials
88
tutorials/hello_world
99
tutorials/create_workflow
1010
tutorials/execute
11+
tutorials/install
1112
tutorials/infrastructure
1213
tutorials/external
1314
tutorials/develop

doc/tutorials/execute.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ The :ref:`python interface <execute_python>` for executing :term:`workflows <Wor
1313
1414
The equivalent exists for the :ref:`command-line <cli>`.
1515

16+
A :term:`workflow` can also be executed in a python environment created from the
17+
:term:`workflow` itself
18+
19+
.. code-block:: bash
20+
21+
ewoks install /path/to/graph.json --yes
22+
ewoks execute --env ~/.ewoks/envs/mygraph /path/to/graph.json
23+
24+
See :ref:`this tutorial <install_tutorial>` and
25+
:ref:`this how-to guide <requirements>`.
26+
1627
The :code:`engine=None` argument selects the default :term:`execution engine <Execution engine>`. Documentation on different :term:`execution engines <Execution engine>`:
1728

1829
* `ewoksppf <https://ewoksppf.readthedocs.io/>`_ : execute cyclic :term:`workflows <Workflow>`

doc/tutorials/getting_started.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,16 @@ To inspect or modify a workflow, convert it to a JSON file:
8787
8888
ewoks convert demo demo.json --test
8989
90+
The JSON file also stores the python environment the :term:`workflow` needs, so it can be
91+
recreated later:
92+
93+
.. code-block:: bash
94+
95+
ewoks install demo.json --yes
96+
ewoks execute --env ~/.ewoks/envs/demo demo.json --outputs=all
97+
98+
See the `Install and execute a workflow tutorial <./install.html>`_.
99+
90100
Learn More
91101
==========
92102

0 commit comments

Comments
 (0)