Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy-load the watchdog event watcher module #8111

Merged
merged 5 commits into from Feb 8, 2024

Conversation

LukasMasuch
Copy link
Collaborator

@LukasMasuch LukasMasuch commented Feb 8, 2024

Describe your changes

If a user configures server.fileWatcherType to none or poll, there isn't any reason we need to import the watchdog package, even if it is installed on the system. This PR applies a couple of small refactorings to make the event_based_path_watcher lazy-loaded (only importer if actually needed).

GitHub Issue Link (if applicable)

Related to #6066

Testing Plan

  • Added e2e test to make sure that watchdog and streamlit.watcher.event_based_path_watcher are lazy loaded.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@LukasMasuch LukasMasuch changed the title Lazy-load the event watcher module [WIP] Lazy-load the event watcher module Feb 8, 2024
@LukasMasuch LukasMasuch changed the title [WIP] Lazy-load the event watcher module [WIP] Lazy-load the watchdog event watcher module Feb 8, 2024
@LukasMasuch LukasMasuch changed the title [WIP] Lazy-load the watchdog event watcher module Lazy-load the watchdog event watcher module Feb 8, 2024
@LukasMasuch LukasMasuch marked this pull request as ready for review February 8, 2024 16:20
@LukasMasuch LukasMasuch merged commit 9375977 into develop Feb 8, 2024
38 checks passed
zyxue pushed a commit to zyxue/streamlit that referenced this pull request Apr 16, 2024
## Describe your changes

If a user configures `server.fileWatcherType` to none or poll, there
isn't any reason we need to import the watchdog package, even if it is
installed on the system. This PR applies a couple of small refactorings
to make the `event_based_path_watcher` lazy-loaded (only importer if
actually needed).

## GitHub Issue Link (if applicable)

Related to streamlit#6066

## Testing Plan

- Added e2e test to make sure that `watchdog` and
`streamlit.watcher.event_based_path_watcher` are lazy loaded.

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this
project are made under the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants