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 unittest, packaging, and openmetrics proto #8150

Merged
merged 8 commits into from Feb 13, 2024

Conversation

LukasMasuch
Copy link
Collaborator

@LukasMasuch LukasMasuch commented Feb 13, 2024

Describe your changes

This is the final lazy-loading PR for now. It lazy-loads the following modules:

  • unittest
  • packaging
  • streamlit.proto.openmetrics_data_model_pb2

This PR also includes a couple of other refactorings related to typing and imports.

GitHub Issue Link (if applicable)

Testing Plan

  • Add lazy-loaded modules to e2e test.

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 native Python packages Lazy-load unittest, packaging, and openmetrics proto Feb 13, 2024
@LukasMasuch LukasMasuch marked this pull request as ready for review February 13, 2024 16:43
@@ -101,7 +106,7 @@ def _get_error_message_args(
self,
orig_exc: BaseException,
failed_obj: Any,
) -> Dict[str, Any]:
) -> dict[str, Any]:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Is this necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these are the new/future annotations. The upper case versions are the old way of typing these structures. Vincent already started adding that in a couple of modules and I have been preparing a bigger PR to update that across our codebase here: https://github.com/streamlit/streamlit/pulls

@LukasMasuch LukasMasuch merged commit 9a390bd into develop Feb 13, 2024
36 checks passed
zyxue pushed a commit to zyxue/streamlit that referenced this pull request Apr 16, 2024
)

## Describe your changes

This is the final lazy-loading PR for now. It lazy-loads the following
modules:

- `unittest`
- `packaging`
- `streamlit.proto.openmetrics_data_model_pb2`

This PR also includes a couple of other refactorings related to typing
and imports.

## GitHub Issue Link (if applicable)

- Closes streamlit#6066

## Testing Plan

- Add lazy-loaded modules to e2e test.

---

**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.

Streamlit startup time could be reduced from 1s to 400ms
2 participants