lazyscribe-arrow 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lazyscribe-arrow might be problematic. Click here for more details.

lazyscribe_arrow/_meta.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Version."""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.2.1"
lazyscribe_arrow/csv.py CHANGED
@@ -12,6 +12,12 @@ from pyarrow import csv
12
12
  from pyarrow.interchange import from_dataframe
13
13
  from slugify import slugify
14
14
 
15
+ from lazyscribe_arrow.protocols import (
16
+ ArrowArrayExportable,
17
+ ArrowStreamExportable,
18
+ SupportsInterchange,
19
+ )
20
+
15
21
  LOG = logging.getLogger(__name__)
16
22
 
17
23
 
@@ -91,9 +97,9 @@ class CSVArtifact(Artifact):
91
97
  """
92
98
  if isinstance(obj, pa.Table):
93
99
  LOG.debug("Provided object is already a PyArrow table.")
94
- elif hasattr(obj, "__arrow_c_array__") or hasattr(obj, "__arrow_c_stream__"):
100
+ elif isinstance(obj, (ArrowArrayExportable, ArrowStreamExportable)):
95
101
  obj = pa.table(obj)
96
- elif hasattr(obj, "__dataframe__"):
102
+ elif isinstance(obj, SupportsInterchange):
97
103
  obj = from_dataframe(obj)
98
104
  else:
99
105
  raise ValueError(
@@ -12,6 +12,12 @@ from lazyscribe.artifacts.base import Artifact
12
12
  from pyarrow.interchange import from_dataframe
13
13
  from slugify import slugify
14
14
 
15
+ from lazyscribe_arrow.protocols import (
16
+ ArrowArrayExportable,
17
+ ArrowStreamExportable,
18
+ SupportsInterchange,
19
+ )
20
+
15
21
  LOG = logging.getLogger(__name__)
16
22
 
17
23
 
@@ -93,9 +99,9 @@ class ParquetArtifact(Artifact):
93
99
  """
94
100
  if isinstance(obj, pa.Table):
95
101
  LOG.debug("Provided object is already a PyArrow table.")
96
- elif hasattr(obj, "__arrow_c_array__") or hasattr(obj, "__arrow_c_stream__"):
102
+ elif isinstance(obj, (ArrowArrayExportable, ArrowStreamExportable)):
97
103
  obj = pa.table(obj)
98
- elif hasattr(obj, "__dataframe__"):
104
+ elif isinstance(obj, SupportsInterchange):
99
105
  obj = from_dataframe(obj)
100
106
  else:
101
107
  raise ValueError(
@@ -0,0 +1,38 @@
1
+ """Arrow exportable protocols."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Protocol, runtime_checkable
6
+
7
+
8
+ @runtime_checkable
9
+ class ArrowArrayExportable(Protocol):
10
+ """Type protocol for Arrow C Data Interface via Arrow PyCapsule Interface."""
11
+
12
+ def __arrow_c_array__(
13
+ self, requested_schema: object | None = None
14
+ ) -> tuple[object, object]:
15
+ """Export the object as a pair of ArrowSchema and ArrowArray structures."""
16
+ ...
17
+
18
+
19
+ @runtime_checkable
20
+ class ArrowStreamExportable(Protocol):
21
+ """Type protocol for Arrow C Stream Interface via Arrow PyCapsule Interface."""
22
+
23
+ def __arrow_c_stream__(self, requested_schema: object | None = None) -> object:
24
+ """Export the object as an ArrowArrayStream."""
25
+ ...
26
+
27
+
28
+ @runtime_checkable
29
+ class SupportsInterchange(Protocol):
30
+ """Dataframe that supports conversion into an interchange dataframe object."""
31
+
32
+ def __dataframe__(
33
+ self,
34
+ nan_as_null: bool = False,
35
+ allow_copy: bool = True,
36
+ ) -> SupportsInterchange:
37
+ """Convert to a dataframe object implementing the dataframe interchange protocol."""
38
+ ...
@@ -1,49 +1,46 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.3
2
2
  Name: lazyscribe-arrow
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Arrow-based artifact handlers for Lazyscribe
5
+ Author: Akshay Gupta
5
6
  Author-email: Akshay Gupta <akgcodes@gmail.com>
6
7
  License: MIT license
7
- Project-URL: Documentation, https://github.com/lazyscribe/lazyscribe-arrow
8
- Project-URL: Repository, https://github.com/lazyscribe/lazyscribe-arrow
9
8
  Classifier: Development Status :: 3 - Alpha
10
9
  Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Natural Language :: English
12
- Classifier: Programming Language :: Python :: 3
13
11
  Classifier: Programming Language :: Python :: 3 :: Only
14
12
  Classifier: Programming Language :: Python :: 3.10
15
13
  Classifier: Programming Language :: Python :: 3.11
16
14
  Classifier: Programming Language :: Python :: 3.12
17
15
  Classifier: Programming Language :: Python :: 3.13
16
+ Requires-Dist: attrs>=21.2,<=25.3
17
+ Requires-Dist: lazyscribe>=1,<=1.2
18
+ Requires-Dist: pyarrow>=14.0.1,<=21
19
+ Requires-Dist: python-slugify>=5,<=8.0.4
20
+ Requires-Dist: commitizen ; extra == 'build'
21
+ Requires-Dist: uv ; extra == 'build'
22
+ Requires-Dist: lazyscribe-arrow[build] ; extra == 'dev'
23
+ Requires-Dist: lazyscribe-arrow[qa] ; extra == 'dev'
24
+ Requires-Dist: lazyscribe-arrow[tests] ; extra == 'dev'
25
+ Requires-Dist: edgetest ; extra == 'qa'
26
+ Requires-Dist: mypy ; extra == 'qa'
27
+ Requires-Dist: pre-commit ; extra == 'qa'
28
+ Requires-Dist: pyproject-fmt ; extra == 'qa'
29
+ Requires-Dist: ruff ; extra == 'qa'
30
+ Requires-Dist: types-python-slugify ; extra == 'qa'
31
+ Requires-Dist: uv ; extra == 'qa'
32
+ Requires-Dist: pandas ; extra == 'tests'
33
+ Requires-Dist: pytest ; extra == 'tests'
34
+ Requires-Dist: pytest-cov ; extra == 'tests'
35
+ Requires-Dist: time-machine ; extra == 'tests'
18
36
  Requires-Python: >=3.10.0
19
- Description-Content-Type: text/markdown
20
- License-File: LICENSE
21
- Requires-Dist: attrs<=25.1.0,>=21.2.0
22
- Requires-Dist: lazyscribe<=1.1.0,>=1.0.0
23
- Requires-Dist: pyarrow<=19.0.1,>=14.0.1
24
- Requires-Dist: python-slugify<=8.0.4,>=5.0.0
37
+ Project-URL: Documentation, https://github.com/lazyscribe/lazyscribe-arrow
38
+ Project-URL: Repository, https://github.com/lazyscribe/lazyscribe-arrow
25
39
  Provides-Extra: build
26
- Requires-Dist: build; extra == "build"
27
- Requires-Dist: commitizen; extra == "build"
28
- Requires-Dist: twine; extra == "build"
29
- Requires-Dist: wheel; extra == "build"
40
+ Provides-Extra: dev
30
41
  Provides-Extra: qa
31
- Requires-Dist: edgetest; extra == "qa"
32
- Requires-Dist: mypy; extra == "qa"
33
- Requires-Dist: pre-commit; extra == "qa"
34
- Requires-Dist: ruff; extra == "qa"
35
- Requires-Dist: types-python-slugify; extra == "qa"
36
- Requires-Dist: uv; extra == "qa"
37
42
  Provides-Extra: tests
38
- Requires-Dist: pandas; extra == "tests"
39
- Requires-Dist: pytest; extra == "tests"
40
- Requires-Dist: pytest-cov; extra == "tests"
41
- Requires-Dist: time-machine; extra == "tests"
42
- Provides-Extra: dev
43
- Requires-Dist: lazyscribe-arrow[build]; extra == "dev"
44
- Requires-Dist: lazyscribe-arrow[qa]; extra == "dev"
45
- Requires-Dist: lazyscribe-arrow[tests]; extra == "dev"
46
- Dynamic: license-file
43
+ Description-Content-Type: text/markdown
47
44
 
48
45
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![PyPI](https://img.shields.io/pypi/v/lazyscribe-arrow)](https://pypi.org/project/lazyscribe-arrow/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/lazyscribe-arrow)](https://pypi.org/project/lazyscrib-arrow/) [![codecov](https://codecov.io/gh/lazyscribe/lazyscribe-arrow/graph/badge.svg?token=W5TPK7GX7G)](https://codecov.io/gh/lazyscribe/lazyscribe-arrow)
49
46
 
@@ -0,0 +1,9 @@
1
+ lazyscribe_arrow/__init__.py,sha256=YwnXVqIllCJKZakHtTtDsWh_raw0HGqG8lgsUfCH9FQ,199
2
+ lazyscribe_arrow/_meta.py,sha256=5ldinxF7m6V5dgpN2M5yw54r8bPkiGNJFgWiMlNj7Ag,38
3
+ lazyscribe_arrow/csv.py,sha256=55GIciGtui9sd2l0GdhSXpGaLTenMwxtUbJjboqMDi4,3278
4
+ lazyscribe_arrow/parquet.py,sha256=C_MofzAUqG5UlOG8NW4odlK_rTm0a4HjlhOZed94Row,3413
5
+ lazyscribe_arrow/protocols.py,sha256=VsG6t1em4qsTRwrDvph1aQdTKjFXCjjAcuvwFuay-8Y,1147
6
+ lazyscribe_arrow-0.2.1.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
7
+ lazyscribe_arrow-0.2.1.dist-info/entry_points.txt,sha256=OZeI9uVR1xkCYghXAwtsGStl5ItRE3UZ-BgabZufeyc,106
8
+ lazyscribe_arrow-0.2.1.dist-info/METADATA,sha256=6-F4cGUJ6-QqlJSRcZiQ13hIWW-IUHoCa8veRMUwTqs,3237
9
+ lazyscribe_arrow-0.2.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.8.24
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -1,3 +1,4 @@
1
1
  [lazyscribe.artifact_type]
2
2
  csv = lazyscribe_arrow:CSVArtifact
3
3
  parquet = lazyscribe_arrow:ParquetArtifact
4
+
@@ -1,10 +0,0 @@
1
- lazyscribe_arrow/__init__.py,sha256=YwnXVqIllCJKZakHtTtDsWh_raw0HGqG8lgsUfCH9FQ,199
2
- lazyscribe_arrow/_meta.py,sha256=tkM0F11odKeRd4ewZf6_GEIFshm_W68xXAjlwEu59xQ,38
3
- lazyscribe_arrow/csv.py,sha256=cyMcFC9S0tR2U7C5EWTsvQZETgU54fronafmn2LQbSA,3158
4
- lazyscribe_arrow/parquet.py,sha256=J3AqMvV77wSDW8FQYJE8xjidC5v8Zg4tvgCYh11_1LM,3293
5
- lazyscribe_arrow-0.2.0.dist-info/licenses/LICENSE,sha256=CbVwVKAq7TtkHhzCxwB5N86wxbkcn2VMP5UTxj3NgZo,1067
6
- lazyscribe_arrow-0.2.0.dist-info/METADATA,sha256=TqG43wfVq499R4vLnaNUjs5wnEhga6NOcl5BLoN33a0,3347
7
- lazyscribe_arrow-0.2.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
8
- lazyscribe_arrow-0.2.0.dist-info/entry_points.txt,sha256=GBZx4whc5e9t2mDuCxaBlYX0yHJKmnNwqczLob2TFfI,105
9
- lazyscribe_arrow-0.2.0.dist-info/top_level.txt,sha256=C_ElBcqIKkSjUmMQPDECDhhP54M7muep1KLnEiFJ61I,17
10
- lazyscribe_arrow-0.2.0.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
3
- Root-Is-Purelib: true
4
- Tag: py3-none-any
5
-
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 lazyscribe
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1 +0,0 @@
1
- lazyscribe_arrow