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

Defer openpyxl import #62

Merged
merged 1 commit into from
Apr 17, 2023
Merged

Defer openpyxl import #62

merged 1 commit into from
Apr 17, 2023

Conversation

joetsoi
Copy link
Contributor

@joetsoi joetsoi commented Apr 14, 2023

Easy win stolen wholesale from this Wednesday's django london talk

See https://adamj.eu/tech/2023/03/02/django-profile-and-improve-import-time/#defer-imports

openpyxl takes ~0.2 seconds to import. This is included in every pytest run whether convert_xlsx_to_csv is used or not.

This also fixes the main branch which is broken since the release of django 4.2 by silencing the pytz usage issues. Maybe another spaday task!

@joetsoi joetsoi force-pushed the defer-openpyxl-import branch 2 times, most recently from febc346 to 198e2dd Compare April 14, 2023 11:48
pytest.ini Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

❓Should this be addressed/discussed in a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to split it off into its own pr if it's clearer/easier to discuss, but I figured this was a small enough pr and I wanted to get the main branch fixed quickly. I briefly looked into the yak shave of making the pytz->zoneinfo change, but it's a bit larger than I wanted to bite off for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#64

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @joetsoi

@cgl cgl requested review from a team April 14, 2023 12:18
@joetsoi joetsoi force-pushed the defer-openpyxl-import branch 2 times, most recently from f0021d1 to fbbed26 Compare April 14, 2023 13:35
Copy link
Collaborator

@cgl cgl left a comment

Choose a reason for hiding this comment

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

I am happy for the changes to be merged after a rebase.
🚢

pytest.ini Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @joetsoi

See https://adamj.eu/tech/2023/03/02/django-profile-and-improve-import-time/#defer-imports

openpyxl takes ~0.2 seconds to import. This is included in every pytest
run whether convert_xlsx_to_csv is used or not.
@joetsoi joetsoi force-pushed the defer-openpyxl-import branch from fbbed26 to f8cfcbe Compare April 17, 2023 12:45
@joetsoi joetsoi merged commit b13f546 into main Apr 17, 2023
@joetsoi joetsoi deleted the defer-openpyxl-import branch April 17, 2023 17:43
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.

2 participants