Skip to content

explicitly set 'include' to numpy_incls #18112

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 11 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/_libs/reshape.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ np.import_array()

from numpy cimport (ndarray,
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
uint32_t, uint64_t, float16_t, float32_t, float64_t)
uint32_t, uint64_t, float32_t, float64_t)

cdef double NaN = <double> np.NaN
cdef double nan = NaN
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/sparse.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from numpy cimport (ndarray, uint8_t, int64_t, int32_t, int16_t, int8_t,
float64_t, float32_t, float16_t)
float64_t, float32_t)
cimport numpy as np

cimport cython
Expand Down
33 changes: 21 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,13 @@ def pxd(name):
return os.path.abspath(pjoin('pandas', name + '.pxd'))


if _have_setuptools:
Copy link
Contributor

Choose a reason for hiding this comment

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

this whole setuptools optional biz is a mess. we should just require it (and we do in our recipes, so this is all old code). note nothing to do with this PR.

# Note: this is a list, whereas `numpy_incl` in build_ext.build_extensions
# is a string
numpy_incls = [pkg_resources.resource_filename('numpy', 'core/include')]
else:
numpy_incls = []

# args to ignore warnings
if is_platform_windows():
extra_compile_args = []
Expand Down Expand Up @@ -499,10 +506,10 @@ def pxd(name):
'_libs.index': {
'pyxfile': '_libs/index',
'pxdfiles': ['_libs/src/util', '_libs/hashtable'],
'depends': _pxi_dep['index'],
'sources': np_datetime_sources},
'depends': _pxi_dep['index']},
'_libs.indexing': {
'pyxfile': '_libs/indexing'},
'pyxfile': '_libs/indexing',
'include': []},
'_libs.interval': {
'pyxfile': '_libs/interval',
'pxdfiles': ['_libs/hashtable'],
Expand Down Expand Up @@ -535,10 +542,12 @@ def pxd(name):
'include': []},
'_libs.reshape': {
'pyxfile': '_libs/reshape',
'depends': _pxi_dep['reshape']},
'depends': _pxi_dep['reshape'],
'include': numpy_incls},
'_libs.sparse': {
'pyxfile': '_libs/sparse',
'depends': _pxi_dep['sparse']},
'depends': _pxi_dep['sparse'],
'include': numpy_incls},
'_libs.tslib': {
'pyxfile': '_libs/tslib',
'pxdfiles': ['_libs/src/util',
Expand Down Expand Up @@ -578,14 +587,12 @@ def pxd(name):
'_libs/tslibs/frequencies']},
'_libs.tslibs.parsing': {
'pyxfile': '_libs/tslibs/parsing',
'pxdfiles': ['_libs/src/util',
Copy link
Contributor

Choose a reason for hiding this comment

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

pls don’t change this; if u look in the source these depend on these

Copy link
Member Author

Choose a reason for hiding this comment

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

Are we looking at different source files? tslibs.parsing doesn't cimport from util or khash.

Copy link
Contributor

Choose a reason for hiding this comment

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

you are right here

Copy link
Contributor

Choose a reason for hiding this comment

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

side note, should parsing depend on nattype? (then for example nat strings are in 1 place).

Copy link
Member Author

Choose a reason for hiding this comment

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

Well nat_strings is defined but not c-defined in nattype, so we could import it into parsing without needing to specify the dependency.

I'd be fine with that, or with having it defined one extra place. parsing has no intra-pandas dependencies at the moment (neither import nor cimport) which makes it really low-stress.

'_libs/src/khash']},
'include': numpy_incls},
'_libs.tslibs.strptime': {
'pyxfile': '_libs/tslibs/strptime',
'pxdfiles': ['_libs/src/util',
'_libs/tslibs/nattype'],
'depends': tseries_depends,
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link
Member Author

Choose a reason for hiding this comment

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

same

Copy link
Contributor

Choose a reason for hiding this comment

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

tseries_depends already incldes np_datetime, so no need to add this explicty.

Copy link
Contributor

Choose a reason for hiding this comment

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

i think this one needs to change back

Copy link
Member Author

Choose a reason for hiding this comment

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

From the diff it isn't clear which file you're referring to. Best guess is tslibs.strptime?

Copy link
Contributor

Choose a reason for hiding this comment

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

for tslibs.strptime, still needs to have tseries_depends, np? (e.g. np_datetime is there)

'sources': np_datetime_sources},
'_libs/tslibs/nattype',
'_libs/tslibs/np_datetime']},
'_libs.tslibs.timedeltas': {
'pyxfile': '_libs/tslibs/timedeltas',
'pxdfiles': ['_libs/src/util',
Expand All @@ -596,14 +603,16 @@ def pxd(name):
'pyxfile': '_libs/tslibs/timezones',
'pxdfiles': ['_libs/src/util']},
'_libs.testing': {
'pyxfile': '_libs/testing'},
'pyxfile': '_libs/testing',
'include': []},
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the difference betwee not passing include and an empty list? (from a compilation perspective)?

Copy link
Member

Choose a reason for hiding this comment

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

I think this can be removed IINM.

Copy link
Member Author

Choose a reason for hiding this comment

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

Without the 'include' key, it gets set to a default of common_include. This has two unwanted side effects. First: the search path for numpy now includes src/numpy.pxd which we should move away from. Second: making it explicit avoids a problem a year from now when we see that common_include is added to _libs.testing but no one remembers that it isn't actually needed.

'_libs.window': {
'pyxfile': '_libs/window',
'pxdfiles': ['_libs/src/skiplist', '_libs/src/util'],
'depends': ['pandas/_libs/src/skiplist.pyx',
'pandas/_libs/src/skiplist.h']},
'io.sas._sas': {
'pyxfile': 'io/sas/sas'}}
'pyxfile': 'io/sas/sas',
'include': numpy_incls}}

extensions = []

Expand Down