Skip to content

ENH Remove import time warning for missing lzma #43495

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

Merged
merged 13 commits into from
Nov 28, 2021

Conversation

rth
Copy link
Contributor

@rth rth commented Sep 10, 2021

Also adds a test that lzma is not imported by default with import pandas.

cc @TomAugspurger

@pep8speaks
Copy link

pep8speaks commented Sep 10, 2021

Hello @rth! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-11-28 21:37:44 UTC

@@ -102,27 +102,7 @@ def is_platform_arm() -> bool:
return platform.machine() in ("arm64", "aarch64")


def import_lzma():
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this is considered to be public API and would need a deprecation cycle?

Copy link
Contributor

Choose a reason for hiding this comment

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

no its not

@rth rth marked this pull request as draft September 10, 2021 11:39
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

prob reasonable.

can you add a whatsnew note. put in I/O Bug fixes for 1.4

also I think its worth a note in the install.rst

@jreback jreback added the Dependencies Required and optional dependencies label Sep 10, 2021
@TomAugspurger
Copy link
Contributor

I think the code check at

pandas/ci/code_checks.sh

Lines 48 to 50 in 3467469

blocklist = {'bs4', 'gcsfs', 'html5lib', 'http', 'ipython', 'jinja2', 'hypothesis',
'lxml', 'matplotlib', 'openpyxl', 'py', 'pytest', 's3fs', 'scipy',
'tables', 'urllib.request', 'xlrd', 'xlsxwriter', 'xlwt'}
could be updated to add lzma, rather than the test you added.

@jreback
Copy link
Contributor

jreback commented Oct 4, 2021

can you merge master and addresss comments

@rth rth marked this pull request as ready for review October 8, 2021 11:47
@rth
Copy link
Contributor Author

rth commented Oct 8, 2021

Thanks for the reviews (and for the reminder)! I addressed the comments.

@@ -362,6 +362,7 @@ zlib Compression for HDF5
fastparquet 0.4.0 Parquet reading / writing
pyarrow 0.17.0 Parquet, ORC, and feather reading / writing
pyreadstat SPSS files (.sav) reading
Python with lzma module None Reading files with .lzma or .xz compression
Copy link
Contributor

Choose a reason for hiding this comment

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

i am not sure what this means, so would remove it

@jreback
Copy link
Contributor

jreback commented Oct 10, 2021

pls merge master as well

@jreback
Copy link
Contributor

jreback commented Nov 6, 2021

@@ -102,27 +102,7 @@ def is_platform_arm() -> bool:
return platform.machine() in ("arm64", "aarch64")


def import_lzma():
Copy link
Contributor

Choose a reason for hiding this comment

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

no its not

@rth
Copy link
Contributor Author

rth commented Nov 6, 2021

@jreback Yes, sorry for slow iterations. I'll look into it tomorrow.

@jreback
Copy link
Contributor

jreback commented Nov 28, 2021

needs to merge master

@rth
Copy link
Contributor Author

rth commented Nov 28, 2021

Thanks for your patience @jreback . I merged master and removed lzma from the blocklist import (which fails) due to an optional import of lzma in numpy numpy/numpy#18278 . Generally, since loading shutil will optionally load lzma (including in dependencies) it's hard do verify that it's never imported.

I think the current version does solve the initial issue of an unnecessary warning.

@jreback jreback added this to the 1.4 milestone Nov 28, 2021
@jreback jreback merged commit 36df78e into pandas-dev:master Nov 28, 2021
@jreback
Copy link
Contributor

jreback commented Nov 28, 2021

thanks @rth very nice!

@rth rth deleted the lzma-optional branch November 29, 2021 06:48
@rth rth mentioned this pull request May 1, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies Required and optional dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid import warning when lzma is missing
4 participants