Skip to content

Lazy import progress_bar#812

Merged
jph00 merged 1 commit into
mainfrom
fastprogress-lazy-import
May 9, 2026
Merged

Lazy import progress_bar#812
jph00 merged 1 commit into
mainfrom
fastprogress-lazy-import

Conversation

@KeremTurgutlu
Copy link
Copy Markdown
Contributor

@KeremTurgutlu KeremTurgutlu commented May 6, 2026

A lot of projects use from fastcore.utils import * to get the basic utilities, currently there is a huge bottleneck stemming from fasthtml -> fastprogress -> fastcore.parallel. This PR makes progress_bar a lazy import. Python shell scripts such as shell sage will benefit highly from this.

image

@KeremTurgutlu KeremTurgutlu changed the title Lazy import fastprogress Lazy import progress_bar May 6, 2026
@KeremTurgutlu KeremTurgutlu requested a review from jph00 May 6, 2026 11:37
@jph00 jph00 added the enhancement New feature or request label May 9, 2026
Comment thread fastcore/parallel.py
# %% ../nbs/03a_parallel.ipynb #f5327cb3
try: from fastprogress import progress_bar
except: progress_bar = None
def import_progress_bar():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI I don't think this is worth having a function for - it replaces 2 simple lines of code used in 2 places, with 4 less-simple lines of code in the function plus 2 lines to call it! :)

@jph00
Copy link
Copy Markdown
Contributor

jph00 commented May 9, 2026

Thanks! Merging now - but follow up with a PR if you have a chance to remove the function. Or at least make it private.

@jph00 jph00 merged commit f4cf6eb into main May 9, 2026
7 checks passed
jph00 added a commit that referenced this pull request May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants