pytest-ditto-pyarrow 0.0.1__tar.gz
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.
- pytest_ditto_pyarrow-0.0.1/.gitignore +14 -0
- pytest_ditto_pyarrow-0.0.1/LICENSE +21 -0
- pytest_ditto_pyarrow-0.0.1/PKG-INFO +32 -0
- pytest_ditto_pyarrow-0.0.1/README.md +1 -0
- pytest_ditto_pyarrow-0.0.1/ditto_pyarrow/__init__.py +0 -0
- pytest_ditto_pyarrow-0.0.1/ditto_pyarrow/_version.py +1 -0
- pytest_ditto_pyarrow-0.0.1/ditto_pyarrow/io.py +56 -0
- pytest_ditto_pyarrow-0.0.1/ditto_pyarrow/marks.py +21 -0
- pytest_ditto_pyarrow-0.0.1/pyproject.toml +171 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 pytest-ditto
|
|
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.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: pytest-ditto-pyarrow
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: pytest-ditto plugin for pyarrow tables.
|
|
5
|
+
Author-email: Lachlan Taylor <lachlanbtaylor@proton.me>
|
|
6
|
+
Maintainer-email: Lachlan Taylor <lachlanbtaylor@proton.me>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: pytest,testing
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Framework :: Pytest
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: pyarrow>=16.1.0
|
|
24
|
+
Requires-Dist: pytest-ditto>=0.1.0
|
|
25
|
+
Requires-Dist: pytest>=3.5.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: hatch-vcs>=0.4.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: hatch>=1.9.4; extra == 'dev'
|
|
29
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# pytest-ditto-pyarrow
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# pytest-ditto-pyarrow
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.0.1'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from typing import ClassVar
|
|
3
|
+
|
|
4
|
+
import pyarrow as pa
|
|
5
|
+
import pyarrow.parquet as pq
|
|
6
|
+
from pyarrow import orc, csv, feather
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PyArrowParquet:
|
|
10
|
+
extension: ClassVar[str] = "pyarrow.parquet"
|
|
11
|
+
|
|
12
|
+
@staticmethod
|
|
13
|
+
def save(data: pa.Table, filepath: Path) -> None:
|
|
14
|
+
pq.write_table(data, filepath)
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def load(filepath: Path) -> pa.Table:
|
|
18
|
+
return pq.read_table(filepath)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# TODO: requires IANA timezone database installed
|
|
22
|
+
# class PyArrowORC:
|
|
23
|
+
# extension: ClassVar[str] = "pyarrow.orc"
|
|
24
|
+
#
|
|
25
|
+
# @staticmethod
|
|
26
|
+
# def save(data: pa.Table, filepath: Path) -> None:
|
|
27
|
+
# orc.write_table(data, filepath)
|
|
28
|
+
#
|
|
29
|
+
# @staticmethod
|
|
30
|
+
# def load(filepath: Path) -> pa.Table:
|
|
31
|
+
# return orc.read_table(filepath)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class PyArrowFeather:
|
|
35
|
+
extension: ClassVar[str] = "pyarrow.feather"
|
|
36
|
+
|
|
37
|
+
@staticmethod
|
|
38
|
+
def save(data: pa.Table, filepath: Path) -> None:
|
|
39
|
+
feather.write_feather(data, filepath)
|
|
40
|
+
|
|
41
|
+
@staticmethod
|
|
42
|
+
def load(filepath: Path) -> pa.Table:
|
|
43
|
+
return feather.read_table(filepath)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class PyArrowCSV:
|
|
47
|
+
extension: ClassVar[str] = "pyarrow.csv"
|
|
48
|
+
|
|
49
|
+
@staticmethod
|
|
50
|
+
def save(data: pa.Table, filepath: Path) -> None:
|
|
51
|
+
csv.write_csv(data, filepath)
|
|
52
|
+
|
|
53
|
+
@staticmethod
|
|
54
|
+
def load(filepath: Path) -> pa.Table:
|
|
55
|
+
return csv.read_csv(filepath)
|
|
56
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@dataclass(frozen=True)
|
|
7
|
+
class PyArrowMarks:
|
|
8
|
+
parquet: pytest.MarkDecorator
|
|
9
|
+
# orc: pytest.MarkDecorator
|
|
10
|
+
feather: pytest.MarkDecorator
|
|
11
|
+
csv: pytest.MarkDecorator
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def marks() -> PyArrowMarks:
|
|
15
|
+
return PyArrowMarks(
|
|
16
|
+
parquet=pytest.mark.record("pyarrow_parquet"),
|
|
17
|
+
# orc=pytest.mark.record("pyarrow_orc"),
|
|
18
|
+
feather=pytest.mark.record("pyarrow_feather"),
|
|
19
|
+
csv=pytest.mark.record("pyarrow_csv"),
|
|
20
|
+
)
|
|
21
|
+
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pytest-ditto-pyarrow"
|
|
3
|
+
dynamic = [
|
|
4
|
+
"version",
|
|
5
|
+
]
|
|
6
|
+
description = "pytest-ditto plugin for pyarrow tables."
|
|
7
|
+
keywords = ["pytest" , "testing"]
|
|
8
|
+
authors = [{ name = "Lachlan Taylor", email = "lachlanbtaylor@proton.me" }]
|
|
9
|
+
maintainers = [{ name = "Lachlan Taylor", email = "lachlanbtaylor@proton.me" }]
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Framework :: Pytest",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Topic :: Software Development :: Testing",
|
|
19
|
+
"Programming Language :: Python",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Operating System :: OS Independent",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"pytest>=3.5.0",
|
|
29
|
+
"pytest-ditto>=0.1.0",
|
|
30
|
+
"pyarrow>=16.1.0",
|
|
31
|
+
]
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pre-commit",
|
|
35
|
+
"hatch>=1.9.4",
|
|
36
|
+
"hatch-vcs>=0.4.0",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.entry-points.ditto]
|
|
40
|
+
pyarrow_parquet = "ditto_pyarrow.io:PyArrowParquet"
|
|
41
|
+
# pyarrow_orc = "ditto_pyarrow.io:PyArrowORC"
|
|
42
|
+
pyarrow_csv = "ditto_pyarrow.io:PyArrowCSV"
|
|
43
|
+
pyarrow_feather = "ditto_pyarrow.io:PyArrowFeather"
|
|
44
|
+
|
|
45
|
+
[project.entry-points.ditto_marks]
|
|
46
|
+
pyarrow = "ditto_pyarrow.marks:marks"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
[build-system]
|
|
50
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
51
|
+
build-backend = "hatchling.build"
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build]
|
|
55
|
+
include = ["src"]
|
|
56
|
+
hooks.vcs.version-file = "src/ditto_pyarrow/_version.py"
|
|
57
|
+
hooks.vcs.template = "__version__ = {version!r}"
|
|
58
|
+
targets.wheel.packages = ["src/ditto_pyarrow"]
|
|
59
|
+
targets.wheel.strict-naming = false
|
|
60
|
+
targets.sdist.packages = ["src/ditto_pyarrow"]
|
|
61
|
+
targets.sdist.strict-naming = false
|
|
62
|
+
|
|
63
|
+
[tool.hatch.version]
|
|
64
|
+
source = "code"
|
|
65
|
+
path = "version_builder.py"
|
|
66
|
+
expression = "_version()"
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
[tool.hatch.envs.default]
|
|
70
|
+
python = "3.10"
|
|
71
|
+
dependencies = [
|
|
72
|
+
"pytest",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[tool.hatch.envs.default.scripts]
|
|
76
|
+
test = "pytest {args:tests/ci}"
|
|
77
|
+
|
|
78
|
+
[[tool.hatch.envs.all.matrix]]
|
|
79
|
+
python = ["3.10", "3.11", "3.12"]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
[tool.pytest.ini_options]
|
|
83
|
+
testpaths = "tests"
|
|
84
|
+
filterwarnings = [
|
|
85
|
+
# "error",
|
|
86
|
+
"ignore::UserWarning",
|
|
87
|
+
# note the use of single quote below to denote "raw" strings in TOML
|
|
88
|
+
'ignore::DeprecationWarning',
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
[tool.black]
|
|
93
|
+
line-length = 88
|
|
94
|
+
target-version = ['py310', 'py311', 'py312']
|
|
95
|
+
exclude = '''
|
|
96
|
+
# A regex preceded with ^/ will apply only to files and directories
|
|
97
|
+
# in the root of the project.
|
|
98
|
+
^/(
|
|
99
|
+
(
|
|
100
|
+
\.eggs
|
|
101
|
+
| \.git
|
|
102
|
+
| \.pytest_cache
|
|
103
|
+
| \.vscode
|
|
104
|
+
| \.mypy_cache
|
|
105
|
+
| __pycache__
|
|
106
|
+
| _cache
|
|
107
|
+
| app_data
|
|
108
|
+
| logs
|
|
109
|
+
| venv
|
|
110
|
+
| build
|
|
111
|
+
| dist
|
|
112
|
+
)/
|
|
113
|
+
)
|
|
114
|
+
'''
|
|
115
|
+
|
|
116
|
+
[tool.coverage.run]
|
|
117
|
+
branch = true
|
|
118
|
+
source = ["src/ditto_pyarrow"]
|
|
119
|
+
|
|
120
|
+
[tool.coverage.report]
|
|
121
|
+
show_missing = true
|
|
122
|
+
fail_under = 80
|
|
123
|
+
|
|
124
|
+
[tool.ruff]
|
|
125
|
+
line-length = 88 # same as Black.
|
|
126
|
+
target-version = "py310"
|
|
127
|
+
|
|
128
|
+
[tool.ruff.lint]
|
|
129
|
+
# Enable the following rule sets:
|
|
130
|
+
# pycodestyle (`E`) https://docs.astral.sh/ruff/rules/#pyflakes-f
|
|
131
|
+
# Pyflakes (`F`) https://docs.astral.sh/ruff/rules/#pyflakes-f
|
|
132
|
+
# flake8-bugbear (B) https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
|
|
133
|
+
# flake8-simplify (SIM) https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
|
|
134
|
+
# flake8-quotes (Q) https://docs.astral.sh/ruff/rules/#flake8-quotes-q
|
|
135
|
+
select = ["E", "F", "C90", "B", "SIM"]
|
|
136
|
+
extend-select = ["Q"]
|
|
137
|
+
ignore = []
|
|
138
|
+
# F401 - imported but unused
|
|
139
|
+
# F841 - local variable assigned but never used
|
|
140
|
+
# SIM300 - Yoda conditions are discouraged
|
|
141
|
+
extend-ignore = ["F401", "F841", "SIM300"]
|
|
142
|
+
|
|
143
|
+
# Allow autofix for all enabled rules (when `--fix`) is provided.
|
|
144
|
+
fixable = ["A", "B", "C", "D", "E", "F"]
|
|
145
|
+
unfixable = []
|
|
146
|
+
|
|
147
|
+
# Exclude a variety of commonly ignored directories.
|
|
148
|
+
exclude = [
|
|
149
|
+
".bzr",
|
|
150
|
+
".direnv",
|
|
151
|
+
".eggs",
|
|
152
|
+
".git",
|
|
153
|
+
".hg",
|
|
154
|
+
".mypy_cache",
|
|
155
|
+
".nox",
|
|
156
|
+
".pants.d",
|
|
157
|
+
".pytype",
|
|
158
|
+
".ruff_cache",
|
|
159
|
+
".svn",
|
|
160
|
+
".tox",
|
|
161
|
+
".venv",
|
|
162
|
+
"__pypackages__",
|
|
163
|
+
"_build",
|
|
164
|
+
"buck-out",
|
|
165
|
+
"build",
|
|
166
|
+
"dist",
|
|
167
|
+
"node_modules",
|
|
168
|
+
"venv",
|
|
169
|
+
]
|
|
170
|
+
|
|
171
|
+
mccabe.max-complexity = 5
|