You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updating ``pixi`` is as simple as ``pixi self-update``
100
+
101
+
- **Ease of Use**: A streamlined CLI (similar to Yarn or Cargo) for quick
102
+
environment creation and management. Try commands like ``pixi init``,
103
+
``pixi add <package>``, or ``pixi run`` to see how intuitive it is.
104
+
105
+
- **Multiple Environments**: Define and switch between multiple sets of
106
+
dependencies under one project.
107
+
Pixi uses a ``feature`` system to compose an ``environment``.
108
+
Think of ``features`` as a way to group dependencies and settings together.
109
+
and an environment is a collection of features.
110
+
This allows easy management of different environments for multiple use.
111
+
See the ``pyproject.toml`` file for an example of how the ``test`` feature
112
+
is used to define the ``dev``, ``py311`` and ``py312`` environments.
113
+
114
+
- **Cross-Platform Solving**: Target Linux, macOS, and Windows from a single
115
+
config. Pixi resolves the correct packages for each platform and captures
116
+
them in a lockfile for reproducible setups—no Docker needed.
117
+
118
+
- **Speed & Conda Compatibility**: Written in Rust, Pixi downloads and solves
119
+
packages in parallel for faster operations. It uses the Conda ecosystem
120
+
and channels, so you get the same packages with improved performance. In
121
+
many cases, Pixi can outperform both Conda and Mamba.
122
+
123
+
To learn more, visit the `Pixi docs <https://pixi.sh>`__ or check out helpful
124
+
guides on `prefix.dev <https://prefix.dev/>`__.
88
125
89
126
Testing Guidelines
90
127
==================
@@ -103,57 +140,74 @@ Setup to run the test suite locally
103
140
104
141
Unit tests and regression tests are written to be run by `pytest <https://docs.pytest.org/en/stable/>`_.
105
142
106
-
Assuming you are on a Linux system, and have a working Conda installation, the standard way to run the tests is explained in the following.
107
-
With sufficient experience, it is however possible to run the tests in different setups, given the expected dependencies are installed.
108
143
109
-
1. Ensure your Conda version is at least 24.7.1 (Snakemake's minimum required Conda version).
110
-
Check the output of ``conda --version`` and update conda if necessary.
111
-
2. Activate strict channel priorities (this is always a good idea when using Conda, see `here <https://conda-forge.org/docs/user/tipsandtricks/#using-multiple-channels>`__ for the rationale), by running ``conda config --set channel_priority strict``.
112
-
3. After checking out the branch you want to test, run these commands:
144
+
.. _pixi-test-guide:
145
+
146
+
Testing Guide using ``pixi``
147
+
=========================
148
+
149
+
**Prerequisites**: Make sure you have ``pixi`` installed: See :ref:`pixi-getting_started`.
150
+
151
+
**Activate your environment**:
152
+
--------------------------------
153
+
154
+
There are a few environments you can use to run the tests.
155
+
156
+
The ``dev`` environment is most useful for overall development.
157
+
This environment will also install the ``docs`` and ``style`` features
158
+
which will allow you to also build documentation and run ``black``.
The ``py311`` and ``py312`` environments are what are used in the
165
+
CI tests which isolate the Python version and the `test` dependencies.
166
+
Use this if you want to test your code against the same environment
167
+
as any failing CI tests.
168
+
169
+
.. code-block:: console
119
170
120
-
You may want to set a specific Python version by editing the constraint in ``test-environment.yml`` before doing this.
121
-
Use of the ``-e``/``--editable`` option to ``pip`` will make your development version of Snakemake the one called when running Snakemake and all the unit tests. You only need to run the ``pip`` command once, not after each time you make code changes.
171
+
$ pixi shell -e py311
122
172
123
-
4. From the base Snakemake folder you may now run any specific test:
173
+
**Run a comprehensive, simple, or single test**:
174
+
The test suite defines two types of tests via ``pixi tasks`` that you can run:
175
+
176
+
**test-all**: This task runs the comprehensive test suite, which includes
177
+
*most* of the tests in the ``tests/`` directory.
178
+
179
+
.. code-block:: console
124
180
125
-
.. code-block:: console
181
+
$ pixi run test-all
126
182
127
-
$ pytest tests/tests.py::test_log_input
183
+
**test-simple**: This task runs the main tests located in ``tests/tests.py``.
128
184
129
-
You can also use the ``-k`` flag to select tests by substring match, rather than by the full name, and the ``--co`` option to preview which tests will be run. Try, for example:
185
+
.. code-block:: console
130
186
131
-
.. code-block:: console
187
+
$ pixi run test-simple
132
188
133
-
$ pytest --co tests/tests.py -k test_modules_all
189
+
**Single test**: You can also run a single test by using ``pytest``
190
+
directly with the test file and the test name.
134
191
135
-
Running the full test suite
136
-
---------------------------
192
+
.. code-block:: console
137
193
138
-
If you simply run ``pytest`` in the top level directory it will scan for and attempt to run every test in the directory, but you will almost certainly get errors as not all tests are working and current.
194
+
$ pixi run pytest tests/tests.py::test_log_input
139
195
140
-
The core test suite is run as a `GitHub action <https://docs.github.com/en/actions/about-github-actions/understanding-github-actions>`_ by the code under ``.github/workflows/main.yml``, so you should look in this file for the list of tests actually expected to pass in a regular test environment.
196
+
.. tip::
197
+
This test suite is quite long, and can be run in parts similar to the
198
+
CI/CD tests which run it in 1/10 parts.
141
199
142
-
At the time of writing this text, the suite is:
200
+
To do so, you can use the ``--splits`` and ``--group`` flags to run
201
+
a subset of the tests. For example, to run the first group of tests
202
+
in a 10 part split:
143
203
144
-
.. code-block::
204
+
.. code-block::console
145
205
146
-
tests/tests.py
147
-
tests/tests_using_conda.py
148
-
tests/test_expand.py
149
-
tests/test_io.py
150
-
tests/test_schema.py
151
-
tests/test_linting.py
152
-
tests/test_executor_test_suite.py
153
-
tests/test_api.py
154
-
tests/test_internals.py
206
+
$ pixi run test-simple \
207
+
--splits 10 \
208
+
--group 1 \
209
+
--splitting-algorithm=least_duration
155
210
156
-
Other tests in the directory may or may not work.
157
211
158
212
Warnings and oddities
159
213
---------------------
@@ -168,9 +222,6 @@ This is likely due to system security profiles that conda, being a non-root appl
168
222
The Debian/Ubuntu ``singularity-container`` DEB package, which must be installed by the system administrator, does work.
169
223
The equivalent RPM package should also work on RedHat-type systems.
170
224
171
-
Tests in ``tests/test_api.py`` require a working ``git``.
172
-
This is not included in ``test-environment.yml`` as it's assumed you must have GIT installed to be working on the source code, but installing git into the conda environment should work if need be.
173
-
174
225
Depending on how the Snakemake code was downloaded and installed in the test environment, Snakemake may not be able to determine its own version and may think that it is version 0.
175
226
The existing unit tests should all cope with this, and in general you should avoid writing tests that rely on explicit version checks.
176
227
@@ -217,46 +268,42 @@ For the documentation, please adhere to the following guidelines:
217
268
Documentation Setup
218
269
-------------------
219
270
220
-
For building the documentation, you have to install the Sphinx.
221
-
If you have already installed Conda, all you need to do is to create a
222
-
Snakemake development environment via
271
+
The documentation is built using `Sphinx <https://www.sphinx-doc.org>`_.
You will also need to install your development version of Snakemake for the docs to be built correctly
273
+
To get started, make sure you have ``pixi`` installed:
274
+
See :ref:`pixi-getting_started`.
275
+
We use ``pixi`` to manage the docs environment and tasks to streamline
276
+
the developer experience.
232
277
233
278
.. code-block:: console
234
279
235
-
$ pip install -e .
280
+
$ ➜ pixi task list --environment docs
236
281
237
-
Then, the docs can be built with
282
+
Tasks that can run on this machine:
283
+
-----------------------------------
284
+
build-docs, docs
238
285
239
-
.. code-block:: console
286
+
- build-docs Build the documentation in the docs/ directory
287
+
- docs Serve the documentation on http://localhost:8000 with live reload
240
288
241
-
$ cd docs
242
-
$ make html
243
-
$ make clean && make html # force rebuild
244
289
245
-
Alternatively, you can use virtualenv.
246
-
The following assumes you have a working Python 3 setup.
290
+
**Test if the docs build**:
291
+
To only build the documentation, you can use the ``build-docs`` task.
[sphinx-autobuild] Serving on http://0.0.0.0:8000
0 commit comments