Rename package to pyarrow

This commit is contained in:
Wes McKinney committed 2016-03-09 08:55:30 -08:00
1 parent e3d0cafb8a
commit 60088d05b2
28 files changed
+167 -147

No files matched your search

+15 -6
View File
@@ -45,6 +45,13 @@ if ("$ENV{CMAKE_EXPORT_COMPILE_COMMANDS}" STREQUAL "1")
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
endif()
# Top level cmake dir
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
option(PYARROW_BUILD_TESTS
"Build the PyArrow C++ googletest unit tests"
OFF)
endif()
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
@@ -322,10 +329,12 @@ function(ADD_THIRDPARTY_LIB LIB_NAME)
endfunction()
## GMock
find_package(GTest REQUIRED)
include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
ADD_THIRDPARTY_LIB(gtest
STATIC_LIB ${GTEST_STATIC_LIB})
if (PYARROW_BUILD_TESTS)
find_package(GTest REQUIRED)
include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
ADD_THIRDPARTY_LIB(gtest
STATIC_LIB ${GTEST_STATIC_LIB})
endif()
## Arrow
find_package(Arrow REQUIRED)
@@ -437,7 +446,7 @@ foreach(module ${CYTHON_EXTENSIONS})
list(REMOVE_AT directories -1)
string(REPLACE "." "/" module_root "${module}")
set(module_SRC arrow/${module_root}.pyx)
set(module_SRC pyarrow/${module_root}.pyx)
set_source_files_properties(${module_SRC} PROPERTIES CYTHON_IS_CXX 1)
cython_add_module(${module_name}
@@ -463,7 +472,7 @@ foreach(module ${CYTHON_EXTENSIONS})
endwhile(${i} GREATER 0)
# for inplace development for now
set(module_install_rpath "${CMAKE_SOURCE_DIR}/arrow/")
set(module_install_rpath "${CMAKE_SOURCE_DIR}/pyarrow/")
set_target_properties(${module_name} PROPERTIES
INSTALL_RPATH ${module_install_rpath})
-38
View File
@@ -1,38 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# flake8: noqa
from arrow.array import (Array, from_pylist, total_allocated_bytes,
BooleanArray, NumericArray,
Int8Array, UInt8Array,
ListArray, StringArray)
from arrow.error import ArrowException
from arrow.scalar import (ArrayValue, Scalar, NA, NAType,
BooleanValue,
Int8Value, Int16Value, Int32Value, Int64Value,
UInt8Value, UInt16Value, UInt32Value, UInt64Value,
FloatValue, DoubleValue, ListValue, StringValue)
from arrow.schema import (null, bool_,
int8, int16, int32, int64,
uint8, uint16, uint32, uint64,
float_, double, string,
list_, struct, field,
DataType, Field, Schema)
+13 -5
View File
@@ -1,6 +1,6 @@
## Installing Apache Arrow for Python from source
## Installing pyarrow (Apache Arrow Python library)
First, clone the git repository:
First, clone the master git repository:
```bash
git clone https://github.com/apache/arrow.git arrow
@@ -8,13 +8,15 @@ git clone https://github.com/apache/arrow.git arrow
#### System requirements
Building Python's Arrow library requires:
Building pyarrow requires:
* A C++11 compiler
* Linux: gcc >= 4.8 or clang >= 3.5
* OS X: XCode 6 or higher
* [cmake][1]
#### Python requirements
You will need Python (CPython) 2.7, 3.4, or 3.5 installed. Earlier releases and
@@ -57,8 +59,14 @@ make
make install
```
#### Mac OS X-specific instructions
#### Build and install `pyarrow` library
```bash
cd arrow/python
python setup.py install
```
#### Linux-specific instructions
#### Mac OS X-specific stuff
[1]: https://cmake.org/
+38
View File
@@ -0,0 +1,38 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# flake8: noqa
from pyarrow.array import (Array, from_pylist, total_allocated_bytes,
BooleanArray, NumericArray,
Int8Array, UInt8Array,
ListArray, StringArray)
from pyarrow.error import ArrowException
from pyarrow.scalar import (ArrayValue, Scalar, NA, NAType,
BooleanValue,
Int8Value, Int16Value, Int32Value, Int64Value,
UInt8Value, UInt16Value, UInt32Value, UInt64Value,
FloatValue, DoubleValue, ListValue, StringValue)
from pyarrow.schema import (null, bool_,
int8, int16, int32, int64,
uint8, uint16, uint32, uint64,
float_, double, string,
list_, struct, field,
DataType, Field, Schema)
@@ -15,12 +15,12 @@
# specific language governing permissions and limitations
# under the License.
from arrow.includes.common cimport shared_ptr
from arrow.includes.arrow cimport CArray, LogicalType
from pyarrow.includes.common cimport shared_ptr
from pyarrow.includes.libarrow cimport CArray, LogicalType
from arrow.scalar import NA
from pyarrow.scalar import NA
from arrow.schema cimport DataType
from pyarrow.schema cimport DataType
cdef extern from "Python.h":
int PySlice_Check(object)
@@ -19,14 +19,14 @@
# distutils: language = c++
# cython: embedsignature = True
from arrow.includes.arrow cimport *
cimport arrow.includes.pyarrow as pyarrow
from pyarrow.includes.libarrow cimport *
cimport pyarrow.includes.pyarrow as pyarrow
from arrow.compat import frombytes, tobytes
from arrow.error cimport check_status
from pyarrow.compat import frombytes, tobytes
from pyarrow.error cimport check_status
cimport arrow.scalar as scalar
from arrow.scalar import NA
cimport pyarrow.scalar as scalar
from pyarrow.scalar import NA
def total_allocated_bytes():
cdef MemoryPool* pool = pyarrow.GetMemoryPool()
@@ -52,7 +52,7 @@ cdef class Array:
raise StopIteration
def __repr__(self):
from arrow.formatting import array_format
from pyarrow.formatting import array_format
type_format = object.__repr__(self)
values = array_format(self, window=10)
return '{0}\n{1}'.format(type_format, values)
File renamed without changes.
File renamed without changes.
@@ -15,6 +15,6 @@
# specific language governing permissions and limitations
# under the License.
from arrow.includes.pyarrow cimport *
from pyarrow.includes.pyarrow cimport *
cdef check_status(const Status& status)
@@ -15,9 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from arrow.includes.common cimport c_string
from arrow.compat import frombytes
from pyarrow.includes.common cimport c_string
from pyarrow.compat import frombytes
class ArrowException(Exception):
pass
@@ -17,7 +17,7 @@
# Pretty-printing and other formatting utilities for Arrow data structures
import arrow.scalar as scalar
import pyarrow.scalar as scalar
def array_format(arr, window=None):
File renamed without changes.
File renamed without changes.
@@ -17,7 +17,7 @@
# distutils: language = c++
from arrow.includes.common cimport *
from pyarrow.includes.common cimport *
cdef extern from "arrow/api.h" namespace "arrow" nogil:
@@ -17,7 +17,7 @@
# distutils: language = c++
from arrow.includes.common cimport *
from pyarrow.includes.common cimport *
cdef extern from "parquet/api/reader.h" namespace "parquet_cpp" nogil:
cdef cppclass ColumnReader:
@@ -17,9 +17,9 @@
# distutils: language = c++
from arrow.includes.common cimport *
from arrow.includes.arrow cimport (CArray, CDataType, LogicalType,
MemoryPool)
from pyarrow.includes.common cimport *
from pyarrow.includes.libarrow cimport (CArray, CDataType, LogicalType,
MemoryPool)
cdef extern from "pyarrow/api.h" namespace "pyarrow" nogil:
# We can later add more of the common status factory methods as needed
@@ -19,5 +19,5 @@
# distutils: language = c++
# cython: embedsignature = True
from arrow.compat import frombytes, tobytes
from arrow.includes.parquet cimport *
from pyarrow.compat import frombytes, tobytes
from pyarrow.includes.parquet cimport *
@@ -15,10 +15,10 @@
# specific language governing permissions and limitations
# under the License.
from arrow.includes.common cimport *
from arrow.includes.arrow cimport *
from pyarrow.includes.common cimport *
from pyarrow.includes.libarrow cimport *
from arrow.schema cimport DataType
from pyarrow.schema cimport DataType
cdef class Scalar:
cdef readonly:
@@ -15,10 +15,10 @@
# specific language governing permissions and limitations
# under the License.
from arrow.schema cimport DataType, box_data_type
from pyarrow.schema cimport DataType, box_data_type
from arrow.compat import frombytes
import arrow.schema as schema
from pyarrow.compat import frombytes
import pyarrow.schema as schema
NA = None
@@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from arrow.includes.common cimport shared_ptr
from arrow.includes.arrow cimport CDataType, CField, CSchema
from pyarrow.includes.common cimport shared_ptr
from pyarrow.includes.libarrow cimport CDataType, CField, CSchema
cdef class DataType:
cdef:
@@ -22,9 +22,9 @@
# distutils: language = c++
# cython: embedsignature = True
from arrow.compat import frombytes, tobytes
from arrow.includes.arrow cimport *
cimport arrow.includes.pyarrow as pyarrow
from pyarrow.compat import frombytes, tobytes
from pyarrow.includes.libarrow cimport *
cimport pyarrow.includes.pyarrow as pyarrow
cimport cpython
File renamed without changes.
@@ -15,19 +15,19 @@
# specific language governing permissions and limitations
# under the License.
from arrow.compat import unittest
import arrow
import arrow.formatting as fmt
from pyarrow.compat import unittest
import pyarrow
import pyarrow.formatting as fmt
class TestArrayAPI(unittest.TestCase):
def test_getitem_NA(self):
arr = arrow.from_pylist([1, None, 2])
assert arr[1] is arrow.NA
arr = pyarrow.from_pylist([1, None, 2])
assert arr[1] is pyarrow.NA
def test_list_format(self):
arr = arrow.from_pylist([[1], None, [2, 3]])
arr = pyarrow.from_pylist([[1], None, [2, 3]])
result = fmt.array_format(arr)
expected = """\
[
@@ -39,7 +39,7 @@ class TestArrayAPI(unittest.TestCase):
assert result == expected
def test_string_format(self):
arr = arrow.from_pylist(['foo', None, 'bar'])
arr = pyarrow.from_pylist(['foo', None, 'bar'])
result = fmt.array_format(arr)
expected = """\
[
@@ -50,7 +50,7 @@ class TestArrayAPI(unittest.TestCase):
assert result == expected
def test_long_array_format(self):
arr = arrow.from_pylist(range(100))
arr = pyarrow.from_pylist(range(100))
result = fmt.array_format(arr, window=2)
expected = """\
[
@@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from arrow.compat import unittest
import arrow
from pyarrow.compat import unittest
import pyarrow
class TestConvertList(unittest.TestCase):
@@ -25,61 +25,61 @@ class TestConvertList(unittest.TestCase):
pass
def test_empty_list(self):
arr = arrow.from_pylist([])
arr = pyarrow.from_pylist([])
assert len(arr) == 0
assert arr.null_count == 0
assert arr.type == arrow.null()
assert arr.type == pyarrow.null()
def test_all_none(self):
arr = arrow.from_pylist([None, None])
arr = pyarrow.from_pylist([None, None])
assert len(arr) == 2
assert arr.null_count == 2
assert arr.type == arrow.null()
assert arr.type == pyarrow.null()
def test_integer(self):
arr = arrow.from_pylist([1, None, 3, None])
arr = pyarrow.from_pylist([1, None, 3, None])
assert len(arr) == 4
assert arr.null_count == 2
assert arr.type == arrow.int64()
assert arr.type == pyarrow.int64()
def test_garbage_collection(self):
import gc
bytes_before = arrow.total_allocated_bytes()
arrow.from_pylist([1, None, 3, None])
bytes_before = pyarrow.total_allocated_bytes()
pyarrow.from_pylist([1, None, 3, None])
gc.collect()
assert arrow.total_allocated_bytes() == bytes_before
assert pyarrow.total_allocated_bytes() == bytes_before
def test_double(self):
data = [1.5, 1, None, 2.5, None, None]
arr = arrow.from_pylist(data)
arr = pyarrow.from_pylist(data)
assert len(arr) == 6
assert arr.null_count == 3
assert arr.type == arrow.double()
assert arr.type == pyarrow.double()
def test_string(self):
data = ['foo', b'bar', None, 'arrow']
arr = arrow.from_pylist(data)
arr = pyarrow.from_pylist(data)
assert len(arr) == 4
assert arr.null_count == 1
assert arr.type == arrow.string()
assert arr.type == pyarrow.string()
def test_mixed_nesting_levels(self):
arrow.from_pylist([1, 2, None])
arrow.from_pylist([[1], [2], None])
arrow.from_pylist([[1], [2], [None]])
pyarrow.from_pylist([1, 2, None])
pyarrow.from_pylist([[1], [2], None])
pyarrow.from_pylist([[1], [2], [None]])
with self.assertRaises(arrow.ArrowException):
arrow.from_pylist([1, 2, [1]])
with self.assertRaises(pyarrow.ArrowException):
pyarrow.from_pylist([1, 2, [1]])
with self.assertRaises(arrow.ArrowException):
arrow.from_pylist([1, 2, []])
with self.assertRaises(pyarrow.ArrowException):
pyarrow.from_pylist([1, 2, []])
with self.assertRaises(arrow.ArrowException):
arrow.from_pylist([[1], [2], [None, [1]]])
with self.assertRaises(pyarrow.ArrowException):
pyarrow.from_pylist([[1], [2], [None, [1]]])
def test_list_of_int(self):
data = [[1, 2, 3], [], None, [1, 2]]
arr = arrow.from_pylist(data)
arr = pyarrow.from_pylist(data)
assert len(arr) == 4
assert arr.null_count == 1
assert arr.type == arrow.list_(arrow.int64())
assert arr.type == pyarrow.list_(pyarrow.int64())
@@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from arrow.compat import unittest, u
import arrow
from pyarrow.compat import unittest, u
import pyarrow as arrow
class TestScalars(unittest.TestCase):
@@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from arrow.compat import unittest
import arrow
from pyarrow.compat import unittest
import pyarrow as arrow
class TestTypes(unittest.TestCase):
+14 -12
View File
@@ -40,10 +40,12 @@ from distutils import sysconfig
is_64_bit = sys.maxsize > 2**32
# Check if this is a debug build of Python.
if hasattr(sys, 'gettotalrefcount'):
build_type = 'Debug'
else:
build_type = 'Release'
# if hasattr(sys, 'gettotalrefcount'):
# build_type = 'Debug'
# else:
# build_type = 'Release'
build_type = 'Debug'
if Cython.__version__ < '0.19.1':
raise Exception('Please upgrade to Cython 0.19.1 or newer')
@@ -158,13 +160,13 @@ class build_ext(_build_ext):
if sys.platform != 'win32':
name, = glob.glob('libpyarrow.*')
try:
os.makedirs(pjoin(build_lib, 'arrow'))
os.makedirs(pjoin(build_lib, 'pyarrow'))
except OSError:
pass
shutil.move(name, pjoin(build_lib, 'arrow', name))
shutil.move(name, pjoin(build_lib, 'pyarrow', name))
else:
shutil.move(pjoin(build_type, 'pyarrow.dll'),
pjoin(build_lib, 'arrow', 'pyarrow.dll'))
pjoin(build_lib, 'pyarrow', 'pyarrow.dll'))
# Move the built C-extension to the place expected by the Python build
self._found_names = []
@@ -192,7 +194,7 @@ class build_ext(_build_ext):
def _get_cmake_ext_path(self, name):
# Get the package directory from build_py
build_py = self.get_finalized_command('build_py')
package_dir = build_py.get_package_dir('arrow')
package_dir = build_py.get_package_dir('pyarrow')
# This is the name of the arrow C-extension
suffix = sysconfig.get_config_var('EXT_SUFFIX')
if suffix is None:
@@ -229,10 +231,10 @@ DESC = """\
Python library for Apache Arrow"""
setup(
name="arrow",
packages=['arrow', 'arrow.tests'],
name="pyarrow",
packages=['pyarrow', 'pyarrow.tests'],
version=VERSION,
package_data={'arrow': ['*.pxd', '*.pyx']},
package_data={'pyarrow': ['*.pxd', '*.pyx']},
ext_modules=extensions,
cmdclass={
'clean': clean,
@@ -243,5 +245,5 @@ setup(
license='Apache License, Version 2.0',
maintainer="Apache Arrow Developers",
maintainer_email="dev@arrow.apache.org",
test_suite="arrow.tests"
test_suite="pyarrow.tests"
)
+16 -14
View File
@@ -19,19 +19,21 @@
# pyarrow_test_main
#######################################
add_library(pyarrow_test_main
test_main.cc)
if (PYARROW_BUILD_TESTS)
add_library(pyarrow_test_main
test_main.cc)
if (APPLE)
target_link_libraries(pyarrow_test_main
gtest
dl)
set_target_properties(pyarrow_test_main
PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
target_link_libraries(pyarrow_test_main
gtest
pthread
dl
)
if (APPLE)
target_link_libraries(pyarrow_test_main
gtest
dl)
set_target_properties(pyarrow_test_main
PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
else()
target_link_libraries(pyarrow_test_main
gtest
pthread
dl
)
endif()
endif()