Skip to content

[ENH] Refactor progress bar backend to allow user choice#638

Closed
arnavk23 wants to merge 8 commits into
pytorch-tabular:mainfrom
arnavk23:refactor-progress-bar-backend
Closed

[ENH] Refactor progress bar backend to allow user choice#638
arnavk23 wants to merge 8 commits into
pytorch-tabular:mainfrom
arnavk23:refactor-progress-bar-backend

Conversation

@arnavk23

@arnavk23 arnavk23 commented Feb 2, 2026

Copy link
Copy Markdown

…rich

- Create progress utility module with configurable backends (rich, tqdm, none)
- Update config default to 'simple' and fix metadata
- Make rich an optional dependency
- Update all hard-coded rich imports to use the utility
- Handle progress bar selection in tabular_model callbacks
Comment thread src/pytorch_tabular/categorical_encoders.py Outdated
Comment thread src/pytorch_tabular/feature_extractor.py Outdated
Comment thread src/pytorch_tabular/tabular_model.py Outdated

@fkiraly fkiraly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! Though, are you sure this makes rich optional? It is still being used as hard-coded option without an alternative in some places (see above)

- Change internal utilities to use 'none' backend to avoid rich dependency
- Update sweep and tuner to use 'simple' instead of 'rich' when progress enabled
- Refactor predict method to use progress utility instead of manual backend checks
- Ensure all progress usage is configurable and doesn't force rich dependency
- Update get_progress_tracker and get_progress_context defaults from 'rich' to 'none'
- Ensures no hard-coded rich usage in utility functions
- Rich is now truly optional with graceful fallback
- Update fallback lambda functions to accept **kwargs to handle description and other parameters
- Prevents TypeError when progress tracker is called with keyword arguments
@arnavk23 arnavk23 requested a review from fkiraly February 3, 2026 19:50
…allback selection

- Create get_progress_bar_callback() function for choosing progress bar callbacks
- Refactor _prepare_callbacks to use the utility instead of manual if/elif logic
- Further decouples progress bar handling from direct Lightning imports
@fkiraly

fkiraly commented Feb 13, 2026

Copy link
Copy Markdown
Collaborator

It would be appreciated if you would comment on my question.

@arnavk23

Copy link
Copy Markdown
Author

Thanks! Though, are you sure this makes rich optional? It is still being used as hard-coded option without an alternative in some places (see above)

Rich is now truly optional. The refactoring completely decouples rich from core functionality by moving it to extra dependencies, implementing safe "none" defaults across all progress utilities, wrapping every rich import in try/except blocks with graceful no-op fallbacks, and abstracting all progress usage through configurable utilities that handle missing dependencies elegantly. The library imports and runs fully without rich installed, with all progress functionality degrading to no-ops while preserving user choice to opt into rich via configuration.

@fkiraly

fkiraly commented Feb 16, 2026

Copy link
Copy Markdown
Collaborator

great - let´s see what happens in the tests

@fkiraly fkiraly added enhancement New feature or request dependencies Pull requests that update a dependency file labels Feb 16, 2026
@arnavk23

arnavk23 commented Feb 16, 2026

Copy link
Copy Markdown
Author

@fkiraly The issue was that I removed the get_progress_context function when I added get_progress_bar_callback. The tabular_model_sweep.py and tabular_model_tuner.py modules still import and use get_progress_context for managing progress contexts.

@arnavk23

arnavk23 commented Apr 7, 2026

Copy link
Copy Markdown
Author

@fkiraly Could you run workflows on this again as I fixed the issue that was arising before.

@arnavk23 arnavk23 closed this by deleting the head repository Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants