Skip to content

feat: added support for rendering dag with mermaid js#3409

Merged
johanneskoester merged 13 commits intomainfrom
3393-support-for-rendering-dag-with-mermaid-js
Mar 14, 2025
Merged

feat: added support for rendering dag with mermaid js#3409
johanneskoester merged 13 commits intomainfrom
3393-support-for-rendering-dag-with-mermaid-js

Conversation

@Marco-Masera
Copy link
Copy Markdown
Contributor

@Marco-Masera Marco-Masera commented Mar 12, 2025

Description

resolves #3393

Printing of DAG and rule graph supports mermaid-js format.

The --dag and --rulegraph options are rendered as enums with 1 choice - dot or mermaid-js.

The export functions in mermaid could be further used to improve the html report - it seems mermaid generated nice visuals.

Summary by CodeRabbit

  • New Features
    • Enhanced workflow graph visualization options, allowing users to choose between DOT and Mermaid.js output formats.
    • Updated command-line options for DAG and rulegraph to support an optional format argument, with improved help text.
    • Introduced a customizable setting for selecting the preferred DAG rendering style.

@Marco-Masera Marco-Masera linked an issue Mar 12, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 12, 2025

📝 Walkthrough

Walkthrough

This change enhances the command-line interface to allow users to specify the output format for DAG visualizations using the --dag and --rulegraph options. The modifications include updating argument parsing to accept an optional format argument, integrating a new PrintDag enum with values for DOT and Mermaid.js, and modifying the DAG generation methods to provide the selected output format.

Changes

File(s) Change Summary
src/snakemake/cli.py Modified argument parsing for --dag and --rulegraph options to accept an optional argument for specifying the DAG output format. Introduced a new variable print_dag_as in args_to_api to pass the chosen format to the workflow API.
src/snakemake/dag.py Updated the DAG class to support both DOT and Mermaid.js outputs. The rule_dot and __str__ methods were modified to conditionally generate the desired format. New methods mermaid_js and _mermaid_js were added to handle Mermaid.js rendering.
src/snakemake/settings/(enums.py, types.py) Added a new PrintDag enum with constants DOT and MERMAID_JS. Updated DAGSettings with a new attribute print_dag_as (defaulting to PrintDag.DOT) to configure the DAG output format.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant C as CLI Parser
    participant API as Workflow API
    participant D as DAG

    U->>C: Execute command with --dag or --rulegraph argument
    C->>C: Parse CLI arguments (optional format provided)
    C->>API: Call args_to_api(print_dag_as)
    API->>D: Request DAG generation
    alt Format is DOT
        D->>D: Call _dot() for DOT format
    else Format is Mermaid.js
        D->>D: Call mermaid_js() → _mermaid_js() for Mermaid.js format
    end
    D-->>API: Return DAG visualization
    API-->>C: Pass back formatted DAG representation
    C-->>U: Display DAG output
Loading

Suggested reviewers

  • johanneskoester

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown
Contributor

Please format your code with black: black snakemake tests/*.py.

Copy link
Copy Markdown
Contributor

@johanneskoester johanneskoester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! Some remarks below.

Marco-Masera and others added 4 commits March 13, 2025 09:57
Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
@sonarqubecloud
Copy link
Copy Markdown

@Marco-Masera Marco-Masera marked this pull request as ready for review March 13, 2025 09:35
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
snakemake/dag.py (3)

2364-2367: Consider comparing the enum directly instead of converting it to a string.

Using == PrintDag.DOT or == PrintDag.MERMAID_JS is more concise and avoids string conversion:

- if self.workflow.dag_settings.print_dag_as == str(PrintDag.DOT):
-     return self._dot(graph)
- elif self.workflow.dag_settings.print_dag_as == str(PrintDag.MERMAID_JS):
-     return self._mermaid_js(graph)
+ if self.workflow.dag_settings.print_dag_as == PrintDag.DOT:
+     return self._dot(graph)
+ elif self.workflow.dag_settings.print_dag_as == PrintDag.MERMAID_JS:
+     return self._mermaid_js(graph)

2402-2406: Rewrite the lambda expression as a named function for clarity.

This addresses the E731 lint warning. Use a regular function definition instead:

-        node2label = lambda job: " - ".join(
-            chain(
-                [job.rule.name],
-                sorted(map(format_wildcard, self.new_wildcards(job)))
-            )
-        )
+        def node2label(job):
+            return " - ".join(
+                chain(
+                    [job.rule.name],
+                    sorted(map(format_wildcard, self.new_wildcards(job)))
+                )
+            )
🧰 Tools
🪛 Ruff (0.8.2)

2402-2406: Do not assign a lambda expression, use a def

Rewrite node2label as a def

(E731)


3068-3071: Use the enum comparison directly and consider using elif.

To mirror the pattern above and avoid string conversion, update to:

- if self.workflow.dag_settings.print_dag_as == str(PrintDag.DOT):
-     return self.dot()
- if self.workflow.dag_settings.print_dag_as == str(PrintDag.MERMAID_JS):
-     return self.mermaid_js()
+ if self.workflow.dag_settings.print_dag_as == PrintDag.DOT:
+     return self.dot()
+ elif self.workflow.dag_settings.print_dag_as == PrintDag.MERMAID_JS:
+     return self.mermaid_js()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87dec8f and dbf5a3c.

📒 Files selected for processing (4)
  • snakemake/cli.py (4 hunks)
  • snakemake/dag.py (4 hunks)
  • snakemake/settings/enums.py (1 hunks)
  • snakemake/settings/types.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.py`: Do not try to improve formatting. Do not suggest ...

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

  • snakemake/settings/enums.py
  • snakemake/settings/types.py
  • snakemake/cli.py
  • snakemake/dag.py
🪛 Ruff (0.8.2)
snakemake/dag.py

2402-2406: Do not assign a lambda expression, use a def

Rewrite node2label as a def

(E731)

🔇 Additional comments (11)
snakemake/settings/types.py (2)

42-42: LGTM: Import of PrintDag added successfully

The PrintDag enumeration is properly imported from the enums module.


213-213: LGTM: New DAG printing format option is well-integrated

The print_dag_as attribute is properly added to the DAGSettings class with a sensible default of PrintDag.DOT, ensuring backward compatibility while enabling the new mermaid-js format capability.

snakemake/settings/enums.py (1)

38-40: LGTM: Well-structured enumeration for DAG output formats

The PrintDag enumeration follows the same pattern as other enums in the file, inheriting from SettingsEnumBase, and provides clear options for DOT (0) and MERMAID_JS (1) formats.

snakemake/cli.py (5)

71-71: LGTM: PrintDag imported correctly

The PrintDag enumeration is properly imported from the settings types module.


1039-1050: LGTM: Well-designed CLI parameter for DAG output format

The --dag argument has been enhanced to accept an optional value with choices from PrintDag.choices(). The default value is sensibly set to PrintDag.DOT for backward compatibility. The help text has been updated to mention both format options.


1052-1066: LGTM: Well-designed CLI parameter for rule graph output format

Similarly to the --dag option, the --rulegraph argument has been enhanced to accept an optional value with choices from PrintDag.choices() with backward compatibility maintained.


2024-2030: LGTM: Properly implemented format selection logic

The code correctly parses the format selection from either the --dag or --rulegraph arguments and assigns it to the print_dag_as variable, which is then passed to the DAG API.


2048-2048: LGTM: Format option properly passed to DAG settings

The print_dag_as value is correctly passed to the DAGSettings constructor, which will control how the DAG is rendered.

snakemake/dag.py (3)

58-58: New import for PrintDag looks good.

This import is necessary for the newly introduced DAG output format checks.


2392-2411: Function mermaid_js adds a welcome feature for rendering DAG in Mermaid.js format.

These lines provide a convenient interface for generating a Mermaid-based visualization of the DAG.

🧰 Tools
🪛 Ruff (0.8.2)

2402-2406: Do not assign a lambda expression, use a def

Rewrite node2label as a def

(E731)


2412-2455: New _mermaid_js method seems well-structured.

This method properly constructs a text-based Mermaid.js flowchart including styling, color-coding, and edges.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/snakemake/dag.py (1)

2392-2410: Function structure improvement recommended.

The code introduces a new mermaid_js method that's well-structured and mirrors the existing dot method. However, using a lambda for node2label violates PEP 8 style guidelines.

Replace the lambda with a regular function definition:

-    node2label = lambda job: " - ".join(
-        chain(
-            [job.rule.name], sorted(map(format_wildcard, self.new_wildcards(job)))
-        )
-    )
+    def node2label(job):
+        return " - ".join(
+            chain(
+                [job.rule.name], sorted(map(format_wildcard, self.new_wildcards(job)))
+            )
+        )
🧰 Tools
🪛 Ruff (0.8.2)

2402-2406: Do not assign a lambda expression, use a def

Rewrite node2label as a def

(E731)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dbf5a3c and 64fb968.

📒 Files selected for processing (4)
  • src/snakemake/cli.py (4 hunks)
  • src/snakemake/dag.py (4 hunks)
  • src/snakemake/settings/enums.py (1 hunks)
  • src/snakemake/settings/types.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.py`: Do not try to improve formatting. Do not suggest ...

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

  • src/snakemake/settings/enums.py
  • src/snakemake/settings/types.py
  • src/snakemake/cli.py
  • src/snakemake/dag.py
🪛 Ruff (0.8.2)
src/snakemake/dag.py

2402-2406: Do not assign a lambda expression, use a def

Rewrite node2label as a def

(E731)

⏰ Context from checks skipped due to timeout of 90000ms (17)
  • GitHub Check: tests (10, windows-latest, py312, bash)
  • GitHub Check: tests (10, windows-latest, py311, bash)
  • GitHub Check: tests (10, ubuntu-latest, py312, bash)
  • GitHub Check: tests (10, ubuntu-latest, py311, bash)
  • GitHub Check: tests (4, ubuntu-latest, py312, bash)
  • GitHub Check: tests (3, windows-latest, py312, bash)
  • GitHub Check: tests (3, windows-latest, py311, bash)
  • GitHub Check: tests (3, ubuntu-latest, py312, bash)
  • GitHub Check: tests (3, ubuntu-latest, py311, bash)
  • GitHub Check: tests (2, windows-latest, py312, bash)
  • GitHub Check: tests (2, windows-latest, py311, bash)
  • GitHub Check: tests (2, ubuntu-latest, py312, bash)
  • GitHub Check: tests (2, ubuntu-latest, py311, bash)
  • GitHub Check: tests (1, windows-latest, py312, bash)
  • GitHub Check: tests (1, windows-latest, py311, bash)
  • GitHub Check: tests (1, ubuntu-latest, py312, bash)
  • GitHub Check: tests (1, ubuntu-latest, py311, bash)
🔇 Additional comments (12)
src/snakemake/settings/enums.py (1)

38-40: Implementation looks good!

The PrintDag enum is well-structured with clear values for DOT and MERMAID_JS formats. This is consistent with the style of other enums in this file.

src/snakemake/settings/types.py (2)

42-42: Import of PrintDag is correctly added.

The import addition is properly placed within the existing imports group.


213-213: DAGSettings field implementation looks good.

The print_dag_as field is properly added to the DAGSettings class with a sensible default of PrintDag.DOT, maintaining backward compatibility.

src/snakemake/cli.py (6)

71-71: Import of PrintDag is correctly added.

The import addition is properly placed within the existing imports group for settings types.


1039-1050: CLI argument for DAG format looks good.

The implementation properly adds format options to the --dag command with appropriate choices and defaults. The help text is updated to mention the mermaid-js option.


1052-1066: CLI argument for rulegraph format looks good.

The implementation properly adds format options to the --rulegraph command with appropriate choices and defaults. The help text is updated to mention the mermaid-js option.


2024-2030: Logic to handle format selection is well implemented.

The code appropriately captures the format selection from either --dag or --rulegraph arguments and stores it in the print_dag_as variable.


2048-2048: DAG settings parameter is correctly passed.

The print_dag_as value is properly passed to the DAGSettings constructor, ensuring the selected format will be used by the DAG rendering logic.


2074-2077:

Details

❓ Verification inconclusive

Verify the actual DAG rendering implementation.

While the CLI and settings changes look good, the actual implementation of rendering DAGs in mermaid-js format would likely be in another file (probably src/snakemake/dag.py). Make sure that file has been updated to handle the new format.


🏁 Script executed:

#!/bin/bash
# Check for changes to dag.py to support mermaid-js format
rg -A 10 "mermaid_js|MERMAID_JS" src/snakemake/dag.py

Length of output: 1544


Mermaid-js DAG Rendering Verified – Please Double-Check Recursive Flow

I’ve confirmed that the DAG rendering implementation in src/snakemake/dag.py now includes support for the mermaid-js format. In particular, the added methods (mermaid_js and _mermaid_js) correctly use the workflow’s dag_settings under the condition comparing to PrintDag.MERMAID_JS.

  • The mermaid_js method sets up the node styling (and labels) and calls _mermaid_js.
  • The _mermaid_js method, after performing local computations (e.g. color conversion), conditionally returns self.mermaid_js() when the print setting is MERMAID_JS.

Please ensure that the recursive call from _mermaid_js back to mermaid_js is intentional and properly guarded against infinite recursion.

src/snakemake/dag.py (3)

58-58: Clear import addition for the new PrintDag enum.

The import of PrintDag from snakemake.settings.types is properly added to support the new format selection functionality.


2364-2367: Well-structured conditional rendering based on the format setting.

The rule_dot method now properly handles both the original DOT format and the new Mermaid.js format based on the workflow's print_dag_as setting.


2412-2455: Comprehensive implementation of Mermaid.js generation function.

The _mermaid_js method implementation is well-designed:

  • It provides similar functionality to the existing _dot method
  • It correctly handles node styling and labeling
  • It generates proper Mermaid.js syntax with the flowchart TB (top-to-bottom) directive
  • Colors are generated consistently for rules, ensuring deterministic output

The HTML hex RGB color generation function is properly implemented.

@Marco-Masera Marco-Masera self-assigned this Mar 13, 2025
@johanneskoester johanneskoester changed the title fix: 3393 added support for rendering dag with mermaid js feat: added support for rendering dag with mermaid js Mar 14, 2025
@johanneskoester
Copy link
Copy Markdown
Contributor

Super nice!

@johanneskoester johanneskoester merged commit 7bf8381 into main Mar 14, 2025
51 checks passed
@johanneskoester johanneskoester deleted the 3393-support-for-rendering-dag-with-mermaid-js branch March 14, 2025 10:19
@github-project-automation github-project-automation bot moved this from In review to Done in Snakemake Hackathon March 2025 Mar 14, 2025
johanneskoester pushed a commit that referenced this pull request Mar 14, 2025
🤖 I have created a release *beep* *boop*
---


##
[9.0.0](v8.30.0...v9.0.0)
(2025-03-14)


### ⚠ BREAKING CHANGES

* Logging refactor & add LoggerPluginInterface
([#3107](#3107))

### Features

* [#3412](#3412) - keep
shadow folder of failed job if --keep-incomplete flag is set.
([#3430](#3430))
([22978c3](22978c3))
* add flag --report-after-run to automatically generate the report after
a successfull workflow run
([#3428](#3428))
([b0a7f03](b0a7f03))
* add flatten function to IO utils
([#3424](#3424))
([67fa392](67fa392))
* add helper functions to parse input files
([#2918](#2918))
([63e45a7](63e45a7))
* Add option to print redacted file names
([#3089](#3089))
([ba4d264](ba4d264))
* add support for validation of polars dataframe and lazyframe
([#3262](#3262))
([c7473a6](c7473a6))
* added support for rendering dag with mermaid js
([#3409](#3409))
([7bf8381](7bf8381))
* adding --replace-workflow-config to fully replace workflow configs
(from config: directive) with --configfile, instead of merging them
([#3381](#3381))
([47504a0](47504a0))
* Dynamic module name
([#3401](#3401))
([024dc32](024dc32))
* Enable saving and reloading IOCache object
([#3386](#3386))
([c935953](c935953))
* files added in rule params with workflow.source_path will be available
in used containers
([#3385](#3385))
([a6e45bf](a6e45bf))
* Fix keep_local in storage directive and more freedom over remote
retrieval behaviour
([#3410](#3410))
([67b4739](67b4739))
* inherit parameters of use rule and extend/replace individual items
them when using 'with' directive
([#3365](#3365))
([93e4b92](93e4b92))
* Logging refactor & add LoggerPluginInterface
([#3107](#3107))
([86f1d6e](86f1d6e))
* Maximal file size for checksums
([#3368](#3368))
([b039f8a](b039f8a))
* Modernize package configuration using Pixi
([#3369](#3369))
([77992d8](77992d8))
* multiext support for named input/output
([#3372](#3372))
([05e1378](05e1378))
* optionally auto-group jobs via temp files in case of remote execution
([#3378](#3378))
([cc9bba2](cc9bba2))


### Bug Fixes

* `--delete-all-output` ignores `--dry-run`
([#3265](#3265))
([23fef82](23fef82))
* 3342 faster touch runs and warning messages for non-existing files
([#3398](#3398))
([cd9c3c3](cd9c3c3))
* add default value to max-jobs-per-timespan
([#3043](#3043))
([2959abe](2959abe))
* checkpoints inside modules are overwritten
([#3359](#3359))
([fba3ac7](fba3ac7))
* Convert Path to IOFile
([#3405](#3405))
([c58684c](c58684c))
* Do not perform storage object cleanup with --keep-storage-local-copies
set ([#3358](#3358))
([9a6d14b](9a6d14b))
* edgecases of source deployment in case of remote execution
([#3396](#3396))
([5da13be](5da13be))
* enhance error message formatting for strict DAG-building mode
([#3376](#3376))
([a1c39ee](a1c39ee))
* fix bug in checkpoint handling that led to exceptions in case
checkpoint output was missing upon rerun
([#3423](#3423))
([8cf4a2f](8cf4a2f))
* force check all required outputs
([#3341](#3341))
([495a4e7](495a4e7))
* group job formatting
([#3442](#3442))
([f0b10a3](f0b10a3))
* in remote jobs, upload storage in topological order such that
modification dates are preserved (e.g. in case of group jobs)
([#3377](#3377))
([eace08f](eace08f))
* only skip eval when resource depends on input
([#3374](#3374))
([4574c92](4574c92))
* Prevent execution of conda in apptainer when not explicitly requested
in software deployment method
([#3388](#3388))
([c43c5c0](c43c5c0))
* print filenames with quotes around them in RuleException
([#3269](#3269))
([6baeda5](6baeda5))
* Re-evaluation of free resources
([#3399](#3399))
([6371293](6371293))
* ReadTheDocs layout issue due to src directory change
([#3419](#3419))
([695b127](695b127))
* robustly escaping quotes in generated bash scripts (v2)
([#3297](#3297))
([#3389](#3389))
([58720bd](58720bd))
* Show apptainer image URL in snakemake report
([#3407](#3407))
([45f0450](45f0450))
* Update ReadTheDocs configuration for documentation build to use Pixi
([#3433](#3433))
([3f227a6](3f227a6))


### Documentation

* Add pixi setup instructions to general use tutorial
([#3382](#3382))
([115e81b](115e81b))
* fix contribution section heading levels, fix docs testing setup order
([#3360](#3360))
([051dc53](051dc53))
* fix link to github.com/snakemake/poetry-snakemake-plugin
([#3436](#3436))
([ec6d97c](ec6d97c))
* fix quoting
([#3394](#3394))
([b40f599](b40f599))
* fix rerun-triggers default
([#3403](#3403))
([4430e23](4430e23))
* fix typo 'safe' -&gt; 'save'
([#3384](#3384))
([7755861](7755861))
* mention code formatting in the contribution section
([#3431](#3431))
([e8682b7](e8682b7))
* remove duplicated 'functions'.
([#3356](#3356))
([7c595db](7c595db))
* update broken links documentation
([#3437](#3437))
([e3d0d88](e3d0d88))
* Updating contributing guidelines with new pixi dev setup
([#3415](#3415))
([8e95a12](8e95a12))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: snakemake-bot <snakemake-bot-admin@googlegroups.com>
kjohnsen pushed a commit to kjohnsen/snakemake that referenced this pull request Dec 15, 2025
### Description
resolves snakemake#3393

Printing of DAG and rule graph supports mermaid-js format.

The --dag and --rulegraph options are rendered as enums with 1 choice -
dot or mermaid-js.

The export functions in mermaid could be further used to improve the
html report - it seems mermaid generated nice visuals.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Enhanced workflow graph visualization options, allowing users to
choose between DOT and Mermaid.js output formats.
- Updated command-line options for DAG and rulegraph to support an
optional format argument, with improved help text.
- Introduced a customizable setting for selecting the preferred DAG
rendering style.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
kjohnsen pushed a commit to kjohnsen/snakemake that referenced this pull request Dec 15, 2025
🤖 I have created a release *beep* *boop*
---


##
[9.0.0](snakemake/snakemake@v8.30.0...v9.0.0)
(2025-03-14)


### ⚠ BREAKING CHANGES

* Logging refactor & add LoggerPluginInterface
([snakemake#3107](snakemake#3107))

### Features

* [snakemake#3412](snakemake#3412) - keep
shadow folder of failed job if --keep-incomplete flag is set.
([snakemake#3430](snakemake#3430))
([22978c3](snakemake@22978c3))
* add flag --report-after-run to automatically generate the report after
a successfull workflow run
([snakemake#3428](snakemake#3428))
([b0a7f03](snakemake@b0a7f03))
* add flatten function to IO utils
([snakemake#3424](snakemake#3424))
([67fa392](snakemake@67fa392))
* add helper functions to parse input files
([snakemake#2918](snakemake#2918))
([63e45a7](snakemake@63e45a7))
* Add option to print redacted file names
([snakemake#3089](snakemake#3089))
([ba4d264](snakemake@ba4d264))
* add support for validation of polars dataframe and lazyframe
([snakemake#3262](snakemake#3262))
([c7473a6](snakemake@c7473a6))
* added support for rendering dag with mermaid js
([snakemake#3409](snakemake#3409))
([7bf8381](snakemake@7bf8381))
* adding --replace-workflow-config to fully replace workflow configs
(from config: directive) with --configfile, instead of merging them
([snakemake#3381](snakemake#3381))
([47504a0](snakemake@47504a0))
* Dynamic module name
([snakemake#3401](snakemake#3401))
([024dc32](snakemake@024dc32))
* Enable saving and reloading IOCache object
([snakemake#3386](snakemake#3386))
([c935953](snakemake@c935953))
* files added in rule params with workflow.source_path will be available
in used containers
([snakemake#3385](snakemake#3385))
([a6e45bf](snakemake@a6e45bf))
* Fix keep_local in storage directive and more freedom over remote
retrieval behaviour
([snakemake#3410](snakemake#3410))
([67b4739](snakemake@67b4739))
* inherit parameters of use rule and extend/replace individual items
them when using 'with' directive
([snakemake#3365](snakemake#3365))
([93e4b92](snakemake@93e4b92))
* Logging refactor & add LoggerPluginInterface
([snakemake#3107](snakemake#3107))
([86f1d6e](snakemake@86f1d6e))
* Maximal file size for checksums
([snakemake#3368](snakemake#3368))
([b039f8a](snakemake@b039f8a))
* Modernize package configuration using Pixi
([snakemake#3369](snakemake#3369))
([77992d8](snakemake@77992d8))
* multiext support for named input/output
([snakemake#3372](snakemake#3372))
([05e1378](snakemake@05e1378))
* optionally auto-group jobs via temp files in case of remote execution
([snakemake#3378](snakemake#3378))
([cc9bba2](snakemake@cc9bba2))


### Bug Fixes

* `--delete-all-output` ignores `--dry-run`
([snakemake#3265](snakemake#3265))
([23fef82](snakemake@23fef82))
* 3342 faster touch runs and warning messages for non-existing files
([snakemake#3398](snakemake#3398))
([cd9c3c3](snakemake@cd9c3c3))
* add default value to max-jobs-per-timespan
([snakemake#3043](snakemake#3043))
([2959abe](snakemake@2959abe))
* checkpoints inside modules are overwritten
([snakemake#3359](snakemake#3359))
([fba3ac7](snakemake@fba3ac7))
* Convert Path to IOFile
([snakemake#3405](snakemake#3405))
([c58684c](snakemake@c58684c))
* Do not perform storage object cleanup with --keep-storage-local-copies
set ([snakemake#3358](snakemake#3358))
([9a6d14b](snakemake@9a6d14b))
* edgecases of source deployment in case of remote execution
([snakemake#3396](snakemake#3396))
([5da13be](snakemake@5da13be))
* enhance error message formatting for strict DAG-building mode
([snakemake#3376](snakemake#3376))
([a1c39ee](snakemake@a1c39ee))
* fix bug in checkpoint handling that led to exceptions in case
checkpoint output was missing upon rerun
([snakemake#3423](snakemake#3423))
([8cf4a2f](snakemake@8cf4a2f))
* force check all required outputs
([snakemake#3341](snakemake#3341))
([495a4e7](snakemake@495a4e7))
* group job formatting
([snakemake#3442](snakemake#3442))
([f0b10a3](snakemake@f0b10a3))
* in remote jobs, upload storage in topological order such that
modification dates are preserved (e.g. in case of group jobs)
([snakemake#3377](snakemake#3377))
([eace08f](snakemake@eace08f))
* only skip eval when resource depends on input
([snakemake#3374](snakemake#3374))
([4574c92](snakemake@4574c92))
* Prevent execution of conda in apptainer when not explicitly requested
in software deployment method
([snakemake#3388](snakemake#3388))
([c43c5c0](snakemake@c43c5c0))
* print filenames with quotes around them in RuleException
([snakemake#3269](snakemake#3269))
([6baeda5](snakemake@6baeda5))
* Re-evaluation of free resources
([snakemake#3399](snakemake#3399))
([6371293](snakemake@6371293))
* ReadTheDocs layout issue due to src directory change
([snakemake#3419](snakemake#3419))
([695b127](snakemake@695b127))
* robustly escaping quotes in generated bash scripts (v2)
([snakemake#3297](snakemake#3297))
([snakemake#3389](snakemake#3389))
([58720bd](snakemake@58720bd))
* Show apptainer image URL in snakemake report
([snakemake#3407](snakemake#3407))
([45f0450](snakemake@45f0450))
* Update ReadTheDocs configuration for documentation build to use Pixi
([snakemake#3433](snakemake#3433))
([3f227a6](snakemake@3f227a6))


### Documentation

* Add pixi setup instructions to general use tutorial
([snakemake#3382](snakemake#3382))
([115e81b](snakemake@115e81b))
* fix contribution section heading levels, fix docs testing setup order
([snakemake#3360](snakemake#3360))
([051dc53](snakemake@051dc53))
* fix link to github.com/snakemake/poetry-snakemake-plugin
([snakemake#3436](snakemake#3436))
([ec6d97c](snakemake@ec6d97c))
* fix quoting
([snakemake#3394](snakemake#3394))
([b40f599](snakemake@b40f599))
* fix rerun-triggers default
([snakemake#3403](snakemake#3403))
([4430e23](snakemake@4430e23))
* fix typo 'safe' -&gt; 'save'
([snakemake#3384](snakemake#3384))
([7755861](snakemake@7755861))
* mention code formatting in the contribution section
([snakemake#3431](snakemake#3431))
([e8682b7](snakemake@e8682b7))
* remove duplicated 'functions'.
([snakemake#3356](snakemake#3356))
([7c595db](snakemake@7c595db))
* update broken links documentation
([snakemake#3437](snakemake#3437))
([e3d0d88](snakemake@e3d0d88))
* Updating contributing guidelines with new pixi dev setup
([snakemake#3415](snakemake#3415))
([8e95a12](snakemake@8e95a12))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: snakemake-bot <snakemake-bot-admin@googlegroups.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Support for rendering DAG with mermaid js

2 participants