Skip to content

Progress bar to access current/parent environment in map functions.#1221

Merged
hadley merged 12 commits intotidyverse:mainfrom
jcolt45:bug-progress-bars-global-env
Sep 24, 2025
Merged

Progress bar to access current/parent environment in map functions.#1221
hadley merged 12 commits intotidyverse:mainfrom
jcolt45:bug-progress-bars-global-env

Conversation

@jcolt45
Copy link
Contributor

@jcolt45 jcolt45 commented Sep 19, 2025

Formatted strings for progress bars in map functions could only access global environment. Updated map_, map2_, and pmap_ to add caller = .purrr_user_env by default to the .progress argument to access current/parent environments.

Fixes #1078

@hadley
Copy link
Member

hadley commented Sep 24, 2025

Tested interactively with map(1:10, \(i) Sys.sleep(0.5), .progress = list(format = "{x}"))

@hadley
Copy link
Member

hadley commented Sep 24, 2025

@jcolt45 sorry for not having the time to review this interactively 😞, but I'm trying to get a purrr release out soon and didn't want to leave your contribution behind. The main change I made was to pull this out into a helper function, and once I did that I realised we could use it to check that .progress was generally in the correct format. Then I realised we didn't need to pass the environment unless there was a custom format which simplified the implementation a bit more.

@hadley hadley merged commit bc964e1 into tidyverse:main Sep 24, 2025
13 checks passed
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.

Bug: progress bars can only access global environment

2 participants