Skip to content

Commit

Permalink
Python side boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Newton committed Feb 7, 2024
1 parent 14cd4e0 commit 1d011da
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/pyarrow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def print_entry(label, value):
print(f" {module: <20}: {status: <8}")

print("\nFilesystems:")
filesystems = ["GcsFileSystem", "HadoopFileSystem", "S3FileSystem"]
filesystems = ["AzureFileSystem", "GcsFileSystem", "HadoopFileSystem", "S3FileSystem"]
for fs in filesystems:
status = "Enabled" if _filesystem_is_available(fs) else "-"
print(f" {fs: <20}: {status: <8}")
Expand Down
3 changes: 3 additions & 0 deletions python/pyarrow/_fs.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@ cdef class FileSystem(_Weakrefable):
elif typ == 'gcs':
from pyarrow._gcsfs import GcsFileSystem
self = GcsFileSystem.__new__(GcsFileSystem)
elif typ == 'abfs':
from pyarrow._azurefs import AzureFileSystem
self = AzureFileSystem.__new__(AzureFileSystem)
elif typ == 'hdfs':
from pyarrow._hdfs import HadoopFileSystem
self = HadoopFileSystem.__new__(HadoopFileSystem)
Expand Down
4 changes: 4 additions & 0 deletions python/pyarrow/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
FileStats = FileInfo

_not_imported = []
try:
from pyarrow._azurefs import AzureFileSystem # noqa
except ImportError:
_not_imported.append("AzureFileSystem")

try:
from pyarrow._hdfs import HadoopFileSystem # noqa
Expand Down
6 changes: 6 additions & 0 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def run(self):
'build type (debug or release), default release'),
('boost-namespace=', None,
'namespace of boost (default: boost)'),
('with-azure', None,
'build the Azure Blob Storage extension'),
('with-cuda', None, 'build the Cuda extension'),
('with-flight', None, 'build the Flight extension'),
('with-substrait', None, 'build the Substrait extension'),
Expand Down Expand Up @@ -150,6 +152,8 @@ def initialize_options(self):
if not hasattr(sys, 'gettotalrefcount'):
self.build_type = 'release'

self.with_azure = strtobool(
os.environ.get('PYARROW_WITH_AZURE', '0'))
self.with_gcs = strtobool(
os.environ.get('PYARROW_WITH_GCS', '0'))
self.with_s3 = strtobool(
Expand Down Expand Up @@ -349,6 +353,8 @@ def _failure_permitted(self, name):
return True
if name == '_s3fs' and not self.with_s3:
return True
if name == '_azurefs' and not self.with_azure:
return True
if name == '_hdfs' and not self.with_hdfs:
return True
if name == '_dataset' and not self.with_dataset:
Expand Down

0 comments on commit 1d011da

Please sign in to comment.