-
Notifications
You must be signed in to change notification settings - Fork 465
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 loading modules used only in compat.upcast_types
#1492
Conversation
Thanks can you provide some benchmark with import time if you can along with this PR. Just a %timeit running import should be fine |
I have a couple tests passing locally, but the import time drops from about 320 to 160 ms:
|
Thanks! |
Thank you! (I am fixing a test but it is worth it) |
I'm not entirely sure, but I think this change has broken the compatibility with After creating a new virtual environment and installing both python3.9 -m venv venv
source venv/bin/activate
python --version
python -m pip install --upgrade pip
python -m pip install pint pint-pandas
python -c "import pint_pandas" Results in:
The same also happens with Python 3.10.11 and Python 3.11.3. |
Please follow hgrecco/pint-pandas#168 for progress on that issue |
Work in progress. I will rebase #1491 or something similar into this as well.
A quick benchmark (will update when tests are fixed) with pandas installed in this environment:
The headline issue is resolved but I seem to have broken many things along the way; removing
upcast_types
will break other tools that rely on it existing as a list pre-populated with all types it can import.pre-commit run --all-files
with no errors