-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
separate _libs/src/reduce.pyx to _libs.reduction #19306
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
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.
this is fine, I guess we can't use reduce as a name?
@@ -1,9 +1,24 @@ | |||
# -*- coding: utf-8 -*- |
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.
you don't like reduce?
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.
I try to avoid overlap with built-in names.
needs a rebase |
Codecov Report
@@ Coverage Diff @@
## master #19306 +/- ##
==========================================
- Coverage 91.53% 91.5% -0.03%
==========================================
Files 150 150
Lines 48738 48738
==========================================
- Hits 44611 44599 -12
- Misses 4127 4139 +12
Continue to review full report at Codecov.
|
np.import_array() | ||
|
||
cimport util | ||
from lib import maybe_convert_objects |
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.
remove this, and instead where .reduce()
is called you can do this on the python side.
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.
We'd also need to do that everywhere SeriesGrouper.get_result or SeriesBinGrouper.get_result is called. What's the upside that makes the duplicated code worthwhile?
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.
this completely removes this module from the import time dependency chain.
you could do this in the top-level function reduce()
I suppose (inside the function)
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.
or could expose maybe_convert_objects
in a pxd and then call it directly in cython (but that actually puts this back in the dep chain).
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.
you could do this in the top-level function reduce() I suppose (inside the function)
That would be better than trying to do it after every place in the code-base where the function is called. But note that reduce
is not the only part of this module that is used externally, so we'd need to do this run-time import in three places in this module.
Since the dependency is one-way and not a c-dep, I don't see a huge downside to the import-time import of maybe_convert_objects.
ok, this at least de-couples some lib.pyx, which is good. |
git diff upstream/master -u -- "*.py" | flake8 --diff