Skip to content

Optional Progress #33

Description

@mileslucas

A somewhat common scenario for me while I'm writing package code is optional progress bars, for example

function f(...; progress=true)
	# if progress:
	@progress for ...
    end
end

I know there are a couple ways to accomplish this, one of the ways the Turing folks do it is by wrapping the with progress macro https://github.com/TuringLang/AbstractMCMC.jl/blob/master/src/logging.jl

To avoid code duplication/replication, would it make sense to offer a similar macro directly within ProgressLogging? e.g. @progressif bool_expr ...?

I realize an appropriate counterpoint would be that users can use logging filters and custom loggers to properly show the progress or not, but that is pretty inconvenient. I have some exploratory code that has nested progress bars and it would be infinitely easier to use a keyword argument to control the inner loop's progress bar than a full-blown custom logger.

If there is an easier/better way of accomplishing the same thing, I'd love to hear it, too, but if not, I think this is the right repo to put a solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions