Skip to content

Commit afc53f0

Browse files
committed
Library scaffolding and build infrastructure for libpandas native core
experiments to evaluate replacing Series and DataFrame internals and custom dtypes with a consistent set of wrapper types, array, and table data structures. Incorporates several bits of BSD / MIT / Apache-licensed code and various copyright notices have been added to LICENSES.
1 parent 7180826 commit afc53f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+32772
-318
lines changed

.travis.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
sudo: required
2+
dist: trusty
3+
addons:
4+
apt:
5+
sources:
6+
- ubuntu-toolchain-r-test
7+
- kalakris-cmake
8+
packages:
9+
- gcc-4.9
10+
- g++-4.9
11+
- cmake
12+
- valgrind
113

214
language: python
315

@@ -141,6 +153,7 @@ before_install:
141153
- echo "before_install"
142154
- echo $VIRTUAL_ENV
143155
- export PATH="$HOME/miniconda/bin:$PATH"
156+
- export APT_ARGS="-y"
144157
- sudo apt-get install ccache
145158
- df -h
146159
- date
@@ -159,8 +172,8 @@ install:
159172
- ci/submit_ccache.sh
160173

161174
before_script:
162-
- mysql -e 'create database pandas_nosetest;'
163-
- psql -c 'create database pandas_nosetest;' -U postgres
175+
- # mysql -e 'create database pandas_nosetest;'
176+
- # psql -c 'create database pandas_nosetest;' -U postgres
164177

165178
script:
166179
- echo "script"

CMakeLists.txt

+52-55
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# This file is a part of pandas. See LICENSE for details about reuse and
2+
# copyright holders
3+
#
14
# Assembled from BSD/MIT/Apache-licensed code from a variety of copyright
25
# holders, including at least
36
#
@@ -6,21 +9,24 @@
69
# Copyright (C) 2012-15 Continuum Analytics, Inc.
710

811
cmake_minimum_required(VERSION 2.7)
12+
project(pandas)
913

1014
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules")
1115
include(CMakeParseArguments)
1216

1317
set(BUILD_SUPPORT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build-support)
18+
set(THIRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
1419

1520
# Allow "make install" to not depend on all targets.
1621
#
1722
# Must be declared in the top-level CMakeLists.txt.
1823
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
1924

20-
# For thirdparty libs: glog, googletest, gflags
21-
include(toolchain)
25+
# For thirdparty libs: googletest
26+
# include(toolchain)
2227

23-
project(pandas)
28+
set(CMAKE_MACOSX_RPATH 1)
29+
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.9)
2430

2531
############################################################
2632
# Compiler flags
@@ -110,22 +116,9 @@ if ("${COMPILER_FAMILY}" STREQUAL "clang")
110116
# http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
111117
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
112118

113-
# Only hardcode -fcolor-diagnostics if stderr is opened on a terminal. Otherwise
114-
# the color codes show up as noisy artifacts.
115-
#
116-
# This test is imperfect because 'cmake' and 'make' can be run independently
117-
# (with different terminal options), and we're testing during the former.
118-
execute_process(COMMAND test -t 2 RESULT_VARIABLE PANDAS_IS_TTY)
119-
if ((${PANDAS_IS_TTY} EQUAL 0) AND (NOT ("$ENV{TERM}" STREQUAL "dumb")))
120-
message("Running in a controlling terminal")
121-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
122-
else()
123-
message("Running without a controlling terminal or in a dumb terminal")
124-
endif()
119+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-unused-function -Wno-error")
125120

126-
# Use libstdc++ and not libc++. The latter lacks support for tr1 in OSX
127-
# and since 10.9 is now the default.
128-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
121+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
129122
endif()
130123

131124
# Sanity check linking option.
@@ -482,46 +475,21 @@ function(ADD_THIRDPARTY_LIB LIB_NAME)
482475
endif()
483476
endfunction()
484477

485-
find_package(GLog REQUIRED)
486-
ADD_THIRDPARTY_LIB(glog
487-
STATIC_LIB "${GLOG_STATIC_LIB}"
488-
SHARED_LIB "${GLOG_SHARED_LIB}")
489-
list(APPEND PANDAS_BASE_LIBS glog)
490-
491-
## GFlags
492-
find_package(GFlags REQUIRED)
493-
ADD_THIRDPARTY_LIB(gflags
494-
STATIC_LIB "${GFLAGS_STATIC_LIB}"
495-
SHARED_LIB "${GFLAGS_SHARED_LIB}")
496-
list(APPEND PANDAS_BASE_LIBS gflags)
497-
498-
## GMock
499-
find_package(GMock REQUIRED)
500-
ADD_THIRDPARTY_LIB(gmock
501-
STATIC_LIB ${GMOCK_STATIC_LIBRARY})
502-
503478
## Python and libraries
504479
find_package(PythonInterp REQUIRED)
505480
find_package(PythonLibsNew REQUIRED)
506481
find_package(NumPy REQUIRED)
507482
include(UseCython)
508483

484+
message(STATUS "Found Python dynamic library: ${PYTHON_LIBRARIES}")
485+
509486
include_directories(SYSTEM
510-
${GLOG_INCLUDE_DIR}
511-
${GMOCK_INCLUDE_DIR}
512-
${GTEST_INCLUDE_DIR}
513-
${GFLAGS_INCLUDE_DIR}
514487
${NUMPY_INCLUDE_DIRS}
515488
${PYTHON_INCLUDE_DIRS}
516489
pandas/
490+
thirdparty/
517491
src)
518492

519-
############################################################
520-
# Linker setup
521-
############################################################
522-
set(PANDAS_MIN_TEST_LIBS pandas_test_main pandas_test_util ${PANDAS_BASE_LIBS})
523-
set(PANDAS_TEST_LINK_LIBS ${PANDAS_MIN_TEST_LIBS})
524-
525493
############################################################
526494
# "make ctags" target
527495
############################################################
@@ -561,38 +529,67 @@ if (UNIX)
561529
`find ${CMAKE_CURRENT_SOURCE_DIR}/src -name \\*.cc -or -name \\*.h`)
562530
endif (UNIX)
563531

532+
#############################################################
533+
# Test linking
534+
535+
set(PANDAS_MIN_TEST_LIBS
536+
pandas_test_main
537+
pandas)
538+
539+
# Unit tests need to link to libpython. NumPy can be linked by importing the
540+
# numpy module
541+
if(NOT APPLE)
542+
ADD_THIRDPARTY_LIB(python
543+
SHARED_LIB "${PYTHON_LIBRARIES}")
544+
list(APPEND PANDAS_MIN_TEST_LIBS python)
545+
endif()
546+
547+
set(PANDAS_TEST_LINK_LIBS ${PANDAS_MIN_TEST_LIBS})
548+
564549
############################################################
565550
# Subdirectories
566551
############################################################
567552

568553
add_subdirectory(src/pandas)
569554
add_subdirectory(src/pandas/util)
570555

571-
# Python and NumPy shared libraries must be manually imported / linked
572-
set(LINK_LIBS
556+
set(PANDAS_SRCS
557+
src/pandas/array.cc
558+
src/pandas/dispatch.cc
559+
src/pandas/init.cc
560+
src/pandas/numpy_interop.cc
561+
src/pandas/pytypes.cc
562+
563+
src/pandas/types/boolean.cc
564+
src/pandas/types/category.cc
565+
src/pandas/types/integer.cc
566+
src/pandas/types/floating.cc
573567
)
574568

575569
add_library(pandas SHARED
576570
${PANDAS_SRCS})
577-
target_link_libraries(pandas ${LINK_LIBS})
571+
target_link_libraries(pandas
572+
pandas_util)
578573
set_target_properties(pandas PROPERTIES LINKER_LANGUAGE CXX)
579574

580-
# install(TARGETS pandas
581-
# LIBRARY DESTINATION lib)
575+
if(APPLE)
576+
set_target_properties(pandas PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
577+
endif()
582578

583579
############################################################
584580
# Setup and build Cython modules
585581
############################################################
586582

587583
foreach(pyx_api_file
588-
pandas/native.pyx)
584+
pandas/native.pyx
585+
pandas/internals/config.pyx)
589586
set_source_files_properties(${pyx_api_file} PROPERTIES CYTHON_API 1)
590587
endforeach(pyx_api_file)
591588

592589
set(USE_RELATIVE_RPATH ON)
593590
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
594591

595-
foreach(module native)
592+
foreach(module native internals.config)
596593
string(REPLACE "." ";" directories ${module})
597594
list(GET directories -1 module_name)
598595
list(REMOVE_AT directories -1)
@@ -623,12 +620,12 @@ foreach(module native)
623620
math(EXPR i "${i} - 1" )
624621
endwhile(${i} GREATER 0)
625622

626-
# for inplace development for now
623+
# for inplace development for now
627624
set(module_install_rpath "${CMAKE_SOURCE_DIR}/pandas/")
628625

629626
set_target_properties(${module_name} PROPERTIES
630627
INSTALL_RPATH ${module_install_rpath})
631628
target_link_libraries(${module_name} pandas)
632629
endforeach(module)
633630

634-
add_dependencies(pandas native_pyx)
631+
# add_dependencies(pandas native_pyx)

LICENSES/APACHE

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This project includes a number of sections of code adapted from the following
2+
Apache projects:
3+
4+
- Apache Kudu (incubating)
5+
- Apache Impala (incubating)

LICENSES/DYND_LICENSE

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
The BSD 2-Clause License
2+
3+
Copyright (C) 2011-12, Dynamic NDArray Developers
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are
8+
met:
9+
10+
* Redistributions of source code must retain the above copyright
11+
notice, this list of conditions and the following disclaimer.
12+
13+
* Redistributions in binary form must reproduce the above
14+
copyright notice, this list of conditions and the following
15+
disclaimer in the documentation and/or other materials provided
16+
with the distribution.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
30+
Dynamic NDArray Developers list:
31+
32+
* Mark Wiebe
33+
* Continuum Analytics

ci/script.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if [ "$BUILD_TEST" ]; then
1616
echo "We are not running nosetests as this is simply a build test."
1717
else
1818
echo nosetests --exe -A "$NOSE_ARGS" pandas --doctest-tests --with-xunit --xunit-file=/tmp/nosetests.xml
19-
nosetests --exe -A "$NOSE_ARGS" pandas --doctest-tests --with-xunit --xunit-file=/tmp/nosetests.xml
19+
nosetests --exe -A "$NOSE_ARGS" pandas/internals --doctest-tests --with-xunit --xunit-file=/tmp/nosetests.xml
2020
fi
2121

2222
RET="$?"

cmake_modules/FindGFlags.cmake

-57
This file was deleted.

cmake_modules/FindGLog.cmake

-52
This file was deleted.

0 commit comments

Comments
 (0)