24 Commits
Author SHA1 Message Date
2de8008748 GH-41910: [Python] Add support for Pyodide (#37822)
pyarrow knows about ARROW_ENABLE_THREADING and doesn't use threads if they are not enabled in libarrow.

Split from #37696 

* GitHub Issue: #41910

Lead-authored-by: Joe Marshall <joe.marshall@nottingham.ac.uk>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2024-07-06 06:17:25 +09:00
David LiandAntoine Pitrou b6ab9092af GH-37093: [Python] Add async Flight client with GetFlightInfo (#36986)
### Rationale for this change

Demonstrate how to deal with async Flight from Python.

### What changes are included in this PR?

Add bindings for GetFlightInfo.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes, new APIs.

* Closes: #37093

Lead-authored-by: David Li <li.davidm96@gmail.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2023-08-23 19:33:57 +02:00
Weston Pace c8e00969ee GH-34564: [Python][C++] Update code to compile with cython 3 (#34726)
### Rationale for this change

Cython 3 has some breaking changes:

 * `&&` is no longer supported
 * `nogil` must appear at the end of the line

In addition we had to work around a bug: https://github.com/cython/cython/issues/5333

### What changes are included in this PR?

Minor changes to the cython code.

### Are these changes tested?

No, and they probably should be at some point.  However, Cython 3 has not yet released and so it would be impractical to update our CI to run Cython 3 until that happens.

### Are there any user-facing changes?

No
* Closes: #34564

Authored-by: Weston Pace <weston.pace@gmail.com>
Signed-off-by: Weston Pace <weston.pace@gmail.com>
2023-03-24 09:57:30 -07:00
Antoine Pitrou b0d74bd0ee ARROW-17815: [Python] Warn, not error out, when SetSignalStopSource fails (#14205)
In complex scenarios, the global signal-receiving StopSource may have already been created.

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-09-22 14:23:44 +02:00
Raúl Cumplido b67e3c8ef1 ARROW-16062: [Python] Move libarrow_python include definitions to its own file
This PR moves all the `arrow/python` definitions to its own `libarrow_python.pxd` file as requested on ARROW-16062

Closes #12873 from raulcd/ARROW-16062

Authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2022-04-15 17:35:15 +02:00
Antoine Pitrou 9e69ccf6cc ARROW-15454: [Python] Try to make CSV cancellation test more robust
Use `signal.set_wakeup_fd` to wait reliably for the signal to get to the Python interpreter.

Closes #12260 from pitrou/ARROW-15454-csv-cancellation

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2022-01-26 18:46:45 +01:00
Krisztián SzűcsandAntoine Pitrou 15f4e56c8f ARROW-14217: [Python][CI] Add support for python 3.10
Closes #11316 from kszucs/py310

Lead-authored-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
2021-10-18 12:22:22 +02:00
Alessandro Molina 0dfe59223c ARROW-13637: [Python] Fix docstrings
Address all docstrings to make sure they pass `archery numpydoc --allow-rule PR01`

Closes #11245 from amol-/ARROW-13637

Authored-by: Alessandro Molina <amol@turbogears.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-10-04 11:44:40 +02:00
Antoine Pitrou fda6b27d81 ARROW-13187: [Python] Avoid creating reference cycle when reading CSV file
Some Python versions have a bug where `signal.getsignal` creates a reference cycle holding execution frames alive (https://bugs.python.org/issue42248).

This would cause excessive lifetimes of the PyArrow table returned by `read_csv`.

Closes #10609 from pitrou/ARROW-13187-signal-refcycle

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-06-29 17:08:02 +02:00
David Li 5159d2b744 ARROW-12622: [Python] Fix segfault in read_csv when not on main thread
An uninitialized StopToken caused segfaults if you ever called read_csv with cancellation disabled or when not on the main thread (e.g. if used in a Flight server). If we have a 4.0.1 I think this qualifies as a regression.

Closes #10227 from lidavidm/arrow-12622

Authored-by: David Li <li.davidm96@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-05-03 16:53:16 +02:00
Antoine Pitrou 79ae4f6db3 ARROW-8732: [C++] Add basic cancellation API
In this model, a StopSource is instantiated by the consumer, which passes a corresponding StopToken to producer API(s).

Closes #9528 from pitrou/ARROW-8732-cancel-v2

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-03-09 17:07:42 +01:00
Wes McKinney 124db17bcd ARROW-9030: [Python] Remove pyarrow/compat.py, move some oft-used utility functions to pyarrow.lib
This is some routine scrubbing that deals with some remnants of the prior dual py2/3 codebase.

Closes #7421 from wesm/ARROW-9030

Authored-by: Wes McKinney <wesm@apache.org>
Signed-off-by: Wes McKinney <wesm@apache.org>
2020-06-12 21:36:22 -05:00
Antoine Pitrou 18872a4441 ARROW-3410: [C++][Python] Add streaming CSV reader.
Only the serial version is implemented for now.

Closes #6764 from pitrou/ARROW-3410-streaming-csv

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: François Saint-Jacques <fsaintjacques@gmail.com>
2020-04-14 11:44:20 -04:00
Antoine Pitrou 28f4980a15 ARROW-7282: [Python] IO functions should raise the right exceptions
When an Arrow IO function fails, it should be turned into the appropriate
Python exception subclass, e.g. FileNotFoundError in case the requested
file or directory is missing.

Closes #5960 from pitrou/ARROW-7282-python-ioerror-subclasses and squashes the following commits:

262616e29 <Antoine Pitrou> ARROW-7282:  IO functions should raise the right exceptions

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2019-12-17 19:49:44 +01:00
Antoine Pitrou 93688e8c1f ARROW-5977: [C++] [Python] Allow specifying which columns to include
If the `include_columns` option is not empty:
- columns are included in that order
- columns not in `include_columns` are ignored
- columns in `include_columns` but not in the CSV file produce a null column

Closes #5026 from pitrou/ARROW-5977-csv-include-columns and squashes the following commits:

0f198ef0b <Antoine Pitrou> ARROW-5977:   Allow specifying which columns to include

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2019-08-12 14:05:54 +02:00
Micah Kornfield ee286fe7a2 ARROW-4036: [C++] Pluggable Status message, by exposing an abstract delegate class.
This provides less "pluggability" but I think still offers a clean model for extension (subsystems can wrap the constructor for there purposes, and provide external static methods to check for particular types of errors).

Author: Micah Kornfield <emkornfield@gmail.com>
Author: Antoine Pitrou <antoine@python.org>

Closes #4484 from emkornfield/status_code_proposal and squashes the following commits:

4d1ab8d1d <Micah Kornfield> don't import plasma errors directly into top level pyarrow module
a66f999f8 <Micah Kornfield> make format
040216d48 <Micah Kornfield> fixes for comments outside python
729bba1ff <Antoine Pitrou> Fix Py2 issues (hopefully)
ea56d1e6a <Antoine Pitrou> Fix PythonErrorDetail to store Python error state (and restore it in check_status())
21e1b95ac <Micah Kornfield> fix compilation
9c905b094 <Micah Kornfield> fix lint
74d563cd7 <Micah Kornfield> fixes
85786efb1 <Micah Kornfield> change messages
3626a9016 <Micah Kornfield> try removing message
a4e6a1ff2 <Micah Kornfield> add logging for debug
4586fd1e2 <Micah Kornfield> fix typo
8f011b329 <Micah Kornfield> fix status propagation
317ea9c66 <Micah Kornfield> fix complie
9f5916070 <Micah Kornfield> don't make_shared inline
484b3a232 <Micah Kornfield> style fix
14e3467b5 <Micah Kornfield> dont rely on rtti
cd22df64d <Micah Kornfield> format
dec458506 <Micah Kornfield> not-quite pluggable error codes
2019-07-04 14:51:29 +09:00
Antoine Pitrou fec7a0eb06 ARROW-4788: [C++] Less verbose API for constructing StructArray
Also our first API to return a `Result<>`.
Includes appropriate massaging in the test helpers so that ASSERT_OK and ASSERT_RAISES can handle `Result<>` instances.

Author: Antoine Pitrou <antoine@python.org>

Closes #4707 from pitrou/ARROW-4788-struct-array-factory and squashes the following commits:

ae5435857 <Antoine Pitrou> ARROW-4788:  Less verbose API for constructing StructArray
2019-06-27 22:32:08 -05:00
Benjamin Kietzman 4627232c73 ARROW-5311: [C++] use more specific error status types in take
Now emits

- TypeError when indices are not integral
- KeyError when an index is out of bounds

Author: Benjamin Kietzman <bengilgit@gmail.com>

Closes #4317 from bkietz/5311-Return-more-specific-invalid-Status-in-T and squashes the following commits:

098afd1ed <Benjamin Kietzman> Fix copypasta doccomments, add IndexError to ConvertPyError
3253f3c25 <Benjamin Kietzman> remove duplicate switch case
dd49bc876 <Benjamin Kietzman> use IndexError in Take()
144745f1d <Benjamin Kietzman> add IndexError status code
eec1536c9 <Benjamin Kietzman> adjust expected errors in tests of take consumers
b3ede9ce6 <Benjamin Kietzman> use more specific error status types in take
2019-05-16 14:42:38 +02:00
Antoine Pitrou a28a198296 ARROW-2389: [C++] Add CapacityError
This error signals an attempt to exceed capacity of a buffer or container. I initially thought I'd call this `OverflowError` but `CapacityError` makes it clearer that it's not about overflow on arithmetic operations, iMHO.

Author: Antoine Pitrou <antoine@python.org>

Closes #1991 from pitrou/ARROW-2389-capacity-error and squashes the following commits:

afc037d <Antoine Pitrou> ARROW-2389:  Add CapacityError
2018-05-07 13:37:14 +02:00
Philipp Moritz 016c45aa20 ARROW-1450: [Python] Raise proper error if custom serialization handler fails
This fixes the serialize and deserialize methods to throw the right exceptions.

Author: Philipp Moritz <pcmoritz@gmail.com>

Closes #1029 from pcmoritz/pyarrow-serialization-error and squashes the following commits:

249b38ed [Philipp Moritz] formatting
2d872a4c [Philipp Moritz] fixes
caad76d1 [Philipp Moritz] add test for deserialization (needs fixing)
57772124 [Philipp Moritz] fix python serialization error propagation
2017-09-03 15:11:00 -04:00
Philipp Moritz c6295f3b74 ARROW-1438: [Python] Pull serialization context through PlasmaClient put and get
Author: Philipp Moritz <pcmoritz@gmail.com>

Closes #1019 from pcmoritz/plasma-serialization-context and squashes the following commits:

caf85165 [Philipp Moritz] fix
8e8e9011 [Philipp Moritz] add error handling
1a4fade0 [Philipp Moritz] add tests and fixes
2389659e [Philipp Moritz] Pull serialization context through PlasmaClient put and get
2017-09-01 08:42:38 -04:00
Wes McKinney 2972c9d3a0 ARROW-1342: [Python] Support strided ndarrays in pandas conversion from nested lists
This does drop the vector append to the builder that was there before. I'm going to do some local benchmarking to make sure this doesn't degrade performance unacceptably, will report back here

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #956 from wesm/ARROW-1342 and squashes the following commits:

f2ebeba8 [Wes McKinney] Fix cpplint issue
f403f9dd [Wes McKinney] Fix test case to be platform independent, note ARROW-1345. Improve quality of error message
f4f44c18 [Wes McKinney] Fix test case where inferred list type is null
ae5c8312 [Wes McKinney] Drop striding check
b4aecd3a [Wes McKinney] Support strided ndarrays in pandas conversion from nested lists
2017-08-09 17:47:30 -04:00
Philipp Moritz a94f4716be ARROW-1149: [Plasma] Create Cython client library for Plasma
This PR introduces a Cython API to Plasma, a FindPlasma.cmake to make it easier to integrate Plasma with CMake projects and sets up packaging with pyarrow.

Author: Philipp Moritz <pcmoritz@gmail.com>
Author: Robert Nishihara <robertnishihara@gmail.com>

Closes #797 from pcmoritz/plasma-cython and squashes the following commits:

d8319fc [Philipp Moritz] get for of PlasmaClient.connect
d14ab87 [Philipp Moritz] get rid of MutableBuffer
08f24a5 [Philipp Moritz] fix typos and move FixedSizeBufferOutputStream
e33443d [Philipp Moritz] fix setup.py develop for plasma
5f7b779 [Philipp Moritz] changes needed to make Ray work with Plasma in Arrow
b9e2dee [Philipp Moritz] fix windows build
3e4a84d [Philipp Moritz] fix segfault
0bea267 [Philipp Moritz] debug
23fe5f5 [Philipp Moritz] make plasma store binary part of the pyarrow package for tests
b863d13 [Philipp Moritz] fix
997de1e [Philipp Moritz] fix
47dc739 [Philipp Moritz] fixes
47033e7 [Philipp Moritz] switch to pytest
ed84c53 [Philipp Moritz] partial fixes
9bc5c15 [Philipp Moritz] implement wait and fetch for the client
45f338f [Philipp Moritz] test plasma on macOS
8b53618 [Philipp Moritz] fix
54f595e [Philipp Moritz] try fixing python 2 tests
2c6d652 [Philipp Moritz] convert docs to numpy format
3270628 [Philipp Moritz] try to get documentation up
44d1a55 [Philipp Moritz] cleanups and release GIL
a9f6502 [Philipp Moritz] more fixes
1ff88e7 [Philipp Moritz] fix travix ci
348f9bf [Philipp Moritz] fixes
4ae1a27 [Philipp Moritz] fix
fd80203 [Philipp Moritz] Plasma Python extension packaging: It compiles!
3b69973 [Robert Nishihara] Fixed minor python linting.
c9f6bcf [Robert Nishihara] Fix indentation and line lengths in plasma.pyx.
67b0951 [Robert Nishihara] Fix long lines in plasma/test/test.py.
e26527c [Robert Nishihara] Convert plasma test.py from 2 space indentation to 4 space indentation.
acc71d2 [Philipp Moritz] add round trip test for dataframes
2b7f949 [Philipp Moritz] implement mutable arrow python buffers
c06f1b5 [Philipp Moritz] fix test
1d7928f [Philipp Moritz] add arrow roundtrip test
6371e2e [Philipp Moritz] fix tests
3021d59 [Philipp Moritz] make ObjectID pickleable
dd5a7d8 [Philipp Moritz] fix tests
777e9c7 [Philipp Moritz] introduce plasma namespace
a4a9628 [Philipp Moritz] fix c++ tests
924888b [Philipp Moritz] update
f970df3 [Philipp Moritz] reduce logging
2ff2480 [Philipp Moritz] workaround for python visibility
d4934a9 [Philipp Moritz] update
cba92c1 [Philipp Moritz] setup.py for plasma
066d0ea [Philipp Moritz] test
1aea320 [Philipp Moritz] run plasma tests
3c4de52 [Philipp Moritz] use cmake to build the cython extension
bf39297 [Philipp Moritz] build and install pyarrow for plasma tests
5bf722a [Philipp Moritz] fix plasma path
1c5434c [Philipp Moritz] fix formatting
187cc24 [Philipp Moritz] add travis tests
c3d462d [Philipp Moritz] remove Python C extension
d9261b4 [Philipp Moritz] add documentation and license
db2d09a [Philipp Moritz] get all python tests in place
78d08ac [Philipp Moritz] make eviction work in Cython
18e0ac4 [Philipp Moritz] get tests
bc681ca [Philipp Moritz] port some python tests
f8e05f2 [Philipp Moritz] implement plasma.get in the cython client
d590c8a [Philipp Moritz] update
5178ee7 [Philipp Moritz] update
9044a01 [Philipp Moritz] initial plasma cython client commit
2017-07-24 12:12:42 -04:00
Wes McKinney 9e875a6843 ARROW-819: Public Cython and C++ API in the style of lxml, arrow::py::import_pyarrow method
I have been looking at LXML's approach to creating both a public Cython API and C++ API

https://github.com/lxml/lxml

While this may seem like a somewhat radical reorganization of the code, putting all of the main symbols in a single Cython extension makes generating a C++ API for them significantly simpler. By using `.pxi` files we can break the codebase into as small pieces as we like (as long as there are no circular dependencies). As a convenient side effect, the build times are shorter.

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #680 from wesm/ARROW-819 and squashes the following commits:

9e6ee246 [Wes McKinney] Fix up optional extensions
cff757de [Wes McKinney] Expose pyarrow C API in arrow/python/pyarrow.h
b39d19cd [Wes McKinney] Fix test suite. Move _config into lib
ff1b5e51 [Wes McKinney] Rename things a bit
d4a83912 [Wes McKinney] Reorganize Cython code in the style of lxml so make declaring a public C API easier
2017-05-13 15:44:43 -04:00