From 16b91086b34ad9081a8bd629502690e618866e29 Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Fri, 24 Nov 2017 13:02:26 -0800 Subject: [PATCH 1/2] make khash its own extension --- pandas/_libs/{src => }/khash.pxd | 2 ++ pandas/_libs/khash.pyx | 5 +++++ pandas/_libs/tslibs/resolution.pyx | 2 +- setup.py | 10 ++++++---- 4 files changed, 14 insertions(+), 5 deletions(-) rename pandas/_libs/{src => }/khash.pxd (98%) create mode 100644 pandas/_libs/khash.pyx diff --git a/pandas/_libs/src/khash.pxd b/pandas/_libs/khash.pxd similarity index 98% rename from pandas/_libs/src/khash.pxd rename to pandas/_libs/khash.pxd index ba9a3c70097b2..b1d965c3618cd 100644 --- a/pandas/_libs/src/khash.pxd +++ b/pandas/_libs/khash.pxd @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- +# cython: profile=False from cpython cimport PyObject from numpy cimport int64_t, uint64_t, int32_t, uint32_t, float64_t diff --git a/pandas/_libs/khash.pyx b/pandas/_libs/khash.pyx new file mode 100644 index 0000000000000..65f3f8e52cefa --- /dev/null +++ b/pandas/_libs/khash.pyx @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# cython: profile=False +""" +Dummy file supporting; see khash.pxd +""" diff --git a/pandas/_libs/tslibs/resolution.pyx b/pandas/_libs/tslibs/resolution.pyx index 388075903a8ba..bafd6ff3d40bc 100644 --- a/pandas/_libs/tslibs/resolution.pyx +++ b/pandas/_libs/tslibs/resolution.pyx @@ -10,7 +10,7 @@ np.import_array() from util cimport is_string_object, get_nat -from khash cimport ( +from pandas._libs.khash cimport ( khiter_t, kh_destroy_int64, kh_put_int64, kh_init_int64, kh_int64_t, diff --git a/setup.py b/setup.py index 7e56298d1b20b..559112449c1b8 100755 --- a/setup.py +++ b/setup.py @@ -335,6 +335,7 @@ class CheckSDist(sdist_class): 'pandas/_libs/index.pyx', 'pandas/_libs/algos.pyx', 'pandas/_libs/join.pyx', + 'pandas/_libs/khash.pyx', 'pandas/_libs/indexing.pyx', 'pandas/_libs/interval.pyx', 'pandas/_libs/hashing.pyx', @@ -514,6 +515,9 @@ def pxd(name): 'pyxfile': '_libs/join', 'pxdfiles': ['_libs/src/util', '_libs/hashtable'], 'depends': _pxi_dep['join']}, + '_libs.khash': { + 'pyxfile': '_libs/khash', + 'depends': ['pandas/_libs/src/klib/khash_python.h']}, '_libs.lib': { 'pyxfile': '_libs/lib', 'pxdfiles': ['_libs/src/util', '_libs/missing'], @@ -550,7 +554,6 @@ def pxd(name): '_libs.tslib': { 'pyxfile': '_libs/tslib', 'pxdfiles': ['_libs/src/util', - '_libs/src/khash', '_libs/tslibs/conversion', '_libs/tslibs/timedeltas', '_libs/tslibs/timestamps', @@ -591,12 +594,11 @@ def pxd(name): 'sources': np_datetime_sources}, '_libs.tslibs.parsing': { 'pyxfile': '_libs/tslibs/parsing', - 'pxdfiles': ['_libs/src/util', - '_libs/src/khash']}, + 'pxdfiles': ['_libs/src/util']}, '_libs.tslibs.resolution': { 'pyxfile': '_libs/tslibs/resolution', 'pxdfiles': ['_libs/src/util', - '_libs/src/khash', + '_libs/khash', '_libs/tslibs/frequencies', '_libs/tslibs/timezones'], 'depends': tseries_depends, From b5849856e7cd6d1b3b0b7a282462ea6b1adcc38b Mon Sep 17 00:00:00 2001 From: Brock Mendel Date: Mon, 27 Nov 2017 13:27:57 -0800 Subject: [PATCH 2/2] remove stub khash.pyx --- pandas/_libs/khash.pyx | 5 ----- setup.py | 6 +----- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 pandas/_libs/khash.pyx diff --git a/pandas/_libs/khash.pyx b/pandas/_libs/khash.pyx deleted file mode 100644 index 65f3f8e52cefa..0000000000000 --- a/pandas/_libs/khash.pyx +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# cython: profile=False -""" -Dummy file supporting; see khash.pxd -""" diff --git a/setup.py b/setup.py index 559112449c1b8..7faf33b607a09 100755 --- a/setup.py +++ b/setup.py @@ -335,7 +335,6 @@ class CheckSDist(sdist_class): 'pandas/_libs/index.pyx', 'pandas/_libs/algos.pyx', 'pandas/_libs/join.pyx', - 'pandas/_libs/khash.pyx', 'pandas/_libs/indexing.pyx', 'pandas/_libs/interval.pyx', 'pandas/_libs/hashing.pyx', @@ -497,7 +496,7 @@ def pxd(name): 'pyxfile': '_libs/hashing'}, '_libs.hashtable': { 'pyxfile': '_libs/hashtable', - 'pxdfiles': ['_libs/hashtable', '_libs/missing'], + 'pxdfiles': ['_libs/hashtable', '_libs/missing', '_libs/khash'], 'depends': (['pandas/_libs/src/klib/khash_python.h'] + _pxi_dep['hashtable'])}, '_libs.index': { @@ -515,9 +514,6 @@ def pxd(name): 'pyxfile': '_libs/join', 'pxdfiles': ['_libs/src/util', '_libs/hashtable'], 'depends': _pxi_dep['join']}, - '_libs.khash': { - 'pyxfile': '_libs/khash', - 'depends': ['pandas/_libs/src/klib/khash_python.h']}, '_libs.lib': { 'pyxfile': '_libs/lib', 'pxdfiles': ['_libs/src/util', '_libs/missing'],