Skip to content
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

Divide Wheels WIP local PR #76

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions ci/scripts/python_wheel_manylinux_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ export ARROW_HOME=/tmp/arrow-dist
export CMAKE_PREFIX_PATH=/tmp/arrow-dist

pushd /arrow/python
python setup.py bdist_wheel

python setup.py bdist_wheel --target pyarrow_core
# --exclude libarrow_flight.so --exclude libarrow_python_flight.so
echo "=== (${PYTHON_VERSION}) Tag the wheel with manylinux${MANYLINUX_VERSION} ==="
auditwheel repair -L . dist/pyarrow-*.whl -w repaired_wheels
#auditwheel repair -L . dist/pyarrow*.whl -w repaired_wheels
popd
99 changes: 51 additions & 48 deletions python/pyarrow/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,54 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

from pyarrow._flight import ( # noqa:F401
connect,
Action,
ActionType,
BasicAuth,
CallInfo,
CertKeyPair,
ClientAuthHandler,
ClientMiddleware,
ClientMiddlewareFactory,
DescriptorType,
FlightCallOptions,
FlightCancelledError,
FlightClient,
FlightDataStream,
FlightDescriptor,
FlightEndpoint,
FlightError,
FlightInfo,
FlightInternalError,
FlightMetadataReader,
FlightMetadataWriter,
FlightMethod,
FlightServerBase,
FlightServerError,
FlightStreamChunk,
FlightStreamReader,
FlightStreamWriter,
FlightTimedOutError,
FlightUnauthenticatedError,
FlightUnauthorizedError,
FlightUnavailableError,
FlightWriteSizeExceededError,
GeneratorStream,
Location,
MetadataRecordBatchReader,
MetadataRecordBatchWriter,
RecordBatchStream,
Result,
SchemaResult,
ServerAuthHandler,
ServerCallContext,
ServerMiddleware,
ServerMiddlewareFactory,
Ticket,
TracingServerMiddlewareFactory,
)
try:
from pyarrow._flight import ( # noqa:F401
connect,
Action,
ActionType,
BasicAuth,
CallInfo,
CertKeyPair,
ClientAuthHandler,
ClientMiddleware,
ClientMiddlewareFactory,
DescriptorType,
FlightCallOptions,
FlightCancelledError,
FlightClient,
FlightDataStream,
FlightDescriptor,
FlightEndpoint,
FlightError,
FlightInfo,
FlightInternalError,
FlightMetadataReader,
FlightMetadataWriter,
FlightMethod,
FlightServerBase,
FlightServerError,
FlightStreamChunk,
FlightStreamReader,
FlightStreamWriter,
FlightTimedOutError,
FlightUnauthenticatedError,
FlightUnauthorizedError,
FlightUnavailableError,
FlightWriteSizeExceededError,
GeneratorStream,
Location,
MetadataRecordBatchReader,
MetadataRecordBatchWriter,
RecordBatchStream,
Result,
SchemaResult,
ServerAuthHandler,
ServerCallContext,
ServerMiddleware,
ServerMiddlewareFactory,
Ticket,
TracingServerMiddlewareFactory,
)
except ImportError:
raise ImportError('Flight extension not installed. You can install it '
'with pip install pyarrow_flight=={version} or conda install pyarrow_flight=={version}.')
56 changes: 53 additions & 3 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,55 @@

ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')

import argparse

# Pre-parse and remove the '--target' argument from sys.argv
parser = argparse.ArgumentParser()
parser.add_argument('--target', default='pyarrow')
values, rest = parser.parse_known_args()
DIST_TARGET = values.target
sys.argv = sys.argv[:1] + rest

class Target():
def __init__(self, target):
if target not in ['pyarrow', 'pyarrow_core', 'pyarrow_flight']:
raise ValueError("unknown distribution target: '%s'" % target)
self.target = target

def get_packages(self):
if strtobool(os.environ.get('PYARROW_INSTALL_TESTS', '1')):
return ['pyarrow', 'pyarrow.tests']
else:
return ['pyarrow']

def get_package_data(self):
return {'pyarrow': ['*.pxd', '*.pyx', 'includes/*.pxd']}

def get_description(self):
if self.target == 'pyarrow':
return 'Python library for Apache Arrow'
elif self.target == 'pyarrow_core':
return 'Python library for core Apache Arrow features'
elif self.target == 'pyarrow_flight':
return 'Python library for core Apache Arrow features'

def get_long_description(self):
# TODO
if self.target == 'pyarrow':
with open('README.md') as f:
long_description = f.read()
else:
with open(os.path.join(self.target, 'README.md')) as f:
long_description = f.read()
return long_description

def get_test_suite(self):
# TODO
return '%s.tests' % self.target


target = Target(DIST_TARGET)


@contextlib.contextmanager
def changed_dir(dirname):
Expand Down Expand Up @@ -83,6 +132,7 @@ def build_extensions(self):

self.extensions = [ext for ext in self.extensions
if ext.name != '__dummy__']
breakpoint()

for ext in self.extensions:
if (hasattr(ext, 'include_dirs') and
Expand Down Expand Up @@ -472,10 +522,10 @@ def has_ext_modules(foo):


setup(
name='pyarrow',
packages=packages,
name=target.target,
packages=target.get_packages(),
zip_safe=False,
package_data={'pyarrow': ['*.pxd', '*.pyx', 'includes/*.pxd']},
package_data=target.get_package_data(),
include_package_data=True,
exclude_package_data=exclude_package_data,
distclass=BinaryDistribution,
Expand Down