Commit Graph
11 Commits
Author SHA1 Message Date
ChiLin ChiuandRaúl Cumplido 992bee2c83 GH-45619: [Python] Use f-string instead of string.format (#45629)
### Rationale for this change

See https://github.com/apache/arrow/issues/45619.

### What changes are included in this PR?

Refactor using f-string instead of `string.format`. But do not use f-string for following case,  `string.format` allows passing parameters, making the code more reusable.

https://github.com/apache/arrow/blob/0fbf9823542233c5f32c26534c34cc97ce3f0be2/python/pyarrow/parquet/core.py#L1624-L1695

### Are these changes tested?

Via CI.

### Are there any user-facing changes?

No.

* GitHub Issue: #45619

Lead-authored-by: Chilin Chiou <chilin.chiou@gmail.com>
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
2025-05-12 14:34:49 +02:00
Antoine Pitrou 58415d1fac GH-38183: [CI][Python] Use pipx to install GCS testbench (#43852)
### Rationale for this change

Installing the GCS testbench using the same Python that's being used to test PyArrow is fragile: some testbench versions may not be compatible, or there could be conflicts among the dependencies of the respective libraries.

### What changes are included in this PR?

Use `pipx` to install the GCS testbench in a separate, controlled environment, using an appropriate Python version.

### Are these changes tested?

Yes, by CI.

### Are there any user-facing changes?

No.

* GitHub Issue: #38183

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2024-08-29 09:54:32 +09:00
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
Joris Van den Bossche 680980e8bd GH-41924: [Python] Fix tests when using NumPy 2.0 on Windows (#42099)
### Rationale for this change

The tests are failing on windows when using numpy 2.0 RC, probably related to default integer bitwidth.

### What changes are included in this PR?

### Are these changes tested?

### Are there any user-facing changes?

* GitHub issue: #41319
* GitHub Issue: #41924

Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2024-06-13 14:45:10 +02:00
Joris Van den Bossche e6eb61f58e ARROW-10281: [Python] Fix warnings when running tests
Closes #8439 from jorisvandenbossche/ARROW-10281-test-warnings

Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Signed-off-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
2020-10-12 19:50:48 +02:00
Wes McKinney 46cf332a1c ARROW-8801: [Python] Fix memory leak when converting datetime64-with-tz data to pandas
An array object was failing to be decref'd on the DatetimeTZ conversion path. The code is slightly complicated by the different calling reference ownership semantics of the Array/ChunkedArray conversion path (which expects to own the created array when it calls `GetSeriesResult` while the `GetResultBlock` code retains its array in a `OwnedRefNoGIL`). This was the simplest thing that fixed the memory leak for me. There is leak checking code that can be used to verify this in python/scripts/test_leak.py (just run the script).

Closes #7522 from wesm/ARROW-8801

Authored-by: Wes McKinney <wesm@apache.org>
Signed-off-by: Wes McKinney <wesm@apache.org>
2020-06-23 08:25:23 -05:00
Wes McKinney 286bf7c9d3 ARROW-4637: [Python] Conditionally import pandas symbols if they are used. Do not require pandas as a test dependency
Warning: hold your nose for this one =) I think this can be made cleaner, but I just wanted to triage all the problems and make sure we don't introduce a hard dependency on pandas again

Also resolves ARROW-4794: make pandas an optional dependency

Author: Wes McKinney <wesm+git@apache.org>

Closes #3893 from wesm/ARROW-4637 and squashes the following commits:

3c353b6b <Wes McKinney> do not override orc global mark in test_orc.py
59fdf8ab <Wes McKinney> Tweak pyarrow._orc import to see if it fixes MSVC
747c8937 <Wes McKinney> Address Python 2.7 unicode interaction issue with Cython
4d94b2e1 <Wes McKinney> Add benchmark from ARROW-4629
f7bf7741 <Wes McKinney> Cythonize pandas API shim for better performance
4a2549aa <Wes McKinney> Remove TF testing from travis_script_manylinux1.sh
5061c6e1 <Wes McKinney> Do not require pandas to run unit tests
385cfe55 <Wes McKinney> Finish pandas API shim; do not eagerly import pandas, add to CI
804587a0 <Wes McKinney> add import test script
bb0240e2 <Wes McKinney> Begin to refactor to make references to pandas more centralized and lazy
2019-03-19 11:59:30 -05:00
Wes McKinney 5904eea4cc ARROW-3324: [Python] Destroy temporary metadata builder classes more eagerly when building files to reduce memory usage
Destroy RowGroupMetadataBuilder after each row group is completed

Author: Wes McKinney <wesm+git@apache.org>

Closes #3261 from tanyaschlusser/ARROW-3324 and squashes the following commits:

5f3876706 <Wes McKinney> Refine case a bit
4f2bdcdce <Wes McKinney> Destroy RowGroupMetadataBuilder object after completing a row group to reduce memory usage
2018-12-26 22:38:00 -06:00
Wes McKinney c15eee7b98 ARROW-2395: [Python] Fix flake8 warnings outside of pyarrow/ directory. Check in CI
Author: Wes McKinney <wesm+git@apache.org>

Closes #2137 from wesm/ARROW-2395 and squashes the following commits:

d9e6e9f3 <Wes McKinney> Fix Cython flake8 warnings in examples
059a6d6b <Wes McKinney> Make functions in benchmarks/common.py py2-compatible
13791863 <Wes McKinney> Fix flake8 warnings outside of pyarrow/ directory. Check in CI
2018-06-15 11:24:32 +02:00
Wes McKinney ff72951f02 ARROW-1053: [Python] Remove unnecessary Py_INCREF in PyBuffer causing memory leak
cc @BryanCutler

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

Closes #704 from wesm/ARROW-1053 and squashes the following commits:

2f90337c [Wes McKinney] Remove unnecessary Py_INCREF in PyBuffer causing memory leak
2017-05-19 09:06:14 -04:00
Wes McKinney c7839e9fab ARROW-1017: [Python] Fix memory leaks in conversion to pandas.DataFrame
Notes:

* `PyList_Append` increments ref count, so new objects must be DECREF'd after being inserted
* `PyArray_SimpleNewFromDescr` does not set `NPY_ARRAY_OWNDATA`, neither does `NewFromDescr`

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

Closes #685 from wesm/ARROW-1017 and squashes the following commits:

8459123 [Wes McKinney] Fix memory leak caused by list append ref count, lack of setting NPY_ARRAY_OWNDATA
2017-05-14 14:35:28 -04:00