-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: Consistent optional dependency handling #26802
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
Conversation
@@ -275,12 +272,7 @@ def _interpolate_scipy_wrapper(x, y, new_x, method, fill_value=None, | |||
raise ImportError("Your version of Scipy does not support " | |||
"PCHIP interpolation.") | |||
elif method == 'akima': | |||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Akima1DInterpolater was added in SciPy 0.14, and we now require 0.19, so this additional check isn't needed anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally lgtm.
doc/source/install.rst
Outdated
Dependency Minimum Version Notes | ||
========================= ================== ============================================================= | ||
matplotlib 2.2.2 Visualization | ||
xarray 0.8.2 pandas-like API for N-dimensional data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these meant to be in some ordering?
I would maybe put them in sections: io, numeric, other i think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah ok maybe alphabetize then?
This is a great idea! Just to be clear did you purposely only select a subset of optional dependencies to update? I opened #26782 which could either be included here or done as a follow up |
pandas/compat/_optional.py
Outdated
|
||
|
||
def import_optional_dependency( | ||
name, extra="", raise_on_missing=True, on_version="raise" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add annotations here? Should be straightforward I think
I grepped for I seem to have just missed the xlrd one. Do you want me to handle it here? |
Looks like I missed bottleneck too, sorry. |
Up to you |
Codecov Report
@@ Coverage Diff @@
## master #26802 +/- ##
==========================================
+ Coverage 91.76% 91.85% +0.08%
==========================================
Files 178 179 +1
Lines 50751 50707 -44
==========================================
+ Hits 46574 46579 +5
+ Misses 4177 4128 -49
Continue to review full report at Codecov.
|
small comment, otherwise lgtm. |
Great change @TomAugspurger ! |
# xlrd uses a capitalized attribute name | ||
version = module.__VERSION__ | ||
version = getattr(module, '__VERSION__', None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we not encode the 'version' (or 'VERSION') with the list of deps directly? (or have a way to override); in fact we already do this in pandas/util/_print_versions. so actually I would update that to use this list of deps (and also to add the version accessor)
actually @TomAugspurger see my comments. This duplicates a ton of code in _print_versions. Can you (or others) do a followup (or create an issue) about de-duplicating. |
see #26814 |
FYI @pandas-dev/pandas-core you may want to glance through http://pandas-docs.github.io/pandas-docs-travis/development/contributing.html#optional-dependencies, when we get PRs adding a new optional dependency. |
Nice! |
Standardizes how we do our optional dependency checking.
import_optional_dependency
helper that handles optional importing, raising with a nice message, and warning / raising if the version is not correct.try / except ImportError
to useimport_optional_dependency