Skip to content

Commit

Permalink
fix: make pyarrow optional (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasdavis committed Aug 8, 2023
1 parent cc39774 commit 576dcdd
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: install
run: |
pip install pip wheel -U
pip install -q --no-cache-dir .[complete]
pip install -q --no-cache-dir .[test]
pip list
- name: test
run: |
Expand Down
23 changes: 16 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,24 @@ dynamic = ["version"]

[project.optional-dependencies]
complete = [
"pyarrow",
"pytest >=6.0",
"pytest-cov >=3.0.0",
"awkward-pandas[strings,parquet]",
]
parquet = [
"pyarrow",
]
strings = [
"pyarrow >=7.0.0",
]
test = [
"awkward-pandas[complete]",
"pytest >=6.0",
"pytest-cov >=3.0.0",
]
docs = [
"sphinx",
"furo",
"nbsphinx",
"ipython",
"sphinx",
"furo",
"nbsphinx",
"ipython",
]

[project.urls]
Expand Down
6 changes: 5 additions & 1 deletion tests/test_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ def test_getitem():
assert s2.tolist() == [[6], [4]]


def test_to_column():
def test_to_column_ints():
s = pd.Series(awkward_pandas.AwkwardExtensionArray([6, 2, 3]), name="test")
s2 = s.ak.to_column()
assert s2.dtype == "int64"


def test_to_column_strings():
pytest.importorskip("pyarrow")
s = pd.Series(awkward_pandas.AwkwardExtensionArray(["6", "2", "3"]), name="test")
s2 = s.ak.to_column()
assert s2.dtype == "string[pyarrow]"
Expand All @@ -41,6 +44,7 @@ def test_to_column():


def test_to_columns():
pytest.importorskip("pyarrow")
s = pd.Series(
awkward_pandas.AwkwardExtensionArray(
{"num": [6, 2, 3], "deep": [[0], [], None], "text": ["hi", "ho", "hum"]}
Expand Down
3 changes: 3 additions & 0 deletions tests/test_array.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from __future__ import annotations

import pandas as pd
import pytest
from pandas.testing import assert_frame_equal

from awkward_pandas import AwkwardExtensionArray, merge


def test_merge_no_ak():
pytest.importorskip("pyarrow")
df = pd.DataFrame(
{
"a": [1, 2, 3],
Expand Down Expand Up @@ -40,6 +42,7 @@ def test_merge_one_ak():


def test_parquet_roundtrip(tmp_path):
pytest.importorskip("pyarrow")
df = pd.DataFrame(
{
"a": [1, 2, 3, 4, 5],
Expand Down
2 changes: 2 additions & 0 deletions tests/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import pandas as pd
import pytest

pytest.importorskip("pyarrow")


@pytest.mark.parametrize("binary", [True, False])
@pytest.mark.parametrize("method", ["upper", "capitalize", "isalpha"])
Expand Down

0 comments on commit 576dcdd

Please sign in to comment.