Skip to content
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

Remove the graphviz dependency from nf-core #1512

Merged

Conversation

fabianegli
Copy link
Contributor

@fabianegli fabianegli commented Apr 12, 2022

The current default DAG image format SVG requires Graphviz. Using the HTML version removes the Graphviz dependency.

It is now common to see the Warning about the missing Graphviz dependency when running nf-core pipelines. In my limited experience it is often the only warning and often not a very useful at that because the DAG is not a main product of the pipeline in most use cases.

To have the DAG image output as HTML should be fine, since most computers who can display a PNG will also have a browser that can render a HTML file.

Because the Graphviz dependency is on the host system rather than in a container, this means the hassle of installation is left with the user. A big part of Nextflow/nf-core is that it abstracts installations away from users. I consider the Graphviz dependency a clear anti-pattern for Nextflow and nf-core.

Because this makes life easier for users, no additional docs are needed.

This PR arouse out of me seeing

WARN: To render the execution DAG in the required format it is required to install Graphviz -- See http://www.graphviz.org/ for more info.

in a nextflow log on a LSF cluster and the discussion on Slack that followed.

An alternative solution might be to use a Graphviz DSL2 module to produce the PNG and remove the dependency on the host system in the most Nextflow way possible.

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

Copy link
Member

@ewels ewels left a comment

Choose a reason for hiding this comment

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

Please add a mention of the change to the changelog.

@ewels
Copy link
Member

ewels commented Apr 12, 2022

Hah, ok apparently nf-core lint checks for this:

nextflow_config    dag.file did not end with .svg

So the linting needs to be updated too.. (Yay for CI tests that check this stuff!)

Code is here:

# Check that the DAG filename ends in ``.svg``
if "dag.file" in self.nf_config:
if self.nf_config["dag.file"].strip("'\"").endswith(".svg"):
passed.append("Config ``dag.file`` ended with ``.svg``")
else:
failed.append("Config ``dag.file`` did not end with ``.svg``")

@fabianegli
Copy link
Contributor Author

I think the linting test should accept all documented file extensions. Any objections?

@fabianegli
Copy link
Contributor Author

fabianegli commented Apr 12, 2022

I am not entirely happy with the wording in my changes of the changelog, but am too tired to figure that out now. I also wonder if maybe the removal of the only dependency of the default pipeline template besides Java itself doesn't warrant a minor release instead of a patch release, i.e. 2.4.0 instead of 2.3.2. This however is up for discussion and https://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api is not decisive on this issue.

@fabianegli
Copy link
Contributor Author

So many bugs in so little code. Time to call it a day.

@codecov
Copy link

codecov bot commented Apr 12, 2022

Codecov Report

Merging #1512 (e298fe9) into dev (821b34d) will increase coverage by 0.01%.
The diff coverage is 80.00%.

@@            Coverage Diff             @@
##              dev    #1512      +/-   ##
==========================================
+ Coverage   64.91%   64.92%   +0.01%     
==========================================
  Files          52       52              
  Lines        6060     6062       +2     
==========================================
+ Hits         3934     3936       +2     
  Misses       2126     2126              
Impacted Files Coverage Δ
nf_core/lint/nextflow_config.py 77.08% <80.00%> (+0.48%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 821b34d...e298fe9. Read the comment docs.

@fabianegli fabianegli requested a review from ewels April 12, 2022 19:50
CHANGELOG.md Outdated Show resolved Hide resolved
@maxulysse
Copy link
Member

I am not entirely happy with the wording in my changes of the changelog, but am too tired to figure that out now. I also wonder if maybe the removal of the only dependency of the default pipeline template besides Java itself doesn't warrant a minor release instead of a patch release, i.e. 2.4.0 instead of 2.3.2. This however is up for discussion and https://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api is not decisive on this issue.

I think we'll decide the the type of release when we'll do it, so no need to worry about that yourself (for now)

CHANGELOG.md Outdated
Comment on lines 5 to 6
This patch release to removes the Graphviz dependency from default pipeline template.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This patch release to removes the Graphviz dependency from default pipeline template.

I think info in the ## Template are enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the current form it is quite redundant, but this change might need some visibility. Not just because it removes the dependency, but because it should probably mention in the more prominent sentence that the default DAG graph format has changed and that user configs need to change to keep getting the SVG output.

Copy link
Member

Choose a reason for hiding this comment

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

ok for me then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a sentence clarifying the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please double check if it makes sense. I am not yet familiar enough with nextflow to judge what I am writing about configs ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After that, if you think it's ready to merge, I am all for it.

@fabianegli
Copy link
Contributor Author

Should this PR be hashtagged in the CHANGELOG.md?

@maxulysse
Copy link
Member

Should this PR be hashtagged in the CHANGELOG.md?

If you want to, yes, go for it, otherwise, we can merge

@maxulysse maxulysse merged commit 2a1d1be into nf-core:dev Apr 12, 2022
@maxulysse
Copy link
Member

Congrats on the PR @fabianegli

@fabianegli
Copy link
Contributor Author

Thank you. That was very quick. I am very happy right now. 🥳

Thank you for the feedback, help and review @ewels and @maxulysse!

@fabianegli fabianegli deleted the fabianegli-remove-graphviz-dependency branch April 12, 2022 21:28
Copy link
Member

@ewels ewels left a comment

Choose a reason for hiding this comment

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

Sorry, only just got to this and it's already been merged. I think we should revert the change in behaviour about accepting additional file formats though sorry 😞

@@ -2,8 +2,11 @@

## v2.4dev

This patch release to removes the Graphviz dependency from default pipeline template by setting the defaul DAG format to HTML. To keep the previous behaviour, the "dag.file" file extension needs to be changed to ".svg" in the nextflow.config.
Copy link
Member

Choose a reason for hiding this comment

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

It's not a patch release for just this PR 😉 This is just one change in the release. The bullet point below was sufficient, I think you can remove this paragraph.

### Template

- Set the default DAG graphic output to HTML to have a default that does not depend on Graphviz being installed on the host system ([#1512](https://github.com/nf-core/tools/pull/1512)).
Copy link
Member

Choose a reason for hiding this comment

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

👍🏻

if self.nf_config["dag.file"].strip("'\"").endswith(".svg"):
passed.append("Config ``dag.file`` ended with ``.svg``")
_, dag_file_suffix = os.path.splitext(self.nf_config["dag.file"].strip("'\""))
allowed_dag_file_suffixes = [".dot", ".html", ".pdf", ".png", ".svg", ".gexf"]
Copy link
Member

Choose a reason for hiding this comment

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

Too late to the party, but I think we need to revert this sorry.

Whilst it's perfectly valid to accept all, we specifically want to enforce a single standard for nf-core pipelines. People can override in their own configs and even ignore this linting test if it's a problem.

If we allow all formats, then there's nothing to stop people from (probably accidentally) missing this change and continuing with .svg and the problems that this PR is trying to solve. We explicitly want to force people to change to the format that we think is best for nf-core pipelines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am fine with reverting this PR, allowing html only and removing the first sentence in the changelog. I think it is/was mostly necessary because of the multiple allowed formats.

@fabianegli fabianegli restored the fabianegli-remove-graphviz-dependency branch April 13, 2022 04:49
@fabianegli
Copy link
Contributor Author

The feedback is already implemented on the previous branch.

I am not familiar with the GitHub web interface for the revert. May I try?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants