Skip to content

Commit 5b461d3

Browse files
Merge branch 'main' into asset-licenses
2 parents 7207842 + 7690998 commit 5b461d3

File tree

29 files changed

+860
-171
lines changed

29 files changed

+860
-171
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ jobs:
8989
>/etc/sysctl.d/90-disable-userns-restrictions.conf'
9090
sudo sysctl -p /etc/sysctl.d/90-disable-userns-restrictions.conf
9191
92+
- name: Setup minio
93+
uses: comfuture/minio-action@v1
94+
with:
95+
access_key: minio
96+
secret_key: minio123
97+
port: 9000
98+
99+
- name: Test minio
100+
run: |
101+
export AWS_ACCESS_KEY_ID=minio
102+
export AWS_SECRET_ACCESS_KEY=minio123
103+
export AWS_EC2_METADATA_DISABLED=true
104+
aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test
105+
92106
- name: Test local
93107
env:
94108
CI: true

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
# Changelog
22

33

4+
## [8.28.0](https://github.com/snakemake/snakemake/compare/v8.27.1...v8.28.0) (2025-02-12)
5+
6+
7+
### Features
8+
9+
* do not fail if --cache is active but no SNAKEMAKE_OUTPUT_CACHE env var is defined. Instead, print a warning that explains the options. ([#3270](https://github.com/snakemake/snakemake/issues/3270)) ([9610f7c](https://github.com/snakemake/snakemake/commit/9610f7c12fac8ef235012ed5ec0496e061af2346))
10+
11+
12+
### Bug Fixes
13+
14+
* do not use outdated metadata for rerun triggers (only warn about it) ([#3259](https://github.com/snakemake/snakemake/issues/3259)) ([d766a48](https://github.com/snakemake/snakemake/commit/d766a48ecc8ebf1cd147996e8d4a5fcdf30e428a))
15+
* ensure that exceptions print storage queries instead of local copies of remote files ([#3258](https://github.com/snakemake/snakemake/issues/3258)) ([e5d8ec1](https://github.com/snakemake/snakemake/commit/e5d8ec172596e4f50df0c4334a964ff063a7967c))
16+
* fix error message of evaluate helper function ([#3282](https://github.com/snakemake/snakemake/issues/3282)) ([9483a64](https://github.com/snakemake/snakemake/commit/9483a642e044fa6be577f099dc2c4b5cc7a3d7d8))
17+
* Revert cleaning of env vars in apptainer ([#3285](https://github.com/snakemake/snakemake/issues/3285)) ([e79a51b](https://github.com/snakemake/snakemake/commit/e79a51b7f12a1ddd32d337b927ac351f73d94c81))
18+
19+
20+
### Performance Improvements
21+
22+
* compare checksums of input files <= 1MB (before (10KB) ([#3267](https://github.com/snakemake/snakemake/issues/3267)) ([ba017bb](https://github.com/snakemake/snakemake/commit/ba017bb636e70eef93085610de3d8290d201330e))
23+
* query updated input files in parallel ([#3266](https://github.com/snakemake/snakemake/issues/3266)) ([bc4fcee](https://github.com/snakemake/snakemake/commit/bc4fceef0bbed7e2efa9b168ac32999b4499ec63))
24+
25+
26+
### Documentation
27+
28+
* Adds instructions for using syntax highlighting with lazy.nvim ([#3246](https://github.com/snakemake/snakemake/issues/3246)) ([7a75043](https://github.com/snakemake/snakemake/commit/7a750434a857ebc912868d36655bab4d32e7db32))
29+
* Fix typos in basic API example ([#3277](https://github.com/snakemake/snakemake/issues/3277)) ([8782219](https://github.com/snakemake/snakemake/commit/8782219392db1ed31b65c384b1dda72790bb8e89))
30+
431
## [8.27.1](https://github.com/snakemake/snakemake/compare/v8.27.0...v8.27.1) (2025-01-08)
532

633

apidocs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
sphinx >=3
1+
sphinx ==8.1 # TODO workaround for bug in 8.2.0, update as soon as fixed
22
sphinxcontrib-napoleon
33
sphinx-argparse
44
sphinx-autodoc-typehints

docs/snakefiles/best_practices.rst

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,59 @@
44
Best practices
55
==============
66

7-
* Snakemake (>=5.11) comes with a code quality checker (a so called linter), that analyzes your workflow and highlights issues that should be solved in order to follow best practices, achieve maximum readability, and reproducibility.
8-
The linter can be invoked with
7+
Care about code quality
8+
-----------------------
99

10-
.. code-block:: bash
10+
Snakemake (>=5.11) comes with a code quality checker (a so called linter), that analyzes your workflow and highlights issues that should be solved in order to follow best practices, achieve maximum readability, and reproducibility.
11+
The linter can be invoked with
12+
13+
.. code-block:: bash
1114
1215
snakemake --lint
1316
14-
given that a ``Snakefile`` or ``workflow/Snakefile`` is accessible from your working directory.
15-
It is **highly recommended** to run the linter before publishing any workflow, asking questions on Stack Overflow or filing issues on Github.
16-
* There is an automatic formatter for Snakemake workflows, called `Snakefmt <https://github.com/snakemake/snakefmt>`_, which should be applied to any Snakemake workflow before publishing it.
17-
* When publishing your workflow in a `Github <https://github.com>`_ repository, it is a good idea to add some minimal test data and configure `Github Actions <https://github.com/features/actions>`_ for continuously testing the workflow on each new commit.
18-
For this purpose, we provide predefined Github actions for both running tests and linting `here <https://github.com/snakemake/snakemake-github-action>`__, as well as formatting `here <https://github.com/snakemake/snakefmt#github-actions>`__.
19-
* For publishing and distributing a Snakemake workflow, it is a good idea to stick to a :ref:`standardized structure <distribution_and_reproducibility>` that is expected by frequent users of Snakemake.
20-
The `Snakemake workflow catalog <https://snakemake.github.io/snakemake-workflow-catalog>`_ automatically lists Snakemake workflows hosted on `Github <https://github.com>`_ if they follow certain `rules <https://snakemake.github.io/snakemake-workflow-catalog/?rules=true>`_.
21-
By complying to these `rules <https://snakemake.github.io/snakemake-workflow-catalog/?rules=true>`_ you can make your workflow more discoverable and even automate its usage documentation (see `"Standardized usage" <https://snakemake.github.io/snakemake-workflow-catalog/?rules=true>`_).
22-
* Configuration of a workflow should be handled via :ref:`config files <snakefiles_standard_configuration>` and, if needed, tabular configuration like sample sheets (either via :ref:`Pandas <snakefiles_tabular_configuration>` or :ref:`PEPs <snakefiles-peps>`).
23-
Use such configuration for metadata and experiment information, **not for runtime specific configuration** like threads, resources and output folders.
24-
For those, just rely on Snakemake's CLI arguments like ``--set-threads``, ``--set-resources``, ``--set-default-resources``, and ``--directory``.
25-
This makes workflows more readable, scalable, and portable.
26-
* Try to keep filenames short (thus easier on the eye), but informative. Avoid mixing of too many special characters (e.g. decide whether to use ``_`` or ``-`` as a separator and do that consistently throughout the workflow).
27-
* Try to keep Python code like helper functions separate from rules (e.g. in a ``workflow/rules/common.smk`` file). This way, you help non-experts to read the workflow without needing to parse internals that are irrelevant for them. The helper function names should be chosen in a way that makes them sufficiently informative without looking at their content. Also avoid ``lambda`` expressions inside of rules.
28-
* Make use of `Snakemake wrappers <https://snakemake-wrappers.readthedocs.io>`_ whenever possible. Consider contributing to the wrapper repo whenever you have a rule that reoccurs in at least two of your workflows.
17+
given that a ``Snakefile`` or ``workflow/Snakefile`` is accessible from your working directory.
18+
It is **highly recommended** to run the linter before publishing any workflow, asking questions on Stack Overflow or filing issues on Github.
19+
20+
Care about code readability
21+
---------------------------
22+
23+
1. There is an automatic formatter for Snakemake workflows, called `Snakefmt <https://github.com/snakemake/snakefmt>`_, which should be applied to any Snakemake workflow before publishing it.
24+
2. Try to keep filenames short (thus easier on the eye), but informative. Avoid mixing of too many special characters (e.g. decide whether to use ``_`` or ``-`` as a separator and do that consistently throughout the workflow).
25+
3. Try to keep Python code like helper functions separate from rules (e.g. in a ``workflow/rules/common.smk`` file). This way, you help non-experts to read the workflow without needing to parse internals that are irrelevant for them. The helper function names should be chosen in a way that makes them sufficiently informative without looking at their content. Also avoid ``lambda`` expressions inside of rules.
26+
4. Use Snakemake's :ref:`semantic helper functions <snakefiles-semantic-helpers>` in order to increase readability and to avoid the reimplementation of common functionality for aggregation, parameter lookup or path modifications.
27+
28+
Ensure portability
29+
------------------
30+
31+
Annotate all your rules with versioned :ref:`Conda <integrated_package_management>` or :ref:`container <apptainer>` based software environment definitions. This ensures that your workflow utilizes the exactly same isolated software stacks, independently of the underlying system.
32+
33+
Generate interactive reports (for free)
34+
---------------------------------------
35+
36+
Annotate your final results for including into Snakemake's automatic :ref:`interactive reports <snakefiles-reports>` (thereby make sure to use all the features, including categories and labels).
37+
This makes them explorable in a high-level way, while connecting them to the workflow code, parameters, and software stack.
38+
39+
Enable configurability
40+
----------------------
41+
42+
Configuration of a workflow should be handled via :ref:`config files <snakefiles_standard_configuration>` and, if needed, tabular configuration like sample sheets (either via :ref:`Pandas <snakefiles_tabular_configuration>` or :ref:`PEPs <snakefiles-peps>`).
43+
Use such configuration for metadata and experiment information, **not for runtime specific configuration** like threads, resources and output folders.
44+
For those, just rely on Snakemake's CLI arguments like ``--set-threads``, ``--set-resources``, ``--set-default-resources``, and ``--directory``.
45+
This makes workflows more readable, scalable, and portable.
46+
47+
Avoid duplication of efforts
48+
----------------------------
49+
50+
Make use of `Snakemake wrappers <https://snakemake-wrappers.readthedocs.io>`_ whenever possible. Consider contributing to the wrapper repo whenever you have a rule that reoccurs in at least two of your workflows.
51+
52+
Test your workflow continuously
53+
-------------------------------
54+
55+
When hosting your workflow in a `Github <https://github.com>`_ repository, it is a good idea to add some minimal test data and configure `Github Actions <https://github.com/features/actions>`_ for continuously testing the workflow on each new commit.For this purpose, we provide predefined Github actions for both running tests and linting `here <https://github.com/snakemake/snakemake-github-action>`__, as well as formatting `here <https://github.com/snakemake/snakefmt#github-actions>`__.
56+
57+
Follow the standards
58+
--------------------
59+
60+
1. For publishing and distributing a Snakemake workflow, it is a good idea to stick to a :ref:`standardized folder structure <distribution_and_reproducibility>` that is expected by frequent users of Snakemake. This simplifies the navigation through the codebase and keeps the workflow repository and the working directory clean.
61+
2. The `Snakemake workflow catalog <https://snakemake.github.io/snakemake-workflow-catalog>`_ automatically lists Snakemake workflows hosted on `Github <https://github.com>`_ if they follow certain `rules <https://snakemake.github.io/snakemake-workflow-catalog/?rules=true>`_.
62+
By complying to these `rules <https://snakemake.github.io/snakemake-workflow-catalog/?rules=true>`_ you can make your workflow more discoverable and even automate its usage documentation (see `"Standardized usage" <https://snakemake.github.io/snakemake-workflow-catalog/?rules=true>`_).

docs/snakefiles/deployment.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ otherwise, it assumes the given specification to point to an existing environmen
422422
Running jobs in containers
423423
--------------------------
424424

425-
As an alternative to using Conda (see above), it is possible to define, for each rule, a (docker) container to use, e.g.,
425+
As an alternative to using Conda (see above), it is possible to define, for each rule, a (Docker) container to use, e.g.,
426426

427427
.. code-block:: python
428428
@@ -448,6 +448,10 @@ it will execute the job within a container that is spawned from the given image.
448448
Allowed image urls entail everything supported by apptainer (e.g., ``shub://`` and ``docker://``).
449449
However, ``docker://`` is preferred, as other container runtimes will be supported in the future (e.g. podman).
450450

451+
Note that the isolation of jobs running in containers depends on the container engine.
452+
For example, Docker does not pass any host environment variables to the container, whereas Apptainer/Singularity passes everything.
453+
To override the default behaviour, consider using ``--apptainer-args`` or ``--singularity-args``, e.g. to pass ``--cleanenv``.
454+
451455
Defining global container images
452456
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
453457

@@ -633,10 +637,10 @@ and reproduce the data analysis at any time in the future.
633637
Global workflow dependencies
634638
----------------------------
635639

636-
Often, your workflow will depend on some additional packages that need to be present
640+
Often, your workflow will depend on some additional packages that need to be present
637641
along with Snakemake in order to handle actions before any rule is executed.
638-
Classical examples for this are `pandas <https://pandas.pydata.org/>`_,
639-
`pep <https://pep.databio.org>`_ (also see :ref:`snakefiles-peps`) and
642+
Classical examples for this are `pandas <https://pandas.pydata.org/>`_,
643+
`pep <https://pep.databio.org>`_ (also see :ref:`snakefiles-peps`) and
640644
:ref:`storage plugins <storage-support>`.
641645

642646
Snakemake allows to define such global dependencies using a global ``conda`` directive
@@ -655,8 +659,8 @@ With ``envs/global.yaml`` containing e.g.::
655659
dependencies:
656660
- pandas=1.0.3
657661
- snakemake-storage-plugin-s3
658-
659-
Under the hood, this is implemented using `conda-inject <https://github.com/koesterlab/conda-inject>`_,
662+
663+
Under the hood, this is implemented using `conda-inject <https://github.com/koesterlab/conda-inject>`_,
660664
which modifies the python searchpath and the PATH variable on the fly during execution,
661665
pointing to additional environments that do not alter the environment in which Snakemake
662666
has been installed.
17.6 KB
Loading

0 commit comments

Comments
 (0)