pepkit / peppy

Project metadata manager for PEPs in Python
https://pep.databio.org/peppy
BSD 2-Clause "Simplified" License
37 stars 13 forks source link

Rich progress display breaks Snakemake DAG visualization #419

Closed matinnuhamunada closed 1 year ago

matinnuhamunada commented 1 year ago

Hi, it seems that the progress bar from rich cause problems in Snakemake DAG visualization. Using python print function in the Snakefile will cause this error: https://github.com/snakemake/snakemake/issues/135

In the Snakefile, using:

pepfile: 'project_config.yaml'

or

peppy.Project('project_config.yaml')

Will generate this progress bar: https://github.com/pepkit/peppy/blob/ca8aa90c161dee0d515cf54c9451081734323d7f/peppy/project.py#L631-L643

This behaviour will break:

snakemake --rulegraph | dot -Tsvg > rulegraph.svg

Suggesstion I think the common thing to do is instead using print, we can direct the ouput to stderr. Is it possible to do this for the progress bar?

From rich documentation:

Redirecting stdout / stderr To avoid breaking the progress display visuals, Rich will redirect stdout and stderr so that you can use the built-in print statement. This feature is enabled by default, but you can disable by setting redirect_stdout or redirect_stderr to False

khoroshevskyi commented 1 year ago

@rafalstepien, you have added this progress bar, can you look on this issue and the PR?

khoroshevskyi commented 1 year ago

Thanks for mentioning this issue. We have merged your PR. This problem will be solved in peppy v0.35.4