Skip to content

Commit 21dbf4a

Browse files
authored
ARROW-17160: [C++] Create a base directory for PyArrow CPP header files (apache#14275)
This PR is a follow-up of apache#13311 where it was decided to change the base directory for PyArrow C++ headers to avoid top level inclusions. See apache#13311 (comment) Authored-by: Alenka Frim <[email protected]> Signed-off-by: Joris Van den Bossche <[email protected]>
1 parent d8f3946 commit 21dbf4a

Some content is hidden

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

61 files changed

+212
-194
lines changed

python/pyarrow/src/CMakeLists.txt

+27-27
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,31 @@ set(Python3_FIND_REGISTRY "LAST")
7373
set(Python3_FIND_FRAMEWORK "LAST")
7474

7575
find_package(Python3Alt 3.7 REQUIRED)
76-
include_directories(SYSTEM ${NUMPY_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${ARROW_INCLUDE_DIR} src)
76+
include_directories(SYSTEM ${NUMPY_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} ${ARROW_INCLUDE_DIR} ${CMAKE_SOURCE_DIR} src)
7777

7878
add_custom_target(arrow_python)
7979

8080
set(ARROW_PYTHON_SRCS
81-
arrow_to_pandas.cc
82-
benchmark.cc
83-
common.cc
84-
datetime.cc
85-
decimal.cc
86-
deserialize.cc
87-
extension_type.cc
88-
gdb.cc
89-
helpers.cc
90-
inference.cc
91-
init.cc
92-
io.cc
93-
ipc.cc
94-
numpy_convert.cc
95-
numpy_to_arrow.cc
96-
python_test.cc
97-
python_to_arrow.cc
98-
pyarrow.cc
99-
serialize.cc
100-
udf.cc)
81+
arrow/python/arrow_to_pandas.cc
82+
arrow/python/benchmark.cc
83+
arrow/python/common.cc
84+
arrow/python/datetime.cc
85+
arrow/python/decimal.cc
86+
arrow/python/deserialize.cc
87+
arrow/python/extension_type.cc
88+
arrow/python/gdb.cc
89+
arrow/python/helpers.cc
90+
arrow/python/inference.cc
91+
arrow/python/init.cc
92+
arrow/python/io.cc
93+
arrow/python/ipc.cc
94+
arrow/python/numpy_convert.cc
95+
arrow/python/numpy_to_arrow.cc
96+
arrow/python/python_test.cc
97+
arrow/python/python_to_arrow.cc
98+
arrow/python/pyarrow.cc
99+
arrow/python/serialize.cc
100+
arrow/python/udf.cc)
101101

102102
set_source_files_properties(init.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON
103103
SKIP_UNITY_BUILD_INCLUSION ON)
@@ -127,7 +127,7 @@ endif()
127127

128128
if(PYARROW_WITH_PARQUET_ENCRYPTION)
129129
if(PARQUET_REQUIRE_ENCRYPTION)
130-
list(APPEND ARROW_PYTHON_SRCS parquet_encryption.cc)
130+
list(APPEND ARROW_PYTHON_SRCS arrow/python/parquet_encryption.cc)
131131
find_package(Parquet REQUIRED)
132132
list(APPEND ARROW_PYTHON_SHARED_LINK_LIBS Parquet::parquet_shared)
133133
list(APPEND ARROW_PYTHON_SHARED_INSTALL_INTERFACE_LIBS Parquet::parquet_shared)
@@ -146,11 +146,11 @@ endif()
146146

147147
# Check for only Arrow C++ options
148148
if(ARROW_CSV)
149-
list(APPEND ARROW_PYTHON_SRCS csv.cc)
149+
list(APPEND ARROW_PYTHON_SRCS arrow/python/csv.cc)
150150
endif()
151151

152152
if(ARROW_FILESYSTEM)
153-
list(APPEND ARROW_PYTHON_SRCS filesystem.cc)
153+
list(APPEND ARROW_PYTHON_SRCS arrow/python/filesystem.cc)
154154
endif()
155155

156156
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
@@ -225,7 +225,7 @@ add_arrow_lib(arrow_python
225225
SOURCES
226226
${ARROW_PYTHON_SRCS}
227227
PRECOMPILED_HEADERS
228-
"$<$<COMPILE_LANGUAGE:CXX>:pch.h>"
228+
"$<$<COMPILE_LANGUAGE:CXX>:arrow/python/pch.h>"
229229
OUTPUTS
230230
ARROW_PYTHON_LIBRARIES
231231
SHARED_LINK_FLAGS
@@ -269,7 +269,7 @@ if(ARROW_FLIGHT AND ARROW_BUILD_SHARED)
269269
PKG_CONFIG_NAME
270270
arrow-python-flight
271271
SOURCES
272-
flight.cc
272+
arrow/python/flight.cc
273273
OUTPUTS
274274
ARROW_PYFLIGHT_LIBRARIES
275275
SHARED_LINK_FLAGS
@@ -309,4 +309,4 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL
309309
PROPERTY COMPILE_FLAGS -Wno-parentheses-equality)
310310
endif()
311311

312-
arrow_install_all_headers("arrow/python")
312+
add_subdirectory(arrow/python)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
arrow_install_all_headers("arrow/python")

python/pyarrow/src/api.h python/pyarrow/src/arrow/python/api.h

+11-11
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
#pragma once
1919

20-
#include "arrow_to_pandas.h"
21-
#include "common.h"
22-
#include "datetime.h"
23-
#include "deserialize.h"
24-
#include "helpers.h"
25-
#include "inference.h"
26-
#include "io.h"
27-
#include "numpy_convert.h"
28-
#include "numpy_to_arrow.h"
29-
#include "python_to_arrow.h"
30-
#include "serialize.h"
20+
#include "arrow/python/arrow_to_pandas.h"
21+
#include "arrow/python/common.h"
22+
#include "arrow/python/datetime.h"
23+
#include "arrow/python/deserialize.h"
24+
#include "arrow/python/helpers.h"
25+
#include "arrow/python/inference.h"
26+
#include "arrow/python/io.h"
27+
#include "arrow/python/numpy_convert.h"
28+
#include "arrow/python/numpy_to_arrow.h"
29+
#include "arrow/python/python_to_arrow.h"
30+
#include "arrow/python/serialize.h"

python/pyarrow/src/arrow_to_pandas.cc python/pyarrow/src/arrow/python/arrow_to_pandas.cc

+12-12
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
// Functions for pandas conversion via NumPy
1919

20-
#include "arrow_to_pandas.h"
21-
#include "numpy_interop.h" // IWYU pragma: expand
20+
#include "arrow/python/arrow_to_pandas.h"
21+
#include "arrow/python/numpy_interop.h" // IWYU pragma: expand
2222

2323
#include <cmath>
2424
#include <cstdint>
@@ -48,16 +48,16 @@
4848

4949
#include "arrow/compute/api.h"
5050

51-
#include "arrow_to_python_internal.h"
52-
#include "common.h"
53-
#include "datetime.h"
54-
#include "decimal.h"
55-
#include "helpers.h"
56-
#include "numpy_convert.h"
57-
#include "numpy_internal.h"
58-
#include "pyarrow.h"
59-
#include "python_to_arrow.h"
60-
#include "type_traits.h"
51+
#include "arrow/python/arrow_to_python_internal.h"
52+
#include "arrow/python/common.h"
53+
#include "arrow/python/datetime.h"
54+
#include "arrow/python/decimal.h"
55+
#include "arrow/python/helpers.h"
56+
#include "arrow/python/numpy_convert.h"
57+
#include "arrow/python/numpy_internal.h"
58+
#include "arrow/python/pyarrow.h"
59+
#include "arrow/python/python_to_arrow.h"
60+
#include "arrow/python/type_traits.h"
6161

6262
namespace arrow {
6363

python/pyarrow/src/arrow_to_pandas.h python/pyarrow/src/arrow/python/arrow_to_pandas.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020

2121
#pragma once
2222

23-
#include "platform.h"
23+
#include "arrow/python/platform.h"
2424

2525
#include <memory>
2626
#include <string>
2727
#include <unordered_set>
2828

2929
#include "arrow/memory_pool.h"
30-
#include "visibility.h"
30+
#include "arrow/python/visibility.h"
3131

3232
namespace arrow {
3333

python/pyarrow/src/arrow_to_python_internal.h python/pyarrow/src/arrow/python/arrow_to_python_internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#pragma once
1919

2020
#include "arrow/array.h"
21-
#include "platform.h"
21+
#include "arrow/python/platform.h"
2222

2323
namespace arrow {
2424
namespace py {

python/pyarrow/src/benchmark.cc python/pyarrow/src/arrow/python/benchmark.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
#include "benchmark.h"
19-
#include "helpers.h"
18+
#include "arrow/python/benchmark.h"
19+
#include "arrow/python/helpers.h"
2020

2121
namespace arrow {
2222
namespace py {

python/pyarrow/src/benchmark.h python/pyarrow/src/arrow/python/benchmark.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
#pragma once
1919

20-
#include "platform.h"
20+
#include "arrow/python/platform.h"
2121

22-
#include "visibility.h"
22+
#include "arrow/python/visibility.h"
2323

2424
namespace arrow {
2525
namespace py {

python/pyarrow/src/common.cc python/pyarrow/src/arrow/python/common.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
#include "common.h"
18+
#include "arrow/python/common.h"
1919

2020
#include <cstdlib>
2121
#include <mutex>
@@ -26,7 +26,7 @@
2626
#include "arrow/util/checked_cast.h"
2727
#include "arrow/util/logging.h"
2828

29-
#include "helpers.h"
29+
#include "arrow/python/helpers.h"
3030

3131
namespace arrow {
3232

python/pyarrow/src/common.h python/pyarrow/src/arrow/python/common.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include "arrow/buffer.h"
2525
#include "arrow/result.h"
2626
#include "arrow/util/macros.h"
27-
#include "pyarrow.h"
28-
#include "visibility.h"
27+
#include "arrow/python/pyarrow.h"
28+
#include "arrow/python/visibility.h"
2929

3030
namespace arrow {
3131

python/pyarrow/src/csv.cc python/pyarrow/src/arrow/python/csv.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include <memory>
2121

22-
#include "common.h"
22+
#include "arrow/python/common.h"
2323

2424
namespace arrow {
2525

python/pyarrow/src/csv.h python/pyarrow/src/arrow/python/csv.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "arrow/csv/options.h"
2626
#include "arrow/util/macros.h"
27-
#include "common.h"
27+
#include "arrow/python/common.h"
2828

2929
namespace arrow {
3030
namespace py {

python/pyarrow/src/datetime.cc python/pyarrow/src/arrow/python/datetime.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
#include "arrow/type.h"
2828
#include "arrow/util/logging.h"
2929
#include "arrow/util/value_parsing.h"
30-
#include "arrow_to_python_internal.h"
31-
#include "common.h"
32-
#include "helpers.h"
33-
#include "platform.h"
30+
#include "arrow/python/arrow_to_python_internal.h"
31+
#include "arrow/python/common.h"
32+
#include "arrow/python/helpers.h"
33+
#include "arrow/python/platform.h"
3434

3535
namespace arrow {
3636
namespace py {

python/pyarrow/src/datetime.h python/pyarrow/src/arrow/python/datetime.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
#include <algorithm>
2121
#include <chrono>
2222

23-
#include "platform.h"
24-
#include "visibility.h"
2523
#include "arrow/status.h"
2624
#include "arrow/type.h"
2725
#include "arrow/type_fwd.h"
2826
#include "arrow/util/logging.h"
27+
#include "arrow/python/platform.h"
28+
#include "arrow/python/visibility.h"
2929

3030
// By default, PyDateTimeAPI is a *static* variable. This forces
3131
// PyDateTime_IMPORT to be called in every C/C++ module using the

python/pyarrow/src/decimal.cc python/pyarrow/src/arrow/python/decimal.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
#include <algorithm>
1919
#include <limits>
2020

21-
#include "common.h"
22-
#include "decimal.h"
23-
#include "helpers.h"
2421
#include "arrow/type_fwd.h"
2522
#include "arrow/util/decimal.h"
2623
#include "arrow/util/logging.h"
24+
#include "arrow/python/common.h"
25+
#include "arrow/python/decimal.h"
26+
#include "arrow/python/helpers.h"
2727

2828
namespace arrow {
2929
namespace py {

python/pyarrow/src/decimal.h python/pyarrow/src/arrow/python/decimal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include <string>
2121

22-
#include "visibility.h"
22+
#include "arrow/python/visibility.h"
2323
#include "arrow/type.h"
2424

2525
namespace arrow {

python/pyarrow/src/deserialize.cc python/pyarrow/src/arrow/python/deserialize.cc

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
#include "deserialize.h"
18+
#include "arrow/python/deserialize.h"
1919

20-
#include "numpy_interop.h"
20+
#include "arrow/python/numpy_interop.h"
2121

2222
#include <cstdint>
2323
#include <memory>
@@ -40,12 +40,12 @@
4040
#include "arrow/util/logging.h"
4141
#include "arrow/util/value_parsing.h"
4242

43-
#include "common.h"
44-
#include "datetime.h"
45-
#include "helpers.h"
46-
#include "numpy_convert.h"
47-
#include "pyarrow.h"
48-
#include "serialize.h"
43+
#include "arrow/python/common.h"
44+
#include "arrow/python/datetime.h"
45+
#include "arrow/python/helpers.h"
46+
#include "arrow/python/numpy_convert.h"
47+
#include "arrow/python/pyarrow.h"
48+
#include "arrow/python/serialize.h"
4949

5050
namespace arrow {
5151

python/pyarrow/src/deserialize.h python/pyarrow/src/arrow/python/deserialize.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
#include <memory>
2222
#include <vector>
2323

24-
#include "serialize.h"
25-
#include "visibility.h"
2624
#include "arrow/status.h"
25+
#include "arrow/python/serialize.h"
26+
#include "arrow/python/visibility.h"
2727

2828
namespace arrow {
2929

python/pyarrow/src/extension_type.cc python/pyarrow/src/arrow/python/extension_type.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#include <sstream>
2020
#include <utility>
2121

22-
#include "extension_type.h"
23-
#include "helpers.h"
24-
#include "pyarrow.h"
2522
#include "arrow/util/checked_cast.h"
2623
#include "arrow/util/logging.h"
24+
#include "arrow/python/extension_type.h"
25+
#include "arrow/python/helpers.h"
26+
#include "arrow/python/pyarrow.h"
2727

2828
namespace arrow {
2929

0 commit comments

Comments
 (0)